diff options
author | bsiegert <bsiegert@pkgsrc.org> | 2015-10-03 13:17:57 +0000 |
---|---|---|
committer | bsiegert <bsiegert@pkgsrc.org> | 2015-10-03 13:17:57 +0000 |
commit | 4889a50cd1f811587485004e36a8657a1088c180 (patch) | |
tree | 86953930f194992fb2e7b7cc554112703dcbcd15 | |
parent | 1f3f1bbeba4672893cd1a47bd633fbfed2b3ecbd (diff) | |
download | pkgsrc-4889a50cd1f811587485004e36a8657a1088c180.tar.gz |
Add a list of options to generated README.html files. Patch from
Daniel Loffgren on tech-pkg, slightly modified by me to use dl tags.
-rwxr-xr-x | mk/scripts/genreadme.awk | 14 | ||||
-rw-r--r-- | mk/scripts/htmloptions.awk | 58 | ||||
-rwxr-xr-x | mk/scripts/mkdatabase | 16 | ||||
-rwxr-xr-x | mk/scripts/mkreadme | 4 | ||||
-rw-r--r-- | templates/README.pkg | 13 |
5 files changed, 92 insertions, 13 deletions
diff --git a/mk/scripts/genreadme.awk b/mk/scripts/genreadme.awk index 0f69631ca09..d2e590e953d 100755 --- a/mk/scripts/genreadme.awk +++ b/mk/scripts/genreadme.awk @@ -1,7 +1,7 @@ #!/usr/bin/awk -f -# $NetBSD: genreadme.awk,v 1.35 2013/05/09 23:37:27 riastradh Exp $ +# $NetBSD: genreadme.awk,v 1.36 2015/10/03 13:17:57 bsiegert Exp $ # -# Copyright (c) 2002, 2003, 2005, 2006 The NetBSD Foundation, Inc. +# Copyright (c) 2002, 2003, 2005, 2006, 2015 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation @@ -165,6 +165,15 @@ BEGIN { next; } +/^htmloptions / { + htmloptions = $3; + for (i = 4; i <= NF; i++){ + htmloptions = htmloptions " " $i; + } + options[$2] = htmloptions; + next; +} + /^index / { # # read lines like: @@ -395,6 +404,7 @@ END { gsub(/%%VULNERABILITIES%%/, ""vul""); gsub(/%%VULDATE%%/, ""vuldate""); gsub(/%%RUN_DEPENDS%%/, ""rundeps""); + gsub(/%%OPTIONS%%/, ""options[toppkg]""); line = $0; diff --git a/mk/scripts/htmloptions.awk b/mk/scripts/htmloptions.awk new file mode 100644 index 00000000000..577889a2e36 --- /dev/null +++ b/mk/scripts/htmloptions.awk @@ -0,0 +1,58 @@ +#!/usr/bin/awk -f +# $NetBSD: htmloptions.awk,v 1.1 2015/10/03 13:17:57 bsiegert Exp $ +# +# Copyright (c) 2015 The NetBSD Foundation, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +BEGIN { + FS = "\t"; +} + +/^\t/ { + o++; + printf "<dt>%s</dt><dd>%s</dd>", $2, $3; +} + +/^These options are/ { + finalize(); + exit; +} + +END { + finalize(); +} + +function finalize() { + if(o == 0) { + printf "<dt><em>(none)</em></dt>"; + } +} diff --git a/mk/scripts/mkdatabase b/mk/scripts/mkdatabase index 845e5a688c4..4af7506292a 100755 --- a/mk/scripts/mkdatabase +++ b/mk/scripts/mkdatabase @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkdatabase,v 1.9 2005/11/18 11:07:27 rillig Exp $ +# $NetBSD: mkdatabase,v 1.10 2015/10/03 13:17:57 bsiegert Exp $ # # Script for generating a database with complete dependency information # for a particular package @@ -160,6 +160,11 @@ case ${DATABASE} in esac +here=`pwd` +tmp1=`dirname "$here"` +pkgcat=`basename "$tmp1"` +pkg=`basename "$here"` +pkgpath=$pkgcat/$pkg if [ $append_flag = yes ]; then echo "$prompt Appending to database in ${DATABASE}" if [ ! -f "${DATABASE}" ]; then @@ -167,11 +172,6 @@ if [ $append_flag = yes ]; then fi # make sure we haven't already been listed before # appending ourselves. - here=`pwd` - tmp1=`dirname "$here"` - pkgcat=`basename "$tmp1"` - pkg=`basename "$here"` - pkgpath=$pkgcat/$pkg case $debug_flag in yes) echo "Looking for $pkgpath before appending";; esac @@ -184,7 +184,9 @@ if [ $append_flag = yes ]; then fi else echo "$prompt Creating new database in ${DATABASE}" - ${BMAKE} print-summary-data > "${DATABASE}" || exit 1 + o=`${BMAKE} show-options | ${AWK} -f ../../mk/scripts/htmloptions.awk` + echo "htmloptions ${pkgpath} $o" > ${DATABASE} + ${BMAKE} print-summary-data >> "${DATABASE}" || exit 1 fi here=`pwd` echo "$prompt Depending in $here (pass #1)" diff --git a/mk/scripts/mkreadme b/mk/scripts/mkreadme index 02c6bc6ccd7..5283e56b5c6 100755 --- a/mk/scripts/mkreadme +++ b/mk/scripts/mkreadme @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkreadme,v 1.27 2015/06/13 12:09:32 spz Exp $ +# $NetBSD: mkreadme,v 1.28 2015/10/03 13:17:57 bsiegert Exp $ # # Script for README.html generation # @@ -381,6 +381,7 @@ if [ "x$restart" = "xno" ] ; then echo " but the directory does not exist. Please fix this!" > /dev/stderr else cd ${PKGSRCDIR}/${c}/${pkgdir} + o=`${BMAKE} show-options | ${AWK} -f ${PKGSRCDIR}/mk/scripts/htmloptions.awk` l=`${BMAKE} print-summary-data` if [ $? != 0 ]; then echo "WARNING (printdepends): the package in ${c}/${pkgdir} had problem with" \ @@ -391,6 +392,7 @@ if [ "x$restart" = "xno" ] ; then ${BMAKE} print-summary-data 2>&1 > /dev/stderr else echo "$l" >> $DATABASEFILE + echo "htmloptions ${c}/${pkgdir} $o" >> $DATABASEFILE fi fi if [ "x$quiet" = "xno" ]; then diff --git a/templates/README.pkg b/templates/README.pkg index 4dc4ca338df..6174b05e096 100644 --- a/templates/README.pkg +++ b/templates/README.pkg @@ -1,5 +1,5 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -<!-- $NetBSD: README.pkg,v 1.26 2010/03/18 10:18:19 wiz Exp $ --> +<!-- $NetBSD: README.pkg,v 1.27 2015/10/03 13:17:57 bsiegert Exp $ --> <html> <head> <title>The NetBSD Packages Collection: %%PORT%%</title> @@ -68,12 +68,19 @@ This package requires the following package(s) to run: </p> <p> +This package supports the following build-time options: +</p> +<dl> +%%OPTIONS%% +</dl> + +<p> Select one of the links below to <FONT COLOR="red">download</FONT> the package in precompiled binary form for installation with pkg_add(1). Available machine architectures and package versions: -<TABLE> +<table> %%BIN_PKGS%% -</TABLE> +</table> <p> The NetBSD packages collection is designed to permit |