Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 343 lines (322 sloc) 11.093 kB
7944134 Introduce PKGSRC_SETENV, defaulting to SETENV. Can be set to ${SETENV…
abs authored
1 # $NetBSD: bsd.pkg.readme.mk,v 1.25 2011/09/08 20:17:15 abs Exp $
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
2 #
3 # This Makefile fragment is included by bsd.pkg.mk and encapsulates the
4 # code to produce README.html files in each package directory.
5 #
6 # The following are the "public" targets provided by this module.
7 #
8 # readme This target generates a README.html file suitable
9 # for being served via FTP.
10 #
11 # cdrom-readme This target generates a README.html file suitable
12 # for being served from a mounted CD-ROM.
13 #
14 # The following are the user-settable variables that may be defined in
15 # /etc/mk.conf.
16 #
17 # FTP_PKG_URL_HOST is the host portion of the URL to embed in each
18 # README.html file to be served via FTP, and defaults to
19 # "ftp://ftp.NetBSD.org".
20 #
21 # FTP_PKG_URL_DIR is the directory portion of the URL to embed in each
22 # README.html file to be served via FTP, and defaults to
fee1aec Fixed dead links in the automatically generated README.html files. From
rillig authored
23 # "/pub/pkgsrc/packages".
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
24 #
25 # CDROM_PKG_URL_HOST is the host portion of the URL to embed in each
26 # README.html file to be served from a mounted CD-ROM, and defaults
27 # to "file://localhost".
28 #
29 # CDROM_PKG_URL_DIR is the directory portion of the URL to embed in each
30 # README.html file to be served from a mounted CD-ROM, and defaults
31 # to "/usr/pkgsrc/packages".
32 #
33
34 # Set to "html" by the README.html target to generate HTML code,
35 # or to "svr4" to print SVR4 (Solaris, ...) short package names, from
36 # SVR4_PKGNAME variable.
37 # This variable is passed down via build-depends-list and run-depends-list
38 PACKAGE_NAME_TYPE?= name
39
6e5cd58 PKGNAME and PKGPATH will never contain characters that need to be
rillig authored
40 _HTML_PKGLINK= <a href="../../${PKGPATH}/README.html">${PKGNAME}</a>
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
41
42 .PHONY: package-name
43 .if !target(package-name)
44 package-name:
45 . if (${PACKAGE_NAME_TYPE} == "html")
46 @${ECHO} ${_HTML_PKGLINK:Q}
47 . elif (${PACKAGE_NAME_TYPE} == "svr4")
48 @${ECHO} ${SVR4_PKGNAME}
49 . else
50 @${ECHO} ${PKGNAME}
51 . endif # PACKAGE_NAME_TYPE
52 .endif # !target(package-name)
53
54 .PHONY: make-readme-html-help
55 .if !target(make-readme-html-help)
56 make-readme-html-help:
6e5cd58 PKGNAME and PKGPATH will never contain characters that need to be
rillig authored
57 @${ECHO} '${PKGNAME}</a>: <TD>'${COMMENT:Q}
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
58 .endif # !target(make-readme-html-help)
59
60 # Show (non-recursively) all the packages this package depends on.
61 # If PACKAGE_DEPENDS_WITH_PATTERNS is set, print as pattern (if possible)
62 PACKAGE_DEPENDS_WITH_PATTERNS?=true
63 .PHONY: run-depends-list
64 .if !target(run-depends-list)
65 run-depends-list:
66 . for dep in ${DEPENDS}
67 @pkg="${dep:C/:.*//}"; \
68 dir="${dep:C/[^:]*://}"; \
69 cd ${.CURDIR}; \
70 if ${PACKAGE_DEPENDS_WITH_PATTERNS}; then \
71 ${ECHO} "$$pkg"; \
72 else \
73 if cd $$dir 2>/dev/null; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
74 ${RECURSIVE_MAKE} ${MAKEFLAGS} package-name PACKAGE_NAME_TYPE=${PACKAGE_NAME_TYPE}; \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
75 else \
76 ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
77 fi; \
78 fi
79 . endfor
80 .endif # target(run-depends-list)
81
82 .PHONY: build-depends-list
83 .if !target(build-depends-list)
84 build-depends-list:
7432c5c Remove all uses of the following targets from pkgsrc:
jlam authored
85 @${_DEPENDS_WALK_CMD} ${PKGPATH} | \
86 while read dir; do \
87 ( cd ../../$$dir && ${RECURSIVE_MAKE} ${MAKEFLAGS} package-name) \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
88 done
89 .endif
90
91 # If PACKAGES is set to the default (../../pkgsrc/packages), the current
92 # ${MACHINE_ARCH} and "release" (uname -r) will be used. Otherwise a directory
93 # structure of ...pkgsrc/packages/`uname -r`/${MACHINE_ARCH} is assumed.
94 # The PKG_URL is set from FTP_PKG_URL_* or CDROM_PKG_URL_*, depending on
95 # the target used to generate the README.html file.
96 .PHONY: binpkg-list
97 .if !target(binpkg-list)
98 binpkg-list:
99 @if ${TEST} -d ${PACKAGES}; then \
100 cd ${PACKAGES}; \
101 case ${.CURDIR} in \
102 */pkgsrc/packages) \
103 for pkg in ${PKGREPOSITORYSUBDIR}/${PKGWILDCARD}${PKG_SUFX} ; \
104 do \
105 if [ -f "$$pkg" ] ; then \
106 pkgname=`${ECHO} $$pkg | ${SED} 's@.*/@@'`; \
107 ${ECHO} "<TR><TD>${MACHINE_ARCH}:<TD><a href=\"${PKG_URL}/$$pkg\">$$pkgname</a><TD>(${OPSYS} ${OS_VERSION})"; \
108 fi ; \
109 done ; \
110 ;; \
111 *) \
112 cd ${PACKAGES}/../..; \
113 for i in [1-9].*/*; do \
114 if cd ${PACKAGES}/../../$$i/${PKGREPOSITORYSUBDIR} 2>/dev/null; then \
115 for j in ${PKGWILDCARD}${PKG_SUFX}; \
116 do \
117 if [ -f "$$j" ]; then \
118 ${ECHO} $$i/$$j;\
119 fi; \
120 done; \
121 fi; \
122 done | ${AWK} -F/ ' \
123 { \
124 release = $$1; \
125 arch = $$2; \
126 pkg = $$3; \
127 gsub("\\.tgz","", pkg); \
128 if (arch != "m68k" && arch != "mipsel") { \
129 if (arch in urls) \
130 urls[arch "/" pkg "/" release] = "<a href=\"${PKG_URL}/" release "/" arch "/${PKGREPOSITORYSUBDIR}/" pkg "${PKG_SUFX}\">" pkg "</a>, " urls[arch]; \
131 else \
132 urls[arch "/" pkg "/" release] = "<a href=\"${PKG_URL}/" release "/" arch "/${PKGREPOSITORYSUBDIR}/" pkg "${PKG_SUFX}\">" pkg "</a> "; \
133 } \
134 } \
135 END { \
136 for (av in urls) { \
137 split(av, ava, "/"); \
138 arch=ava[1]; \
139 pkg=ava[2]; \
140 release=ava[3]; \
141 print "<TR><TD>" arch ":<TD>" urls[av] "<TD>(${OPSYS} " release ")"; \
142 } \
143 }' | ${SORT} \
144 ;; \
145 esac; \
146 fi
147 .endif
148
149 # This target generates an index entry suitable for aggregation into
150 # a large index. Format is:
151 #
152 # distribution-name|package-path|installation-prefix|comment| \
153 # description-file|maintainer|categories|build deps|run deps|for arch| \
154 # not for opsys
155 #
156 .PHONY: describe
157 .if !target(describe)
158 describe:
159 @${ECHO_N} "${PKGNAME}|${.CURDIR}|"; \
160 ${ECHO_N} "${PREFIX}|"; \
161 ${ECHO_N} ${COMMENT:Q}; \
fe64a63 add "" to ${DESCR_SRC} to make the
spz authored
162 if [ -f "${DESCR_SRC}" ]; then \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
163 ${ECHO_N} "|${DESCR_SRC}"; \
164 else \
165 ${ECHO_N} "|/dev/null"; \
166 fi; \
167 ${ECHO_N} "|${MAINTAINER}|${CATEGORIES}|"; \
168 case "A${BUILD_DEPENDS}B${DEPENDS}C" in \
169 ABC) ;; \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
170 *) cd ${.CURDIR} && ${ECHO_N} `${RECURSIVE_MAKE} ${MAKEFLAGS} build-depends-list | ${SORT} -u`;; \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
171 esac; \
172 ${ECHO_N} "|"; \
173 if [ "${DEPENDS}" != "" ]; then \
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
174 cd ${.CURDIR} && ${ECHO_N} `${RECURSIVE_MAKE} ${MAKEFLAGS} run-depends-list | ${SORT} -u`; \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
175 fi; \
176 ${ECHO_N} "|"; \
177 if [ "${ONLY_FOR_PLATFORM}" = "" ]; then \
178 ${ECHO_N} "any"; \
179 else \
180 ${ECHO_N} "${ONLY_FOR_PLATFORM}"; \
181 fi; \
182 ${ECHO_N} "|"; \
183 if [ "${NOT_FOR_PLATFORM}" = "" ]; then \
184 ${ECHO_N} "any"; \
185 else \
186 ${ECHO_N} "not ${NOT_FOR_PLATFORM}"; \
187 fi; \
188 ${ECHO} ""
189 .endif
190
191 .PHONY: readmes
192 .if !target(readmes)
193 readmes: readme
194 .endif
195
196 # This target is used to generate README.html files
197 .PHONY: readme
198 .if !target(readme)
199 FTP_PKG_URL_HOST?= ftp://ftp.NetBSD.org
fee1aec Fixed dead links in the automatically generated README.html files. From
rillig authored
200 FTP_PKG_URL_DIR?= /pub/pkgsrc/packages
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
201
202 readme:
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
203 @cd ${.CURDIR} && ${RECURSIVE_MAKE} ${MAKEFLAGS} README.html PKG_URL=${FTP_PKG_URL_HOST}${FTP_PKG_URL_DIR}
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
204 .endif
205
206 # This target is used to generate README.html files, very like "readme"
207 # However, a different target was used for ease of use.
208 .PHONY: cdrom-readme
209 .if !target(cdrom-readme)
210 CDROM_PKG_URL_HOST?= file://localhost
211 CDROM_PKG_URL_DIR?= /usr/pkgsrc/packages
212
213 cdrom-readme:
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
214 @cd ${.CURDIR} && ${RECURSIVE_MAKE} ${MAKEFLAGS} README.html PKG_URL=${CDROM_PKG_URL_HOST}${CDROM_PKG_URL_DIR}
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
215 .endif
216
217 README_NAME= ${TEMPLATES}/README.pkg
218
219 # set up the correct license information as a sed expression
220 .if defined(LICENSE)
221 SED_LICENSE_EXPR= -e 's|%%LICENSE%%|<p>Please note that this package has a ${LICENSE} license.</p>|'
222 .else
223 SED_LICENSE_EXPR= -e 's|%%LICENSE%%||'
224 .endif
225
226 # set up the "more info URL" information as a sed expression
227 .if defined(HOMEPAGE)
228 SED_HOMEPAGE_EXPR= -e 's|%%HOMEPAGE%%|<p>This package has a home page at <a HREF="${HOMEPAGE}">${HOMEPAGE}</a>.</p>|'
229 .else
230 SED_HOMEPAGE_EXPR= -e 's|%%HOMEPAGE%%||'
231 .endif
232
233 # If PACKAGES is set to the default (../../packages), the current
234 # ${MACHINE_ARCH} and "release" (uname -r) will be used. Otherwise a directory
235 # structure of ...pkgsrc/packages/`uname -r`/${MACHINE_ARCH} is assumed.
236 # The PKG_URL is set from FTP_PKG_URL_* or CDROM_PKG_URL_*, depending on
237 # the target used to generate the README.html file.
238 .PHONY: README.html
239 README.html: .PRECIOUS
7944134 Introduce PKGSRC_SETENV, defaulting to SETENV. Can be set to ${SETENV…
abs authored
240 @${PKGSRC_SETENV} BMAKE=${MAKE:Q} ${SH} ../../mk/scripts/mkdatabase -f $@.tmp1
637b9e1 Added a missing line continuation in the README.html target.
rillig authored
241 @if ${TEST} -d ${PACKAGES}; then \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
242 cd ${PACKAGES}; \
243 case `${PWD_CMD}` in \
244 ${PKGSRCDIR}/packages) \
245 MULTIARCH=no; \
246 ;; \
247 *) \
248 MULTIARCH=yes; \
249 ;; \
250 esac; \
251 cd ${.CURDIR} ; \
252 fi; \
d4ec65e Change the code generation README.html to use the new
joerg authored
253 if [ `${PKG_ADMIN} -V` -lt 20080415 ]; then \
254 SCAN_VULNERABILITIES=0; \
255 else \
256 _PVDIR=`${PKG_ADMIN} config-var PKGVULNDIR`; \
257 if [ -e "$${_PVDIR}"/pkg-vulnerabilities ]; then \
258 SCAN_VULNERABILITIES=2; \
259 else \
260 SCAN_VULNERABILITIES=1; \
261 fi; \
262 fi; \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
263 ${AWK} -f ../../mk/scripts/genreadme.awk \
264 builddependsfile=/dev/null \
265 dependsfile=/dev/null \
266 AWK=${AWK:Q} \
267 CMP=${CMP:Q} \
268 DISTDIR=${DISTDIR:Q} \
269 GREP=${GREP:Q} \
270 PACKAGES=${PACKAGES:Q} \
d4ec65e Change the code generation README.html to use the new
joerg authored
271 PKG_ADMIN=${PKG_ADMIN:Q} \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
272 PKG_INFO=${PKG_INFO:Q} \
273 PKG_SUFX=${PKG_SUFX:Q} \
274 PKG_URL=${PKG_URL:Q} \
275 PKGSRCDIR=${.CURDIR:C|/[^/]*/[^/]*$||:Q} \
692273f Rename PKGTOOLS_VER to PKGTOOLS_VERSION and use that everywhere
adrianp authored
276 PKGTOOLS_VERSION=${PKGTOOLS_VERSION} \
d4ec65e Change the code generation README.html to use the new
joerg authored
277 SCAN_VULNERABILITIES=$${SCAN_VULNERABILITIES} \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
278 SED=${SED:Q} \
279 SETENV=${SETENV:Q} \
280 SORT=${SORT:Q} \
281 TMPDIR=${TMPDIR:U/tmp:Q} \
282 SINGLEPKG=${PKGPATH:Q} \
283 $@.tmp1
284 @${RM} $@.tmp1
285
286 .PHONY: print-build-depends-list
287 .if !target(print-build-depends-list)
288 print-build-depends-list:
289 . if !empty(BUILD_DEPENDS) || !empty(DEPENDS)
290 @${ECHO_N} 'This package requires package(s) "'
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
291 @${ECHO_N} `${RECURSIVE_MAKE} ${MAKEFLAGS} build-depends-list | ${SORT} -u`
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
292 @${ECHO} '" to build.'
293 . endif
294 .endif
295
296 .PHONY: print-run-depends-list
297 .if !target(print-run-depends-list)
298 print-run-depends-list:
299 . if !empty(DEPENDS)
300 @${ECHO_N} 'This package requires package(s) "'
7ae0a03 Whenever we invoke a recursive make, we need to ensure that the proper
jlam authored
301 @${ECHO_N} `${RECURSIVE_MAKE} ${MAKEFLAGS} run-depends-list | ${SORT} -u`
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
302 @${ECHO} '" to run.'
303 . endif
304 .endif
305
306 # This target is used by the mk/scripts/mkreadme script to generate
307 # README.html files
308 .PHONY: print-summary-data
309 .if !target(print-summary-data)
310 print-summary-data:
311 @${ECHO} depends ${PKGPATH} ${DEPENDS:Q}
312 @${ECHO} build_depends ${PKGPATH} ${BUILD_DEPENDS:Q}
313 @${ECHO} conflicts ${PKGPATH} ${CONFLICTS:Q}
314 @${ECHO} index ${PKGPATH} ${PKGNAME:Q}
315 @${ECHO} htmlname ${PKGPATH} ${_HTML_PKGLINK:Q}
316 @${ECHO} homepage ${PKGPATH} ${HOMEPAGE:Q}
317 @${ECHO} wildcard ${PKGPATH} ${PKGWILDCARD:Q}
318 @${ECHO} comment ${PKGPATH} ${COMMENT:Q}
319 @${ECHO} license ${PKGPATH} ${LICENSE:Q}
320 @if [ "${ONLY_FOR_PLATFORM}" = "" ]; then \
321 ${ECHO} "onlyfor ${PKGPATH} any"; \
322 else \
323 ${ECHO} "onlyfor ${PKGPATH} ${ONLY_FOR_PLATFORM}"; \
324 fi
325 @if [ "${NOT_FOR_PLATFORM}" = "" ]; then \
326 ${ECHO} "notfor ${PKGPATH} any"; \
327 else \
328 ${ECHO} "notfor ${PKGPATH} not ${NOT_FOR_PLATFORM}"; \
329 fi;
f6d25eb add a long missing @ in the print-summary-data target that has been c…
dmcmahill authored
330 @if [ -n "${OWNER}" ]; then \
efb7c4d Fix _two_ bugs in obviously untested previous commit.
wiz authored
331 ${ECHO} "owner ${PKGPATH} ${OWNER}"; \
c6dd16a include owner in readme
abs authored
332 else \
efb7c4d Fix _two_ bugs in obviously untested previous commit.
wiz authored
333 ${ECHO} "maintainer ${PKGPATH} ${MAINTAINER}"; \
c6dd16a include owner in readme
abs authored
334 fi
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
335 @${ECHO} "categories ${PKGPATH} ${CATEGORIES}"
fe64a63 add "" to ${DESCR_SRC} to make the
spz authored
336 @if [ -f "${DESCR_SRC}" ]; then \
c7ce575 Refactor the README.html generation code from bsd.pkg.mk into a separate
jlam authored
337 ${ECHO} "descr ${PKGPATH} ${DESCR_SRC:S;${PKGSRCDIR}/;;g}"; \
338 else \
339 ${ECHO} "descr ${PKGPATH} /dev/null"; \
340 fi
341 @${ECHO} "prefix ${PKGPATH} ${PREFIX}"
342 .endif
Something went wrong with that request. Please try again.