| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: install.mk,v 1.71 2017/08/07 15:49:44 jlam Exp $ | | 1 | # $NetBSD: install.mk,v 1.72 2017/08/08 17:17:25 jlam Exp $ |
2 | # | | 2 | # |
3 | # This file provides the code for the "install" phase. | | 3 | # This file provides the code for the "install" phase. |
4 | # | | 4 | # |
5 | # Public targets: | | 5 | # Public targets: |
6 | # | | 6 | # |
7 | # stage-install: | | 7 | # stage-install: |
8 | # Installs the package files into LOCALBASE or ${DESTDIR}${LOCALBASE}. | | 8 | # Installs the package files into LOCALBASE or ${DESTDIR}${LOCALBASE}. |
9 | # | | 9 | # |
10 | | | 10 | |
11 | # Interface for other infrastructure components: | | 11 | # Interface for other infrastructure components: |
12 | # | | 12 | # |
13 | # Hooks for use by the infrastructure: | | 13 | # Hooks for use by the infrastructure: |
14 | # | | 14 | # |
| @@ -236,41 +236,45 @@ _INSTALL_ONE_DIR_CMD= { \ | | | @@ -236,41 +236,45 @@ _INSTALL_ONE_DIR_CMD= { \ |
236 | *) \ | | 236 | *) \ |
237 | ${INSTALL_DATA_DIR} "$$ddir" ;; \ | | 237 | ${INSTALL_DATA_DIR} "$$ddir" ;; \ |
238 | esac; \ | | 238 | esac; \ |
239 | } | | 239 | } |
240 | | | 240 | |
241 | # _INSTALLATION_DIRS | | 241 | # _INSTALLATION_DIRS |
242 | # Contains the items listed in ${INSTALLATION_DIRS} with the | | 242 | # Contains the items listed in ${INSTALLATION_DIRS} with the |
243 | # following transformations performed, in order: | | 243 | # following transformations performed, in order: |
244 | # | | 244 | # |
245 | # 1. Leading "${PREFIX}/" is stripped. | | 245 | # 1. Leading "${PREFIX}/" is stripped. |
246 | # 2. Leading "gnu/" is transformed into "${PKGGNUDIR}". | | 246 | # 2. Leading "gnu/" is transformed into "${PKGGNUDIR}". |
247 | # 3. Leading "man/" is transformed into "${PKGMANDIR}/". | | 247 | # 3. Leading "man/" is transformed into "${PKGMANDIR}/". |
248 | # | | 248 | # |
249 | # ASSERT: Paths listed in ${_INSTALLATION_DIRS} must be relative paths. | | 249 | # Check that paths listed in ${_INSTALLATION_DIRS} are relative paths. |
| | | 250 | # This can't be an assertion because some variables used when listing |
| | | 251 | # directories in INSTALLATION_DIRS are not expanded until they are |
| | | 252 | # used. |
250 | # | | 253 | # |
251 | _INSTALLATION_DIRS= ${INSTALLATION_DIRS:C,^${PREFIX}/,,:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,} | | 254 | _INSTALLATION_DIRS= ${INSTALLATION_DIRS:C,^${PREFIX}/,,:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,} |
252 | .if !empty(_INSTALLATION_DIRS:M/*) | | | |
253 | PKG_FAIL_REASON+= "INSTALLATION_DIRS items must begin with "${PREFIX:Q}" or be relative paths." | | | |
254 | .endif | | | |
255 | | | 255 | |
256 | .PHONY: install-makedirs | | 256 | .PHONY: install-makedirs |
257 | install-makedirs: | | 257 | install-makedirs: |
258 | ${RUN} ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX} | | 258 | ${RUN} ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX} |
259 | .if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS) | | 259 | .if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS) |
260 | @${STEP_MSG} "Creating installation directories" | | 260 | @${STEP_MSG} "Creating installation directories" |
261 | ${RUN} \ | | 261 | ${RUN} set -- args ${_INSTALLATION_DIRS}; shift; \ |
262 | for dir in ${_INSTALLATION_DIRS}; do \ | | 262 | while ${TEST} "$$#" -gt 0; do \ |
263 | ${_INSTALL_ONE_DIR_CMD}; \ | | 263 | dir="$$1"; shift; \ |
| | | 264 | case "$$dir" in \ |
| | | 265 | /*) ${FAIL_MSG} "INSTALLATION_DIRS: $$dir must be in "${PREFIX:Q}"." ;; \ |
| | | 266 | *) ${_INSTALL_ONE_DIR_CMD} ;; \ |
| | | 267 | esac; \ |
264 | done | | 268 | done |
265 | .endif # INSTALLATION_DIRS | | 269 | .endif # INSTALLATION_DIRS |
266 | | | 270 | |
267 | # Creates the directories for all files that are mentioned in the static | | 271 | # Creates the directories for all files that are mentioned in the static |
268 | # PLIST files of the package, to make the declaration of | | 272 | # PLIST files of the package, to make the declaration of |
269 | # INSTALLATION_DIRS redundant in some cases. | | 273 | # INSTALLATION_DIRS redundant in some cases. |
270 | # | | 274 | # |
271 | # To enable this, the variable INSTALLATION_DIRS_FROM_PLIST must be set | | 275 | # To enable this, the variable INSTALLATION_DIRS_FROM_PLIST must be set |
272 | # to "yes". | | 276 | # to "yes". |
273 | # | | 277 | # |
274 | .PHONY: install-dirs-from-PLIST | | 278 | .PHONY: install-dirs-from-PLIST |
275 | install-dirs-from-PLIST: | | 279 | install-dirs-from-PLIST: |
276 | @${STEP_MSG} "Creating installation directories from PLIST files" | | 280 | @${STEP_MSG} "Creating installation directories from PLIST files" |