Sat Jul 28 21:33:48 2012 UTC ()
fix typo in comment


(reed)
diff -r1.63 -r1.64 pkgsrc/mk/install/install.mk

cvs diff -r1.63 -r1.64 pkgsrc/mk/install/install.mk (switch to unified diff)

--- pkgsrc/mk/install/install.mk 2011/10/15 00:23:09 1.63
+++ pkgsrc/mk/install/install.mk 2012/07/28 21:33:48 1.64
@@ -1,397 +1,397 @@ @@ -1,397 +1,397 @@
1# $NetBSD: install.mk,v 1.63 2011/10/15 00:23:09 reed Exp $ 1# $NetBSD: install.mk,v 1.64 2012/07/28 21:33:48 reed 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#
15# privileged-install-hook: 15# privileged-install-hook:
16# This hook is placed after the package has been installed, 16# This hook is placed after the package has been installed,
17# before leaving the privileged mode. 17# before leaving the privileged mode.
18# 18#
19# unprivileged-install-hook: 19# unprivileged-install-hook:
20# This hook is placed _before_ switching to privileged mode 20# This hook is placed _before_ switching to privileged mode
21# in order to install the package. 21# in order to install the package.
22# 22#
23 23
24# === User-settable variables === 24# === User-settable variables ===
25# 25#
26# INSTALL_UNSTRIPPED 26# INSTALL_UNSTRIPPED
27# If "yes", all binaries and shared libraries are installed 27# If "yes", all binaries and shared libraries are installed
28# unstripped. Otherwise they are stripped while being installed. 28# unstripped. Otherwise they are stripped while being installed.
29# This option is not supported by all packages. 29# This option is not supported by all packages.
30# 30#
31# STRIP_DEBUG 31# STRIP_DEBUG
32# If set to "yes", call ${STRI} -g to remove debug information 32# If set to "yes", call ${STRIP} -g to remove debug information
33# from all files. The symbol tables are still preserved. 33# from all files. The symbol tables are still preserved.
34# 34#
35# Keywords: strip unstripped 35# Keywords: strip unstripped
36# 36#
37# === Package-settable variables === 37# === Package-settable variables ===
38# 38#
39# INSTALLATION_DIRS 39# INSTALLATION_DIRS
40# A list of directories that should be created at the very 40# A list of directories that should be created at the very
41# beginning of the install phase. These directories are relative 41# beginning of the install phase. These directories are relative
42# to ${PREFIX}. As a convenience, a leading man/ is transformed 42# to ${PREFIX}. As a convenience, a leading man/ is transformed
43# to ${PKGMANDIR}, to save package authors from typing too much. 43# to ${PKGMANDIR}, to save package authors from typing too much.
44# 44#
45# AUTO_MKDIRS 45# AUTO_MKDIRS
46# INSTALLATION_DIRS_FROM_PLIST 46# INSTALLATION_DIRS_FROM_PLIST
47# In most (or even all?) cases the PLIST files in the package 47# In most (or even all?) cases the PLIST files in the package
48# directory already contain all directories that are needed. 48# directory already contain all directories that are needed.
49# When this variable is set to "yes", all directories mentioned 49# When this variable is set to "yes", all directories mentioned
50# in the PLIST files will be created like in INSTALLATION_DIRS. 50# in the PLIST files will be created like in INSTALLATION_DIRS.
51# 51#
52# DESTDIR_VARNAME 52# DESTDIR_VARNAME
53# A variable name that should be set as staged installation location 53# A variable name that should be set as staged installation location
54# presented as ${DESTDIR} at install phase. 54# presented as ${DESTDIR} at install phase.
55# "DESTDIR" is set by default. 55# "DESTDIR" is set by default.
56 56
57###################################################################### 57######################################################################
58### install (PUBLIC) 58### install (PUBLIC)
59###################################################################### 59######################################################################
60### install is a public target to install the package. It will 60### install is a public target to install the package. It will
61### acquire elevated privileges just-in-time. 61### acquire elevated privileges just-in-time.
62### 62###
63_INSTALL_TARGETS+= check-vulnerable 63_INSTALL_TARGETS+= check-vulnerable
64_INSTALL_TARGETS+= ${_PKGSRC_BUILD_TARGETS} 64_INSTALL_TARGETS+= ${_PKGSRC_BUILD_TARGETS}
65_INSTALL_TARGETS+= acquire-install-lock 65_INSTALL_TARGETS+= acquire-install-lock
66_INSTALL_TARGETS+= ${_COOKIE.install} 66_INSTALL_TARGETS+= ${_COOKIE.install}
67_INSTALL_TARGETS+= release-install-lock 67_INSTALL_TARGETS+= release-install-lock
68 68
69.PHONY: stage-install 69.PHONY: stage-install
70.if !target(stage-install) 70.if !target(stage-install)
71. if exists(${_COOKIE.install}) 71. if exists(${_COOKIE.install})
72stage-install: 72stage-install:
73 @${DO_NADA} 73 @${DO_NADA}
74. elif defined(_PKGSRC_BARRIER) 74. elif defined(_PKGSRC_BARRIER)
75stage-install: ${_INSTALL_TARGETS} 75stage-install: ${_INSTALL_TARGETS}
76. else 76. else
77stage-install: barrier 77stage-install: barrier
78. endif 78. endif
79.endif 79.endif
80 80
81.PHONY: acquire-install-lock release-install-lock 81.PHONY: acquire-install-lock release-install-lock
82acquire-install-lock: acquire-lock 82acquire-install-lock: acquire-lock
83release-install-lock: release-lock 83release-install-lock: release-lock
84 84
85.if exists(${_COOKIE.install}) 85.if exists(${_COOKIE.install})
86${_COOKIE.install}: 86${_COOKIE.install}:
87 @${DO_NADA} 87 @${DO_NADA}
88.else 88.else
89${_COOKIE.install}: real-install 89${_COOKIE.install}: real-install
90.endif 90.endif
91 91
92###################################################################### 92######################################################################
93### real-install (PRIVATE) 93### real-install (PRIVATE)
94###################################################################### 94######################################################################
95### real-install is a helper target onto which one can hook all of the 95### real-install is a helper target onto which one can hook all of the
96### targets that do the actual installing of the built objects. 96### targets that do the actual installing of the built objects.
97### 97###
98_REAL_INSTALL_TARGETS+= install-check-interactive 98_REAL_INSTALL_TARGETS+= install-check-interactive
99_REAL_INSTALL_TARGETS+= install-check-version 99_REAL_INSTALL_TARGETS+= install-check-version
100_REAL_INSTALL_TARGETS+= install-message 100_REAL_INSTALL_TARGETS+= install-message
101_REAL_INSTALL_TARGETS+= stage-install-vars 101_REAL_INSTALL_TARGETS+= stage-install-vars
102_REAL_INSTALL_TARGETS+= unprivileged-install-hook 102_REAL_INSTALL_TARGETS+= unprivileged-install-hook
103_REAL_INSTALL_TARGETS+= install-all 103_REAL_INSTALL_TARGETS+= install-all
104_REAL_INSTALL_TARGETS+= install-cookie 104_REAL_INSTALL_TARGETS+= install-cookie
105 105
106.PHONY: real-install 106.PHONY: real-install
107real-install: ${_REAL_INSTALL_TARGETS} 107real-install: ${_REAL_INSTALL_TARGETS}
108 108
109.PHONY: install-message 109.PHONY: install-message
110install-message: 110install-message:
111 @${PHASE_MSG} "Installing for ${PKGNAME}" 111 @${PHASE_MSG} "Installing for ${PKGNAME}"
112 112
113###################################################################### 113######################################################################
114### install-check-interactive (PRIVATE) 114### install-check-interactive (PRIVATE)
115###################################################################### 115######################################################################
116### install-check-interactive checks whether we must do an interactive 116### install-check-interactive checks whether we must do an interactive
117### install or not. 117### install or not.
118### 118###
119install-check-interactive: .PHONY 119install-check-interactive: .PHONY
120.if !empty(INTERACTIVE_STAGE:Minstall) && defined(BATCH) 120.if !empty(INTERACTIVE_STAGE:Minstall) && defined(BATCH)
121 @${ERROR_MSG} "The installation stage of this package requires user interaction" 121 @${ERROR_MSG} "The installation stage of this package requires user interaction"
122 @${ERROR_MSG} "Please install manually with:" 122 @${ERROR_MSG} "Please install manually with:"
123 @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} install\"" 123 @${ERROR_MSG} " \"cd ${.CURDIR} && ${MAKE} install\""
124 ${RUN} ${FALSE} 124 ${RUN} ${FALSE}
125.else 125.else
126 @${DO_NADA} 126 @${DO_NADA}
127.endif 127.endif
128 128
129.PHONY: unprivileged-install-hook 129.PHONY: unprivileged-install-hook
130unprivileged-install-hook: 130unprivileged-install-hook:
131 @${DO_NADA} 131 @${DO_NADA}
132 132
133###################################################################### 133######################################################################
134### install-check-version (PRIVATE) 134### install-check-version (PRIVATE)
135###################################################################### 135######################################################################
136### install-check-version will verify that the built package located in 136### install-check-version will verify that the built package located in
137### ${WRKDIR} matches the version specified in the package Makefile. 137### ${WRKDIR} matches the version specified in the package Makefile.
138### This is a check against stale work directories. 138### This is a check against stale work directories.
139### 139###
140.PHONY: install-check-version 140.PHONY: install-check-version
141install-check-version: ${_COOKIE.extract} 141install-check-version: ${_COOKIE.extract}
142 ${RUN} \ 142 ${RUN} \
143 extractname=`${CAT} ${_COOKIE.extract}`; \ 143 extractname=`${CAT} ${_COOKIE.extract}`; \
144 pkgname=${PKGNAME}; \ 144 pkgname=${PKGNAME}; \
145 case "$$extractname" in \ 145 case "$$extractname" in \
146 "") ${WARNING_MSG} "${WRKDIR} may contain an older version of ${PKGBASE}" ;; \ 146 "") ${WARNING_MSG} "${WRKDIR} may contain an older version of ${PKGBASE}" ;; \
147 "$$pkgname") ;; \ 147 "$$pkgname") ;; \
148 *) ${WARNING_MSG} "Package version $$extractname in ${WRKDIR}"; \ 148 *) ${WARNING_MSG} "Package version $$extractname in ${WRKDIR}"; \
149 ${WARNING_MSG} "Current version $$pkgname in ${PKGPATH}"; \ 149 ${WARNING_MSG} "Current version $$pkgname in ${PKGPATH}"; \
150 ${WARNING_MSG} "Cleaning and rebuilding $$pkgname..."; \ 150 ${WARNING_MSG} "Cleaning and rebuilding $$pkgname..."; \
151 ${RECURSIVE_MAKE} ${MAKEFLAGS} clean; \ 151 ${RECURSIVE_MAKE} ${MAKEFLAGS} clean; \
152 ${RECURSIVE_MAKE} ${MAKEFLAGS} build ;; \ 152 ${RECURSIVE_MAKE} ${MAKEFLAGS} build ;; \
153 esac 153 esac
154 154
155###################################################################### 155######################################################################
156### The targets below are run with elevated privileges. 156### The targets below are run with elevated privileges.
157###################################################################### 157######################################################################
158 158
159.PHONY: acquire-install-localbase-lock release-install-localbase-lock 159.PHONY: acquire-install-localbase-lock release-install-localbase-lock
160acquire-install-localbase-lock: acquire-localbase-lock 160acquire-install-localbase-lock: acquire-localbase-lock
161release-install-localbase-lock: release-localbase-lock 161release-install-localbase-lock: release-localbase-lock
162 162
163###################################################################### 163######################################################################
164### install-all, su-install-all (PRIVATE) 164### install-all, su-install-all (PRIVATE)
165###################################################################### 165######################################################################
166### install-all is a helper target to run the install target of 166### install-all is a helper target to run the install target of
167### the built software, register the software installation, and run 167### the built software, register the software installation, and run
168### some sanity checks. 168### some sanity checks.
169### 169###
170.if ${_USE_DESTDIR} != "user-destdir" 170.if ${_USE_DESTDIR} != "user-destdir"
171_INSTALL_ALL_TARGETS+= acquire-install-localbase-lock 171_INSTALL_ALL_TARGETS+= acquire-install-localbase-lock
172.endif 172.endif
173.if ${_USE_DESTDIR} == "no" 173.if ${_USE_DESTDIR} == "no"
174_INSTALL_ALL_TARGETS+= _pkgformat-check-conflicts 174_INSTALL_ALL_TARGETS+= _pkgformat-check-conflicts
175_INSTALL_ALL_TARGETS+= _pkgformat-check-installed 175_INSTALL_ALL_TARGETS+= _pkgformat-check-installed
176.endif 176.endif
177_INSTALL_ALL_TARGETS+= install-check-umask 177_INSTALL_ALL_TARGETS+= install-check-umask
178.if empty(CHECK_FILES:M[nN][oO]) && !empty(CHECK_FILES_SUPPORTED:M[Yy][Ee][Ss]) 178.if empty(CHECK_FILES:M[nN][oO]) && !empty(CHECK_FILES_SUPPORTED:M[Yy][Ee][Ss])
179_INSTALL_ALL_TARGETS+= check-files-pre 179_INSTALL_ALL_TARGETS+= check-files-pre
180.endif 180.endif
181_INSTALL_ALL_TARGETS+= install-makedirs 181_INSTALL_ALL_TARGETS+= install-makedirs
182.if defined(INSTALLATION_DIRS_FROM_PLIST) && \ 182.if defined(INSTALLATION_DIRS_FROM_PLIST) && \
183 !empty(INSTALLATION_DIRS_FROM_PLIST:M[Yy][Ee][Ss]) 183 !empty(INSTALLATION_DIRS_FROM_PLIST:M[Yy][Ee][Ss])
184_INSTALL_ALL_TARGETS+= install-dirs-from-PLIST 184_INSTALL_ALL_TARGETS+= install-dirs-from-PLIST
185.elif defined(AUTO_MKDIRS) && !empty(AUTO_MKDIRS:M[Yy][Ee][Ss]) 185.elif defined(AUTO_MKDIRS) && !empty(AUTO_MKDIRS:M[Yy][Ee][Ss])
186_INSTALL_ALL_TARGETS+= install-dirs-from-PLIST 186_INSTALL_ALL_TARGETS+= install-dirs-from-PLIST
187.endif 187.endif
188.if ${_USE_DESTDIR} == "no" 188.if ${_USE_DESTDIR} == "no"
189_INSTALL_ALL_TARGETS+= pre-install-script 189_INSTALL_ALL_TARGETS+= pre-install-script
190.endif 190.endif
191_INSTALL_ALL_TARGETS+= pre-install 191_INSTALL_ALL_TARGETS+= pre-install
192_INSTALL_ALL_TARGETS+= do-install 192_INSTALL_ALL_TARGETS+= do-install
193_INSTALL_ALL_TARGETS+= post-install 193_INSTALL_ALL_TARGETS+= post-install
194_INSTALL_ALL_TARGETS+= plist 194_INSTALL_ALL_TARGETS+= plist
195.if !empty(STRIP_DEBUG:M[Yy][Ee][Ss]) 195.if !empty(STRIP_DEBUG:M[Yy][Ee][Ss])
196_INSTALL_ALL_TARGETS+= install-strip-debug 196_INSTALL_ALL_TARGETS+= install-strip-debug
197.endif 197.endif
198_INSTALL_ALL_TARGETS+= install-doc-handling 198_INSTALL_ALL_TARGETS+= install-doc-handling
199_INSTALL_ALL_TARGETS+= install-script-data 199_INSTALL_ALL_TARGETS+= install-script-data
200.if empty(CHECK_FILES:M[nN][oO]) && !empty(CHECK_FILES_SUPPORTED:M[Yy][Ee][Ss]) 200.if empty(CHECK_FILES:M[nN][oO]) && !empty(CHECK_FILES_SUPPORTED:M[Yy][Ee][Ss])
201_INSTALL_ALL_TARGETS+= check-files-post 201_INSTALL_ALL_TARGETS+= check-files-post
202.endif 202.endif
203.if ${_USE_DESTDIR} == "no" 203.if ${_USE_DESTDIR} == "no"
204_INSTALL_ALL_TARGETS+= post-install-script 204_INSTALL_ALL_TARGETS+= post-install-script
205.endif 205.endif
206.if ${_USE_DESTDIR} == "no" 206.if ${_USE_DESTDIR} == "no"
207_INSTALL_ALL_TARGETS+= _pkgformat-register 207_INSTALL_ALL_TARGETS+= _pkgformat-register
208.else 208.else
209_INSTALL_ALL_TARGETS+= _pkgformat-generate-metadata 209_INSTALL_ALL_TARGETS+= _pkgformat-generate-metadata
210.endif 210.endif
211_INSTALL_ALL_TARGETS+= privileged-install-hook 211_INSTALL_ALL_TARGETS+= privileged-install-hook
212.if ${_USE_DESTDIR} != "user-destdir" 212.if ${_USE_DESTDIR} != "user-destdir"
213_INSTALL_ALL_TARGETS+= release-install-localbase-lock 213_INSTALL_ALL_TARGETS+= release-install-localbase-lock
214.endif 214.endif
215_INSTALL_ALL_TARGETS+= error-check 215_INSTALL_ALL_TARGETS+= error-check
216 216
217.PHONY: install-all su-install-all 217.PHONY: install-all su-install-all
218. if !empty(_MAKE_INSTALL_AS_ROOT:M[Yy][Ee][Ss]) 218. if !empty(_MAKE_INSTALL_AS_ROOT:M[Yy][Ee][Ss])
219install-all: su-target 219install-all: su-target
220. else 220. else
221install-all: su-install-all 221install-all: su-install-all
222. endif 222. endif
223su-install-all: ${_INSTALL_ALL_TARGETS} 223su-install-all: ${_INSTALL_ALL_TARGETS}
224 224
225###################################################################### 225######################################################################
226### install-check-umask (PRIVATE) 226### install-check-umask (PRIVATE)
227###################################################################### 227######################################################################
228### install-check-umask tests whether the umask is properly set and 228### install-check-umask tests whether the umask is properly set and
229### emits a non-fatal warning otherwise. 229### emits a non-fatal warning otherwise.
230### 230###
231.PHONY: install-check-umask 231.PHONY: install-check-umask
232install-check-umask: 232install-check-umask:
233 ${RUN} \ 233 ${RUN} \
234 umask=`${SH} -c umask`; \ 234 umask=`${SH} -c umask`; \
235 if [ "$$umask" -ne ${DEF_UMASK} ]; then \ 235 if [ "$$umask" -ne ${DEF_UMASK} ]; then \
236 ${WARNING_MSG} "Your umask is \`\`$$umask''."; \ 236 ${WARNING_MSG} "Your umask is \`\`$$umask''."; \
237 ${WARNING_MSG} "If this is not desired, set it to an appropriate value (${DEF_UMASK}) and install"; \ 237 ${WARNING_MSG} "If this is not desired, set it to an appropriate value (${DEF_UMASK}) and install"; \
238 ${WARNING_MSG} "this package again by \`\`${MAKE} deinstall reinstall''."; \ 238 ${WARNING_MSG} "this package again by \`\`${MAKE} deinstall reinstall''."; \
239 fi 239 fi
240 240
241###################################################################### 241######################################################################
242### install-makedirs (PRIVATE) 242### install-makedirs (PRIVATE)
243###################################################################### 243######################################################################
244### install-makedirs is a target to create directories expected to 244### install-makedirs is a target to create directories expected to
245### exist prior to installation. The package is supposed to create 245### exist prior to installation. The package is supposed to create
246### all directories not listed in INSTALLATION_DIRS. 246### all directories not listed in INSTALLATION_DIRS.
247### 247###
248 248
249# A shell command that creates the directory ${DESTDIR}${PREFIX}/$$dir 249# A shell command that creates the directory ${DESTDIR}${PREFIX}/$$dir
250# with appropriate permissions and ownership. 250# with appropriate permissions and ownership.
251# 251#
252_INSTALL_ONE_DIR_CMD= { \ 252_INSTALL_ONE_DIR_CMD= { \
253 ddir="${DESTDIR}${PREFIX}/$$dir"; \ 253 ddir="${DESTDIR}${PREFIX}/$$dir"; \
254 [ ! -f "$$ddir" ] || ${FAIL_MSG} "[install.mk] $$ddir should be a directory, but is a file."; \ 254 [ ! -f "$$ddir" ] || ${FAIL_MSG} "[install.mk] $$ddir should be a directory, but is a file."; \
255 case "$$dir" in \ 255 case "$$dir" in \
256 *bin|*bin/*|*libexec|*libexec/*) \ 256 *bin|*bin/*|*libexec|*libexec/*) \
257 ${INSTALL_PROGRAM_DIR} "$$ddir" ;; \ 257 ${INSTALL_PROGRAM_DIR} "$$ddir" ;; \
258 ${PKGMANDIR}/*) \ 258 ${PKGMANDIR}/*) \
259 ${INSTALL_MAN_DIR} "$$ddir" ;; \ 259 ${INSTALL_MAN_DIR} "$$ddir" ;; \
260 *) \ 260 *) \
261 ${INSTALL_DATA_DIR} "$$ddir" ;; \ 261 ${INSTALL_DATA_DIR} "$$ddir" ;; \
262 esac; \ 262 esac; \
263 } 263 }
264 264
265.PHONY: install-makedirs 265.PHONY: install-makedirs
266install-makedirs: 266install-makedirs:
267 ${RUN} ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX} 267 ${RUN} ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}
268.if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS) 268.if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS)
269 @${STEP_MSG} "Creating installation directories" 269 @${STEP_MSG} "Creating installation directories"
270 ${RUN} \ 270 ${RUN} \
271 for dir in ${INSTALLATION_DIRS:C,^man/,${PKGMANDIR}/,}; do \ 271 for dir in ${INSTALLATION_DIRS:C,^man/,${PKGMANDIR}/,}; do \
272 case "$$dir" in \ 272 case "$$dir" in \
273 ${PREFIX}/*) \ 273 ${PREFIX}/*) \
274 dir=`${ECHO} "$$dir" | ${SED} "s|^${PREFIX}/||"` ;; \ 274 dir=`${ECHO} "$$dir" | ${SED} "s|^${PREFIX}/||"` ;; \
275 /*) continue ;; \ 275 /*) continue ;; \
276 esac; \ 276 esac; \
277 ${_INSTALL_ONE_DIR_CMD}; \ 277 ${_INSTALL_ONE_DIR_CMD}; \
278 done 278 done
279.endif # INSTALLATION_DIRS 279.endif # INSTALLATION_DIRS
280 280
281# Creates the directories for all files that are mentioned in the static 281# Creates the directories for all files that are mentioned in the static
282# PLIST files of the package, to make the declaration of 282# PLIST files of the package, to make the declaration of
283# INSTALLATION_DIRS redundant in some cases. 283# INSTALLATION_DIRS redundant in some cases.
284# 284#
285# To enable this, the variable INSTALLATION_DIRS_FROM_PLIST must be set 285# To enable this, the variable INSTALLATION_DIRS_FROM_PLIST must be set
286# to "yes". 286# to "yes".
287# 287#
288.PHONY: install-dirs-from-PLIST 288.PHONY: install-dirs-from-PLIST
289install-dirs-from-PLIST: 289install-dirs-from-PLIST:
290 @${STEP_MSG} "Creating installation directories from PLIST files" 290 @${STEP_MSG} "Creating installation directories from PLIST files"
291 ${RUN} \ 291 ${RUN} \
292 ${CAT} ${PLIST_SRC} \ 292 ${CAT} ${PLIST_SRC} \
293 | sed -n \ 293 | sed -n \
294 -e 's,\\,\\\\,' \ 294 -e 's,\\,\\\\,' \
295 -e 's,^man/,${PKGMANDIR}/,' \ 295 -e 's,^man/,${PKGMANDIR}/,' \
296 -e 's,^info/,${PKGINFODIR}/,' \ 296 -e 's,^info/,${PKGINFODIR}/,' \
297 -e 's,^share/locale/,${PKGLOCALEDIR}/locale/,' \ 297 -e 's,^share/locale/,${PKGLOCALEDIR}/locale/,' \
298 -e 's,^\([^$$@]*\)/[^/]*$$,\1,p' \ 298 -e 's,^\([^$$@]*\)/[^/]*$$,\1,p' \
299 | while read dir; do \ 299 | while read dir; do \
300 ${_INSTALL_ONE_DIR_CMD}; \ 300 ${_INSTALL_ONE_DIR_CMD}; \
301 done 301 done
302 302
303###################################################################### 303######################################################################
304### pre-install, do-install, post-install (PUBLIC, override) 304### pre-install, do-install, post-install (PUBLIC, override)
305###################################################################### 305######################################################################
306### {pre,do,post}-install are the heart of the package-customizable 306### {pre,do,post}-install are the heart of the package-customizable
307### install targets, and may be overridden within a package Makefile. 307### install targets, and may be overridden within a package Makefile.
308### 308###
309.PHONY: pre-install do-install post-install 309.PHONY: pre-install do-install post-install
310 310
311INSTALL_DIRS?= ${BUILD_DIRS} 311INSTALL_DIRS?= ${BUILD_DIRS}
312INSTALL_MAKE_FLAGS?= # none 312INSTALL_MAKE_FLAGS?= # none
313INSTALL_TARGET?= install ${USE_IMAKE:D${NO_INSTALL_MANPAGES:D:Uinstall.man}} 313INSTALL_TARGET?= install ${USE_IMAKE:D${NO_INSTALL_MANPAGES:D:Uinstall.man}}
314DESTDIR_VARNAME?= DESTDIR 314DESTDIR_VARNAME?= DESTDIR
315.if ${_USE_DESTDIR} != "no" && !empty(DESTDIR_VARNAME) 315.if ${_USE_DESTDIR} != "no" && !empty(DESTDIR_VARNAME)
316INSTALL_ENV+= ${DESTDIR_VARNAME}=${DESTDIR:Q} 316INSTALL_ENV+= ${DESTDIR_VARNAME}=${DESTDIR:Q}
317INSTALL_MAKE_FLAGS+= ${DESTDIR_VARNAME}=${DESTDIR:Q} 317INSTALL_MAKE_FLAGS+= ${DESTDIR_VARNAME}=${DESTDIR:Q}
318.endif 318.endif
319 319
320.if !target(do-install) 320.if !target(do-install)
321do-install: 321do-install:
322. for _dir_ in ${INSTALL_DIRS} 322. for _dir_ in ${INSTALL_DIRS}
323 ${RUN} ${_ULIMIT_CMD} \ 323 ${RUN} ${_ULIMIT_CMD} \
324 cd ${WRKSRC} && cd ${_dir_} && \ 324 cd ${WRKSRC} && cd ${_dir_} && \
325 ${PKGSRC_SETENV} ${INSTALL_ENV} ${MAKE_ENV} \ 325 ${PKGSRC_SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
326 ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \ 326 ${MAKE_PROGRAM} ${MAKE_FLAGS} ${INSTALL_MAKE_FLAGS} \
327 -f ${MAKE_FILE} ${INSTALL_TARGET} 327 -f ${MAKE_FILE} ${INSTALL_TARGET}
328. endfor 328. endfor
329.endif 329.endif
330 330
331.if !target(pre-install) 331.if !target(pre-install)
332pre-install: 332pre-install:
333 @${DO_NADA} 333 @${DO_NADA}
334.endif 334.endif
335.if !target(post-install) 335.if !target(post-install)
336post-install: 336post-install:
337 @${DO_NADA} 337 @${DO_NADA}
338.endif 338.endif
339 339
340###################################################################### 340######################################################################
341### install-strip-debug (PRIVATE) 341### install-strip-debug (PRIVATE)
342###################################################################### 342######################################################################
343### install-strip-debug tries to strip debug information from 343### install-strip-debug tries to strip debug information from
344### the files in PLIST. 344### the files in PLIST.
345### 345###
346.PHONY: install-strip-debug 346.PHONY: install-strip-debug
347install-strip-debug: plist 347install-strip-debug: plist
348 @${STEP_MSG} "Automatic stripping of debug information" 348 @${STEP_MSG} "Automatic stripping of debug information"
349 ${RUN}${CAT} ${_PLIST_NOKEYWORDS} \ 349 ${RUN}${CAT} ${_PLIST_NOKEYWORDS} \
350 | ${SED} -e 's|^|${DESTDIR}${PREFIX}/|' \ 350 | ${SED} -e 's|^|${DESTDIR}${PREFIX}/|' \
351 | while read f; do \ 351 | while read f; do \
352 tmp_f="$${f}.XXX"; \ 352 tmp_f="$${f}.XXX"; \
353 if ${STRIP} -g -o "$${tmp_f}" "$${f}" 2> /dev/null; then \ 353 if ${STRIP} -g -o "$${tmp_f}" "$${f}" 2> /dev/null; then \
354 [ ! -f "$${f}" ] || \ 354 [ ! -f "$${f}" ] || \
355 ${MV} "$${tmp_f}" "$${f}"; \ 355 ${MV} "$${tmp_f}" "$${f}"; \
356 else \ 356 else \
357 ${RM} -f "$${tmp_f}"; \ 357 ${RM} -f "$${tmp_f}"; \
358 fi \ 358 fi \
359 done 359 done
360 360
361###################################################################### 361######################################################################
362### install-doc-handling (PRIVATE) 362### install-doc-handling (PRIVATE)
363###################################################################### 363######################################################################
364### install-doc-handling does automatic document (de)compression based 364### install-doc-handling does automatic document (de)compression based
365### on the contents of the PLIST. 365### on the contents of the PLIST.
366### 366###
367_PLIST_REGEXP.info= \ 367_PLIST_REGEXP.info= \
368 ^([^\/]*\/)*${PKGINFODIR}/[^/]*(\.info)?(-[0-9]+)?(\.gz)?$$ 368 ^([^\/]*\/)*${PKGINFODIR}/[^/]*(\.info)?(-[0-9]+)?(\.gz)?$$
369_PLIST_REGEXP.man= \ 369_PLIST_REGEXP.man= \
370 ^([^/]*/)+(man[1-9ln]/[^/]*\.[1-9ln]|cat[1-9ln]/[^/]*\.[0-9])(\.gz)?$$ 370 ^([^/]*/)+(man[1-9ln]/[^/]*\.[1-9ln]|cat[1-9ln]/[^/]*\.[0-9])(\.gz)?$$
371 371
372_DOC_COMPRESS= \ 372_DOC_COMPRESS= \
373 ${PKGSRC_SETENV} PATH=${PATH:Q} \ 373 ${PKGSRC_SETENV} PATH=${PATH:Q} \
374 MANZ=${_MANZ} \ 374 MANZ=${_MANZ} \
375 PKG_VERBOSE=${PKG_VERBOSE} \ 375 PKG_VERBOSE=${PKG_VERBOSE} \
376 TEST=${TOOLS_TEST:Q} \ 376 TEST=${TOOLS_TEST:Q} \
377 ${SH} ${PKGSRCDIR}/mk/plist/doc-compress ${DESTDIR}${PREFIX} 377 ${SH} ${PKGSRCDIR}/mk/plist/doc-compress ${DESTDIR}${PREFIX}
378 378
379.PHONY: install-doc-handling 379.PHONY: install-doc-handling
380install-doc-handling: plist 380install-doc-handling: plist
381 @${STEP_MSG} "Automatic manual page handling" 381 @${STEP_MSG} "Automatic manual page handling"
382 ${RUN} \ 382 ${RUN} \
383 ${CAT} ${_PLIST_NOKEYWORDS} \ 383 ${CAT} ${_PLIST_NOKEYWORDS} \
384 | ${EGREP} ${_PLIST_REGEXP.man:Q} \ 384 | ${EGREP} ${_PLIST_REGEXP.man:Q} \
385 | ${_DOC_COMPRESS} 385 | ${_DOC_COMPRESS}
386 386
387privileged-install-hook: .PHONY 387privileged-install-hook: .PHONY
388 @${DO_NADA} 388 @${DO_NADA}
389 389
390###################################################################### 390######################################################################
391### install-clean (PRIVATE) 391### install-clean (PRIVATE)
392###################################################################### 392######################################################################
393### install-clean removes the state files for the "install" and 393### install-clean removes the state files for the "install" and
394### later phases so that the "install" target may be re-invoked. 394### later phases so that the "install" target may be re-invoked.
395### 395###
396install-clean: .PHONY package-eat-cookie check-clean _pkgformat-install-clean 396install-clean: .PHONY package-eat-cookie check-clean _pkgformat-install-clean
397 ${RUN} ${RM} -f ${PLIST} ${_COOKIE.install} ${_DEPENDS_PLIST} 397 ${RUN} ${RM} -f ${PLIST} ${_COOKIE.install} ${_DEPENDS_PLIST}