summaryrefslogtreecommitdiff
path: root/mk/install
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2017-08-08 17:17:25 +0000
committerjlam <jlam@pkgsrc.org>2017-08-08 17:17:25 +0000
commit6dae74afa4c76e879a93a3265786457625d87fd5 (patch)
tree1b7d68a7aacfc3c1558f24f0d92036c895451416 /mk/install
parent55b65b867f2257600ccee7f027aa7d76e14fce4d (diff)
downloadpkgsrc-6dae74afa4c76e879a93a3265786457625d87fd5.tar.gz
Check, don't assert, that INSTALLATION_DIRS are all in ${PREFIX}.
Change the assertion into an install-time check that the paths listed in INSTALLATION_DIRS are relative paths or are in ${PREFIX}. This delays the check so that some common variables used when listing directories in INSTALLATION_DIRS are fully-expanded.
Diffstat (limited to 'mk/install')
-rw-r--r--mk/install/install.mk20
1 files changed, 12 insertions, 8 deletions
diff --git a/mk/install/install.mk b/mk/install/install.mk
index efb09fac3a9..fb50905518e 100644
--- a/mk/install/install.mk
+++ b/mk/install/install.mk
@@ -1,4 +1,4 @@
-# $NetBSD: install.mk,v 1.71 2017/08/07 15:49:44 jlam Exp $
+# $NetBSD: install.mk,v 1.72 2017/08/08 17:17:25 jlam Exp $
#
# This file provides the code for the "install" phase.
#
@@ -246,21 +246,25 @@ _INSTALL_ONE_DIR_CMD= { \
# 2. Leading "gnu/" is transformed into "${PKGGNUDIR}".
# 3. Leading "man/" is transformed into "${PKGMANDIR}/".
#
-# ASSERT: Paths listed in ${_INSTALLATION_DIRS} must be relative paths.
+# Check that paths listed in ${_INSTALLATION_DIRS} are relative paths.
+# This can't be an assertion because some variables used when listing
+# directories in INSTALLATION_DIRS are not expanded until they are
+# used.
#
_INSTALLATION_DIRS= ${INSTALLATION_DIRS:C,^${PREFIX}/,,:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,}
-.if !empty(_INSTALLATION_DIRS:M/*)
-PKG_FAIL_REASON+= "INSTALLATION_DIRS items must begin with "${PREFIX:Q}" or be relative paths."
-.endif
.PHONY: install-makedirs
install-makedirs:
${RUN} ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}
.if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS)
@${STEP_MSG} "Creating installation directories"
- ${RUN} \
- for dir in ${_INSTALLATION_DIRS}; do \
- ${_INSTALL_ONE_DIR_CMD}; \
+ ${RUN} set -- args ${_INSTALLATION_DIRS}; shift; \
+ while ${TEST} "$$#" -gt 0; do \
+ dir="$$1"; shift; \
+ case "$$dir" in \
+ /*) ${FAIL_MSG} "INSTALLATION_DIRS: $$dir must be in "${PREFIX:Q}"." ;; \
+ *) ${_INSTALL_ONE_DIR_CMD} ;; \
+ esac; \
done
.endif # INSTALLATION_DIRS