# $NetBSD: bsd.pkg.readme.mk,v 1.20 2008/04/18 14:26:36 joerg Exp $ # # This Makefile fragment is included by bsd.pkg.mk and encapsulates the # code to produce README.html files in each package directory. # # The following are the "public" targets provided by this module. # # readme This target generates a README.html file suitable # for being served via FTP. # # cdrom-readme This target generates a README.html file suitable # for being served from a mounted CD-ROM. # # The following are the user-settable variables that may be defined in # /etc/mk.conf. # # FTP_PKG_URL_HOST is the host portion of the URL to embed in each # README.html file to be served via FTP, and defaults to # "ftp://ftp.NetBSD.org". # # FTP_PKG_URL_DIR is the directory portion of the URL to embed in each # README.html file to be served via FTP, and defaults to # "/pub/pkgsrc/packages". # # CDROM_PKG_URL_HOST is the host portion of the URL to embed in each # README.html file to be served from a mounted CD-ROM, and defaults # to "file://localhost". # # CDROM_PKG_URL_DIR is the directory portion of the URL to embed in each # README.html file to be served from a mounted CD-ROM, and defaults # to "/usr/pkgsrc/packages". # # Set to "html" by the README.html target to generate HTML code, # or to "svr4" to print SVR4 (Solaris, ...) short package names, from # SVR4_PKGNAME variable. # This variable is passed down via build-depends-list and run-depends-list PACKAGE_NAME_TYPE?= name _HTML_PKGLINK= ${PKGNAME} .PHONY: package-name .if !target(package-name) package-name: . if (${PACKAGE_NAME_TYPE} == "html") @${ECHO} ${_HTML_PKGLINK:Q} . elif (${PACKAGE_NAME_TYPE} == "svr4") @${ECHO} ${SVR4_PKGNAME} . else @${ECHO} ${PKGNAME} . endif # PACKAGE_NAME_TYPE .endif # !target(package-name) .PHONY: make-readme-html-help .if !target(make-readme-html-help) make-readme-html-help: @${ECHO} '${PKGNAME}:
Please note that this package has a ${LICENSE} license.
|' .else SED_LICENSE_EXPR= -e 's|%%LICENSE%%||' .endif # set up the "more info URL" information as a sed expression .if defined(HOMEPAGE) SED_HOMEPAGE_EXPR= -e 's|%%HOMEPAGE%%|This package has a home page at ${HOMEPAGE}.
|' .else SED_HOMEPAGE_EXPR= -e 's|%%HOMEPAGE%%||' .endif # If PACKAGES is set to the default (../../packages), the current # ${MACHINE_ARCH} and "release" (uname -r) will be used. Otherwise a directory # structure of ...pkgsrc/packages/`uname -r`/${MACHINE_ARCH} is assumed. # The PKG_URL is set from FTP_PKG_URL_* or CDROM_PKG_URL_*, depending on # the target used to generate the README.html file. .PHONY: README.html README.html: .PRECIOUS @${SETENV} BMAKE=${MAKE:Q} ${SH} ../../mk/scripts/mkdatabase -f $@.tmp1 @if ${TEST} -d ${PACKAGES}; then \ cd ${PACKAGES}; \ case `${PWD_CMD}` in \ ${PKGSRCDIR}/packages) \ MULTIARCH=no; \ ;; \ *) \ MULTIARCH=yes; \ ;; \ esac; \ cd ${.CURDIR} ; \ fi; \ if [ `${PKG_ADMIN} -V` -lt 20080415 ]; then \ SCAN_VULNERABILITIES=0; \ else \ _PVDIR=`${PKG_ADMIN} config-var PKGVULNDIR`; \ if [ -e "$${_PVDIR}"/pkg-vulnerabilities ]; then \ SCAN_VULNERABILITIES=2; \ else \ SCAN_VULNERABILITIES=1; \ fi; \ fi; \ ${AWK} -f ../../mk/scripts/genreadme.awk \ builddependsfile=/dev/null \ dependsfile=/dev/null \ AWK=${AWK:Q} \ CMP=${CMP:Q} \ DISTDIR=${DISTDIR:Q} \ GREP=${GREP:Q} \ PACKAGES=${PACKAGES:Q} \ PKG_ADMIN=${PKG_ADMIN:Q} \ PKG_INFO=${PKG_INFO:Q} \ PKG_SUFX=${PKG_SUFX:Q} \ PKG_URL=${PKG_URL:Q} \ PKGSRCDIR=${.CURDIR:C|/[^/]*/[^/]*$||:Q} \ PKGTOOLS_VERSION=${PKGTOOLS_VERSION} \ SCAN_VULNERABILITIES=$${SCAN_VULNERABILITIES} \ SED=${SED:Q} \ SETENV=${SETENV:Q} \ SORT=${SORT:Q} \ TMPDIR=${TMPDIR:U/tmp:Q} \ SINGLEPKG=${PKGPATH:Q} \ $@.tmp1 @${RM} $@.tmp1 .PHONY: print-build-depends-list .if !target(print-build-depends-list) print-build-depends-list: . if !empty(BUILD_DEPENDS) || !empty(DEPENDS) @${ECHO_N} 'This package requires package(s) "' @${ECHO_N} `${RECURSIVE_MAKE} ${MAKEFLAGS} build-depends-list | ${SORT} -u` @${ECHO} '" to build.' . endif .endif .PHONY: print-run-depends-list .if !target(print-run-depends-list) print-run-depends-list: . if !empty(DEPENDS) @${ECHO_N} 'This package requires package(s) "' @${ECHO_N} `${RECURSIVE_MAKE} ${MAKEFLAGS} run-depends-list | ${SORT} -u` @${ECHO} '" to run.' . endif .endif # This target is used by the mk/scripts/mkreadme script to generate # README.html files .PHONY: print-summary-data .if !target(print-summary-data) print-summary-data: @${ECHO} depends ${PKGPATH} ${DEPENDS:Q} @${ECHO} build_depends ${PKGPATH} ${BUILD_DEPENDS:Q} @${ECHO} conflicts ${PKGPATH} ${CONFLICTS:Q} @${ECHO} index ${PKGPATH} ${PKGNAME:Q} @${ECHO} htmlname ${PKGPATH} ${_HTML_PKGLINK:Q} @${ECHO} homepage ${PKGPATH} ${HOMEPAGE:Q} @${ECHO} wildcard ${PKGPATH} ${PKGWILDCARD:Q} @${ECHO} comment ${PKGPATH} ${COMMENT:Q} @${ECHO} license ${PKGPATH} ${LICENSE:Q} @if [ "${ONLY_FOR_PLATFORM}" = "" ]; then \ ${ECHO} "onlyfor ${PKGPATH} any"; \ else \ ${ECHO} "onlyfor ${PKGPATH} ${ONLY_FOR_PLATFORM}"; \ fi @if [ "${NOT_FOR_PLATFORM}" = "" ]; then \ ${ECHO} "notfor ${PKGPATH} any"; \ else \ ${ECHO} "notfor ${PKGPATH} not ${NOT_FOR_PLATFORM}"; \ fi; @${ECHO} "maintainer ${PKGPATH} ${MAINTAINER}" @${ECHO} "categories ${PKGPATH} ${CATEGORIES}" @if [ -f ${DESCR_SRC} ]; then \ ${ECHO} "descr ${PKGPATH} ${DESCR_SRC:S;${PKGSRCDIR}/;;g}"; \ else \ ${ECHO} "descr ${PKGPATH} /dev/null"; \ fi @${ECHO} "prefix ${PKGPATH} ${PREFIX}" .endif