diff options
Diffstat (limited to 'mk/install/install.mk')
-rw-r--r-- | mk/install/install.mk | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/mk/install/install.mk b/mk/install/install.mk index 1a7368bdd0c..efb09fac3a9 100644 --- a/mk/install/install.mk +++ b/mk/install/install.mk @@ -1,4 +1,4 @@ -# $NetBSD: install.mk,v 1.70 2017/06/01 02:15:10 jlam Exp $ +# $NetBSD: install.mk,v 1.71 2017/08/07 15:49:44 jlam Exp $ # # This file provides the code for the "install" phase. # @@ -38,10 +38,11 @@ # # INSTALLATION_DIRS # A list of directories that should be created at the very -# beginning of the install phase. These directories are relative -# to ${PREFIX}. As a convenience, a leading gnu/ is transformed -# to ${PKGGNUDIR} and a leading man/ is transformed to -# ${PKGMANDIR}, to save package authors from typing too much. +# beginning of the install phase. These directories MUST either +# be paths that contain a leading {PREFIX}/ or be relative +# paths. As a convenience, a leading gnu/ is transformed to +# ${PKGGNUDIR} and a leading man/ is transformed to ${PKGMANDIR}, +# to save package authors from typing too much. # # AUTO_MKDIRS # INSTALLATION_DIRS_FROM_PLIST @@ -237,18 +238,28 @@ _INSTALL_ONE_DIR_CMD= { \ esac; \ } +# _INSTALLATION_DIRS +# Contains the items listed in ${INSTALLATION_DIRS} with the +# following transformations performed, in order: +# +# 1. Leading "${PREFIX}/" is stripped. +# 2. Leading "gnu/" is transformed into "${PKGGNUDIR}". +# 3. Leading "man/" is transformed into "${PKGMANDIR}/". +# +# ASSERT: Paths listed in ${_INSTALLATION_DIRS} must be relative paths. +# +_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:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,}; do \ - case "$$dir" in \ - ${PREFIX}/*) \ - dir=`${ECHO} "$$dir" | ${SED} "s|^${PREFIX}/||"` ;; \ - /*) continue ;; \ - esac; \ + for dir in ${_INSTALLATION_DIRS}; do \ ${_INSTALL_ONE_DIR_CMD}; \ done .endif # INSTALLATION_DIRS |