Skip to content
Snippets Groups Projects
Commit 41906a12 authored by Simon Rose's avatar Simon Rose
Browse files

Install the license file in the third build stage

Note that this is largely to keep the two versions (nfs, conda) of
require compatible; there is no strict need to do this here, but the
conda version does require it.
parent 9fd35741
No related branches found
No related tags found
1 merge request!155Install the license file in the third build stage
Pipeline #172601 passed with warnings
...@@ -302,7 +302,6 @@ CFGS = ${CONFIGS} ...@@ -302,7 +302,6 @@ CFGS = ${CONFIGS}
CFGS += ${CONFIGS_${EPICSVERSION}} CFGS += ${CONFIGS_${EPICSVERSION}}
export CFGS export CFGS
INSTALL_LICENSE = ${MODULE_LOCATION}/doc
# Find all license files to distribute with binaries # Find all license files to distribute with binaries
LICENSES = $(shell find -not -path '*/.*' -type f -iname LICENSE) LICENSES = $(shell find -not -path '*/.*' -type f -iname LICENSE)
LICENSES += $(shell find -not -path '*/.*' -type f -iname Copyright) LICENSES += $(shell find -not -path '*/.*' -type f -iname Copyright)
...@@ -367,20 +366,6 @@ build:: ${COMMON_DIR}/${METAFILE} ...@@ -367,20 +366,6 @@ build:: ${COMMON_DIR}/${METAFILE}
install:: ${INSTALL_META} install:: ${INSTALL_META}
# The licenses should be installed after everything
define license_install =
$1: $2
@echo "Installing license file $$^"
$$(INSTALL) -d -m444 $$^ $$(@D)
install:: $1
endef
# Creates a target for every license file to be installed. Some modules have
# more than one license file that needs distribution. For them we add the
# previous directory so we have them separate by projects inside /doc.
$(foreach d, $(LICENSES), $(eval $(call license_install, $(INSTALL_LICENSE)/$(filter-out ., $(lastword $(subst /, , $(dir $(d))))/$(notdir $(d))), $(d))))
else # T_A else # T_A
ifeq ($(filter O.%,$(notdir ${CURDIR})),) ifeq ($(filter O.%,$(notdir ${CURDIR})),)
...@@ -676,6 +661,7 @@ INSTALL_DBS = $(addprefix ${INSTALL_DB}/,$(notdir ${TEMPLS})) ...@@ -676,6 +661,7 @@ INSTALL_DBS = $(addprefix ${INSTALL_DB}/,$(notdir ${TEMPLS}))
INSTALL_SCRS = $(addprefix ${INSTALL_SCR}/,$(notdir ${SCR})) INSTALL_SCRS = $(addprefix ${INSTALL_SCR}/,$(notdir ${SCR}))
INSTALL_BINS = $(addprefix ${INSTALL_BIN}/,$(notdir ${BINS})) INSTALL_BINS = $(addprefix ${INSTALL_BIN}/,$(notdir ${BINS}))
INSTALL_CONFIGS = $(addprefix ${INSTALL_CONFIG}/,$(notdir ${CFGS})) INSTALL_CONFIGS = $(addprefix ${INSTALL_CONFIG}/,$(notdir ${CFGS}))
INSTALL_LICENSES = $(addprefix ${INSTALL_DOC}/,${LICENSES})
debug:: debug::
@echo "INSTALL_LIB = $(INSTALL_LIB)" @echo "INSTALL_LIB = $(INSTALL_LIB)"
...@@ -694,6 +680,7 @@ debug:: ...@@ -694,6 +680,7 @@ debug::
@echo "INSTALL_CONFIGS = $(INSTALL_CONFIGS)" @echo "INSTALL_CONFIGS = $(INSTALL_CONFIGS)"
@echo "INSTALL_BIN = $(INSTALL_BIN)" @echo "INSTALL_BIN = $(INSTALL_BIN)"
@echo "INSTALL_BINS = $(INSTALL_BINS)" @echo "INSTALL_BINS = $(INSTALL_BINS)"
@echo "INSTALL_LICENSES = $(INSTALL_LICENSES)"
@echo "HDR_SUBDIRS = $(HDR_SUBDIRS)" @echo "HDR_SUBDIRS = $(HDR_SUBDIRS)"
define install_subdirs define install_subdirs
...@@ -708,7 +695,8 @@ debug:: ...@@ -708,7 +695,8 @@ debug::
endef endef
$(foreach d,$(HDR_SUBDIRS),$(eval $(call install_subdirs,$d))) $(foreach d,$(HDR_SUBDIRS),$(eval $(call install_subdirs,$d)))
INSTALLS += ${INSTALL_CONFIGS} ${INSTALL_SCRS} ${INSTALL_HDRS} ${INSTALL_DBDS} ${INSTALL_DBS} ${INSTALL_LIBS} ${INSTALL_VLIBS} ${INSTALL_BINS} ${INSTALL_DEPS} INSTALLS += ${INSTALL_CONFIGS} ${INSTALL_SCRS} ${INSTALL_HDRS} ${INSTALL_DBDS} ${INSTALL_DBS} \
${INSTALL_LIBS} ${INSTALL_VLIBS} ${INSTALL_BINS} ${INSTALL_DEPS} ${INSTALL_LICENSES}
install: ${INSTALLS} install: ${INSTALLS}
...@@ -744,6 +732,13 @@ ${INSTALL_BINS}: $(addprefix ../,$(filter-out /%,${BINS})) $(filter /%,${BINS}) ...@@ -744,6 +732,13 @@ ${INSTALL_BINS}: $(addprefix ../,$(filter-out /%,${BINS})) $(filter /%,${BINS})
@echo "Installing binaries $^ to $(@D)" @echo "Installing binaries $^ to $(@D)"
$(INSTALL) -d -m$(BIN_PERMISSIONS) $^ $(@D) $(INSTALL) -d -m$(BIN_PERMISSIONS) $^ $(@D)
define license_install =
$1: $2
@echo "Installing license file $$^"
$$(INSTALL) -d -m444 $$^ $$(@D)
endef
$(foreach l,$(LICENSES),$(eval $(call license_install,$(INSTALL_DOC)/$l,../$l)))
# Create GPIB code from *.gt file. # Create GPIB code from *.gt file.
%.c %.dbd %.list: %.gt %.c %.dbd %.list: %.gt
@echo "Converting $*.gt" @echo "Converting $*.gt"
......
...@@ -743,8 +743,8 @@ def test_install_license(wrapper: Wrapper): ...@@ -743,8 +743,8 @@ def test_install_license(wrapper: Wrapper):
rc, out, _ = wrapper.run_make("install") rc, out, _ = wrapper.run_make("install")
assert rc == 0 assert rc == 0
assert re.search("Installing license file LICENSE", out) assert re.search("Installing license file .././LICENSE", out)
assert re.search("Installing license file foo/LICENSE", out) assert re.search("Installing license file .././foo/LICENSE", out)
file_path = wrapper.package_dir / "doc/LICENSE" file_path = wrapper.package_dir / "doc/LICENSE"
assert file_path.exists() assert file_path.exists()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment