| @@ -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}) |
72 | stage-install: | | 72 | stage-install: |
73 | @${DO_NADA} | | 73 | @${DO_NADA} |
74 | . elif defined(_PKGSRC_BARRIER) | | 74 | . elif defined(_PKGSRC_BARRIER) |
75 | stage-install: ${_INSTALL_TARGETS} | | 75 | stage-install: ${_INSTALL_TARGETS} |
76 | . else | | 76 | . else |
77 | stage-install: barrier | | 77 | stage-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 |
82 | acquire-install-lock: acquire-lock | | 82 | acquire-install-lock: acquire-lock |
83 | release-install-lock: release-lock | | 83 | release-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 |
107 | real-install: ${_REAL_INSTALL_TARGETS} | | 107 | real-install: ${_REAL_INSTALL_TARGETS} |
108 | | | 108 | |
109 | .PHONY: install-message | | 109 | .PHONY: install-message |
110 | install-message: | | 110 | install-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 | ### |
119 | install-check-interactive: .PHONY | | 119 | install-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 |
130 | unprivileged-install-hook: | | 130 | unprivileged-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 |
141 | install-check-version: ${_COOKIE.extract} | | 141 | install-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 |
160 | acquire-install-localbase-lock: acquire-localbase-lock | | 160 | acquire-install-localbase-lock: acquire-localbase-lock |
161 | release-install-localbase-lock: release-localbase-lock | | 161 | release-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]) |
219 | install-all: su-target | | 219 | install-all: su-target |
220 | . else | | 220 | . else |
221 | install-all: su-install-all | | 221 | install-all: su-install-all |
222 | . endif | | 222 | . endif |
223 | su-install-all: ${_INSTALL_ALL_TARGETS} | | 223 | su-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 |
232 | install-check-umask: | | 232 | install-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 |
266 | install-makedirs: | | 266 | install-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 |
289 | install-dirs-from-PLIST: | | 289 | install-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 | |
311 | INSTALL_DIRS?= ${BUILD_DIRS} | | 311 | INSTALL_DIRS?= ${BUILD_DIRS} |
312 | INSTALL_MAKE_FLAGS?= # none | | 312 | INSTALL_MAKE_FLAGS?= # none |
313 | INSTALL_TARGET?= install ${USE_IMAKE:D${NO_INSTALL_MANPAGES:D:Uinstall.man}} | | 313 | INSTALL_TARGET?= install ${USE_IMAKE:D${NO_INSTALL_MANPAGES:D:Uinstall.man}} |
314 | DESTDIR_VARNAME?= DESTDIR | | 314 | DESTDIR_VARNAME?= DESTDIR |
315 | .if ${_USE_DESTDIR} != "no" && !empty(DESTDIR_VARNAME) | | 315 | .if ${_USE_DESTDIR} != "no" && !empty(DESTDIR_VARNAME) |
316 | INSTALL_ENV+= ${DESTDIR_VARNAME}=${DESTDIR:Q} | | 316 | INSTALL_ENV+= ${DESTDIR_VARNAME}=${DESTDIR:Q} |
317 | INSTALL_MAKE_FLAGS+= ${DESTDIR_VARNAME}=${DESTDIR:Q} | | 317 | INSTALL_MAKE_FLAGS+= ${DESTDIR_VARNAME}=${DESTDIR:Q} |
318 | .endif | | 318 | .endif |
319 | | | 319 | |
320 | .if !target(do-install) | | 320 | .if !target(do-install) |
321 | do-install: | | 321 | do-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) |
332 | pre-install: | | 332 | pre-install: |
333 | @${DO_NADA} | | 333 | @${DO_NADA} |
334 | .endif | | 334 | .endif |
335 | .if !target(post-install) | | 335 | .if !target(post-install) |
336 | post-install: | | 336 | post-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 |
347 | install-strip-debug: plist | | 347 | install-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 |
380 | install-doc-handling: plist | | 380 | install-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 | |
387 | privileged-install-hook: .PHONY | | 387 | privileged-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 | ### |
396 | install-clean: .PHONY package-eat-cookie check-clean _pkgformat-install-clean | | 396 | install-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} |