summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Packages.txt79
-rw-r--r--mk/bsd.pkg.mk173
-rw-r--r--mk/bsd.pkg.subdir.mk62
3 files changed, 190 insertions, 124 deletions
diff --git a/Packages.txt b/Packages.txt
index 9773447bb94..119648b2e76 100644
--- a/Packages.txt
+++ b/Packages.txt
@@ -1,4 +1,4 @@
-# $NetBSD: Packages.txt,v 1.43 1998/08/24 10:31:00 agc Exp $
+# $NetBSD: Packages.txt,v 1.44 1998/09/23 13:09:33 agc Exp $
###########################################################################
==========================
@@ -81,8 +81,8 @@ is a description of all the terminology used within this document:
/usr/pkgsrc/packages by the NetBSD package system; there is also an
archive on ftp.netbsd.org.
- Sometimes, this is referred to by the term "package" too, esp. in the
- context of precompiled packages.
+ Sometimes, this is referred to by the term "package" too,
+ especially in the context of precompiled packages.
* Program:
The piece of software to be installed which will be constructed from
@@ -307,8 +307,9 @@ package from the FreeBSD ports collection:
- Add MANCOMPRESSED (if not already there) if manpages are installed in
compressed form by the package; see comment in bsd.pkg.mk
- Replace /usr/local by ${PREFIX} in all files (see patches below)
- - Rewrite any ldconfig commands as "ldconfig || ${TRUE}", as there isn't a
- ldconfig command on all platforms NetBSD runs on (e.g. alpha).
+ - Delete any ldconfig commands - this will be done automatically for you
+ if the NetBSD platform supports ldconfig, and other measures will be
+ taken on platforms which do not support ldconfig (e.g. NetBSD/Alpha)
- If modifying a package from the FreeBSD ports collection, preserve
their RCS ID: remove the '$'s around the FreeBSD RCS Id, and insert the
word FreeBSD, then add a <$>NetBSD<$> (Without the <>s, please remember
@@ -655,10 +656,11 @@ NetBSD supports many different machines, with different object formats
like a.out and ELF, and varying abilities to do shared library and
dynamic loading at all. To accompany this, verying commands and options
have to be passed to the compiler, linker etc. to get the Right Thing,
-which can be pretty annoying esp. if you don't have all the machines at
-your hand to test things. The "libtool" pkg can help here, as it just
-"knows" how to build both static and dynamic libraries from a set our
-source files, thus being platform independent.
+which can be pretty annoying especially if you don't have all the
+machines at your hand to test things. The "libtool" pkg can help
+here, as it just "knows" how to build both static and dynamic
+libraries from a set our source files, thus being platform
+independent.
To use "libtool", add a build-dependency on the libtool-pkg, then modify
the pkg's sources to use libtool for building it's libraries and add the
@@ -729,10 +731,10 @@ the pkg's own libtool.
See section 4.1 for Makefile issues (MANx, CATx, MANCOMPRESSED, ldconfig,
RCS IDs) and section 4.3 for gotchas on using patches from FreeBSD ports.
-One of the biggest problems with FreeBSD ports is that too many of them
-assume they will install into /usr/local, instead of regarding ${PREFX}
-properly. To change this, add something like the following into your
-package Makefile:
+One of the biggest problems with FreeBSD ports is that too many of
+them assume they will install into /usr/local, instead of honouring
+any ${PREFX} setting properly. To change this, add something like the
+following into your package Makefile:
pre-configure:
for f in `find ${WRKDIR} -type f -print|xargs grep -l '/usr/local'`; do
@@ -745,10 +747,19 @@ This is taken from the sysutils/rtty package; be sure this works for your
package - it may actually make sense to look for some things in /usr/local,
for example. So don't blindly replace all occurrences of /usr/local!
-Side note on manpages in PLIST: we don't regard any .gz suffix there, as
-many FreeBSD ports seem to have .gz pages in PLIST even when they install
-manpages without compressing them; rather, we add our own .gz suffix there
-according to MANZ.
+FreeBSD has decided to list manual pages in the package Makefile, with
+no corresponding entry in the PLIST. You will thus need to add any
+MAN[1-8ln] files to the PLIST, before deleting the MAN[1-8ln]
+definition. Similarly with MLINKS and CAT[1-8ln] entries.
+
+Side note on manpages in PLIST: we don't take any notice of any .gz
+suffix there, as many FreeBSD ports seem to have .gz pages in PLIST
+even when they install manpages without compressing them; rather, we
+add our own .gz suffix there according to MANZ. In short, it does not
+matter whether the manual page name in the PLIST has a .gz suffix or
+not - if it needs one which is not already there, it will be appended
+automatically, and if there is a .gz suffix which is not needed, it
+will be deleted automatically.
6.4 Feedback to the author
@@ -771,7 +782,7 @@ The basic steps for building a program are always the same. First the
program's source (distfile) must be brought to the local system and
then extracted. After any patches to compile properly on NetBSD are
applied, the software can be configured, then built (usually by
-compiling), and finally the produced binaries etc. can be put into
+compiling), and finally the generated binaries etc. can be put into
place on the system. These are exactly the steps performed by the
NetBSD package system, which is implemented as a series of targets in
a central Makefile, /usr/pkgsrc/mk/bsd.pkg.mk.
@@ -926,6 +937,29 @@ perform the equivalent of:
properly, you can repeat the installation with this target, which will
ignore the "already installed" flag.
+ * deinstall:
+ This target does a pkg_delete(1) in the current directory,
+ effectively de-installing the package.
+
+ * readme:
+ This target generates a README.html file, which can be viewed using a
+ browser such as netscape (pkgsrc/www/mozilla) or lynx (pkgsrc/www/lynx).
+ The generated files contain references to any packages which are in the
+ ${PACKAGES} directory on the local host. The generated files can
+ be made to refer to URLs based on FTP_PKG_URL_HOST and
+ FTP_PKG_URL_DIR. (For example, if I wanted to generate README.html
+ files which pointed to binary packages on the local machine, in the
+ directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
+ FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
+ subdirectories will be searched for all the binary packages.)
+
+ * cdrom-readme:
+ This is very much the same as the readme: target (see above), but is
+ to be used when generating a pkgsrc tree to be written to a CD-ROM.
+ This target also produces README.html files, and can be made to refer
+ to URLs based on CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
+
+
8 Debugging
===========
@@ -992,7 +1026,7 @@ have to do that yourself, and this may not be what you want.
If your package uses a different distribution method from .tar.gz, take a
look at the package for plan9/sam, which uses a gzipped shell archive
(shar), but the quick solution is to set EXTRACT_SUFX to the name after the
-DIST_NAME field, and add the following to your package's Makefile:
+DISTNAME field, and add the following to your package's Makefile:
> EXTRACT_SUFX= .msg.gz
> EXTRACT_CMD= zcat
@@ -1018,13 +1052,13 @@ quick answer is:
> HAS_CONFIGURE= yes
> CONFIGURE_SCRIPT= Configure
-> CONFIGURE_ARGS= netbsd13
+> CONFIGURE_ARGS+= netbsd13
- 9.5 Packages not building in their DIST_NAME directory
+ 9.5 Packages not building in their DISTNAME directory
======================================================
-Your package builds in a different directory from its base DIST_NAME - see
+Your package builds in a different directory from its base DISTNAME - see
tcl and tk packages:
> WRKSRC= ${WRKDIR}/${DISTNAME}/unix
@@ -1262,7 +1296,6 @@ The file contents in this section must be used without the "> " prefix.
> info/bison.info-3
> info/bison.info-4
> info/bison.info-5
-> @exec [ -f %D/info/dir ] || sed -ne '1,/Menu:/p' /usr/share/info/dir > %D/info/dir
> @exec %D/bin/install-info %D/info/bison.info %D/info/dir
> share/bison.simple
> share/bison.hairy
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index b29a526e844..9bc85e1b9bf 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.166 1998/09/21 12:22:47 agc Exp $
+# $NetBSD: bsd.pkg.mk,v 1.167 1998/09/23 13:09:32 agc Exp $
#
# This file is in the public domain.
#
@@ -375,13 +375,13 @@ REQ_FILE= ${PKGDIR}/REQ
MESSAGE_FILE= ${PKGDIR}/MESSAGE
.endif
-PKG_CMD?= /usr/sbin/pkg_create
+PKG_CREATE?= /usr/sbin/pkg_create
.if !defined(PKG_ARGS)
PKG_ARGS= -v -c ${COMMENT} -d ${DESCR} -f ${PLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
.if defined(CONFLICTS)
# Only use -C if the pkg_create command supports it.
-__PKG_CMD_C__!= ${PKG_CMD} -C 2>&1 | /usr/bin/egrep 'illegal option' ; echo
-.if (${__PKG_CMD_C__} == "")
+__PKG_CREATE_C__!= ${PKG_CREATE} -C 2>&1 | /usr/bin/egrep 'illegal option' ; echo
+.if (${__PKG_CREATE_C__} == "")
PKG_ARGS+= -C "${CONFLICTS}"
.endif
.endif
@@ -424,6 +424,8 @@ LDCONFIG?= /sbin/ldconfig
LN?= /bin/ln
MKDIR?= /bin/mkdir -p
MV?= /bin/mv
+PKG_DELETE?= /usr/sbin/pkg_delete
+PKG_INFO?= /usr/sbin/pkg_info
RM?= /bin/rm
RMDIR?= /bin/rmdir
SED?= /usr/bin/sed
@@ -529,9 +531,9 @@ CKSUMFILES!= \
fi; \
done; \
if [ "$$ignore" = 0 ]; then \
- echo "$$file"; \
+ ${ECHO} "$$file"; \
else \
- echo ""; \
+ ${ECHO} ""; \
fi; \
done
.else
@@ -690,12 +692,12 @@ package:
fetch fetch-list extract patch configure build install reinstall package checkpatch checksum makesum all:
.if defined(ONLY_FOR_ARCHS)
- @echo "This pkg is only for ${ONLY_FOR_ARCHS},"
+ @${ECHO} "This pkg is only for ${ONLY_FOR_ARCHS},"
.endif
.if defined(NOT_FOR_ARCHS)
- @echo "This pkg does not run on ${NOT_FOR_ARCHS},"
+ @${ECHO} "This pkg does not run on ${NOT_FOR_ARCHS},"
.endif
- @echo "and you are running ${MACHINE_ARCH}."
+ @${ECHO} "and you are running ${MACHINE_ARCH}."
.else
.if defined(ALL_HOOK)
@@ -894,7 +896,7 @@ do-patch:
done)
.endif
@if [ -d ${PATCHDIR} ]; then \
- if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
+ if [ "`${ECHO} ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
${ECHO_MSG} "===> Ignoring empty patch directory"; \
if [ -d ${PATCHDIR}/CVS ]; then \
${ECHO_MSG} "===> Perhaps you forgot the -P flag to cvs co or update?"; \
@@ -969,7 +971,7 @@ do-package: ${PLIST} ${DESCR}
fi; \
fi; \
fi; \
- if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
+ if ${PKG_CREATE} ${PKG_ARGS} ${PKGFILE}; then \
if [ -d ${PACKAGES} ]; then \
${MAKE} ${.MAKEFLAGS} package-links; \
fi; \
@@ -1316,9 +1318,9 @@ reinstall:
deinstall:
@${ECHO_MSG} "===> Deinstalling for ${PKGNAME}"
.ifdef PKG_VERBOSE
- @pkg_delete -v -f ${PKGNAME}
+ @${PKG_DELETE} -v -f ${PKGNAME}
.else
- @pkg_delete -f ${PKGNAME}
+ @${PKG_DELETE} -f ${PKGNAME}
.endif
@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
.endif
@@ -1414,7 +1416,7 @@ fetch-list-one-pkg:
for site in ${MASTER_SITES} ; do \
${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '|| ' ; \
done; \
- ${ECHO} "echo $${file} not fetched" ; \
+ ${ECHO} "${ECHO} $${file} not fetched" ; \
fi \
done)
.if defined(PATCHFILES)
@@ -1425,7 +1427,7 @@ fetch-list-one-pkg:
for site in ${PATCH_SITES}; do \
${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '|| ' ; \
done; \
- ${ECHO} "echo $${file} not fetched" ; \
+ ${ECHO} "${ECHO} $${file} not fetched" ; \
fi \
done)
.endif # defined(PATCHFILES)
@@ -1593,7 +1595,7 @@ _DEPENDS_USE: .USE
${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \
fi; \
else \
- for d in `echo $$PATH | tr ':' ' '`; do \
+ for d in `${ECHO} $$PATH | tr ':' ' '`; do \
if [ -x $$d/$$prog ]; then \
found="$$d/$$prog"; \
break; \
@@ -1666,34 +1668,49 @@ depends-list:
done
.endif
-# The following assumes that PACKAGES is set like the following:
-# PACKAGES= /usr/pkgsrc/packages/`uname -r`/${MACHINE_ARCH}
-# i.e. contain OS version and arch name as subdirs
+# If PACKAGES is set to the default (../../pkgsrc/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.
.if !target(binpkg-list)
+
+.ifndef OS_VERSION
+OS_VERSION!= /usr/bin/uname -r
+.endif
+
binpkg-list:
- @cd ${PACKAGES}/../..; \
- for i in */*; do \
- if [ -f $$i/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ]; then \
- echo $$i; \
- fi ; \
- done | awk -F/ ' \
- { \
- rel=$$1; \
- arch=$$2; \
- if (arch != "m68k"){ \
- if (arch in f) \
- f[arch] = "%%BIN_PREREL%%" rel "/" arch "%%BIN_MEDREL%%" rel "%%BIN_POSTREL%%, " f[arch]; \
- else \
- f[arch] = "%%BIN_PREREL%%" rel "/" arch "%%BIN_MEDREL%%" rel "%%BIN_POSTREL%%"; \
- } \
- } \
- END \
- { \
- for (rel in f) { \
- print "%%BIN_PREARCH%%" rel "%%BIN_POSTARCH%% (NetBSD " f[rel] ")"; \
- } \
- } \
- '
+ @cd ${PACKAGES}; \
+ case `/bin/pwd` in \
+ */pkgsrc/packages) \
+ if [ -f ${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ]; then \
+ ${ECHO} "<li> ${MACHINE_ARCH} (${OPSYS} <a href=\"${PKG_URL}/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX}\"> ${OS_VERSION} </a>)"; \
+ fi \
+ ;; \
+ *) \
+ cd ${PACKAGES}/../..; \
+ for i in */*; do \
+ if [ -f $$i/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ]; then \
+ ${ECHO} $$i; \
+ fi ; \
+ done | ${AWK} -F/ ' \
+ { \
+ release = $$1; \
+ arch = $$2; \
+ if (arch != "m68k") { \
+ if (arch in urls) \
+ urls[arch] = "<a href=\"${PKG_URL}/" release "/" arch "/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX}\">" release "</a>, " urls[arch]; \
+ else \
+ urls[arch] = "<a href=\"${PKG_URL}/" release "/" arch "/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX}\">" release "</a> "; \
+ } \
+ } \
+ END { \
+ for (arch in urls) { \
+ print "<li> " arch " (NetBSD " urls[arch] ")"; \
+ } \
+ } ' \
+ ;; \
+ esac
.endif
################################################################
@@ -1744,10 +1761,25 @@ describe:
readmes: readme
.endif
+# This target is used to generate README.html files
.if !target(readme)
+FTP_PKG_URL_HOST?= ftp://ftp.netbsd.org
+FTP_PKG_URL_DIR?= /pub/NetBSD/packages
+
readme:
- @if [ -f README.html ]; then mv -f README.html README.html.BAK ; fi
- @cd ${.CURDIR} && ${MAKE} README.html
+ @if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
+ @cd ${.CURDIR} && ${MAKE} README.html PKG_URL=${FTP_PKG_URL_HOST}${FTP_PKG_URL_DIR}
+.endif
+
+# This target is used to generate README.html files, very like "readme"
+# However, a different target was used for ease of use.
+.if !target(cdrom-readme)
+CDROM_PKG_URL_HOST?= file://localhost
+CDROM_PKG_URL_DIR?= /usr/pkgsrc/packages
+
+cdrom-readme:
+ @if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
+ @cd ${.CURDIR} && ${MAKE} README.html PKG_URL=${CDROM_PKG_URL_HOST}${CDROM_PKG_URL_DIR}
.endif
.if (${OPSYS} == "NetBSD")
@@ -1772,42 +1804,35 @@ SED_HOMEPAGE_EXPR= -e 's|%%HOMEPAGE%%||'
README.html:
@${MAKE} depends-list PACKAGE_NAME_TYPE=html | sort -u >> $@.tmp1
- @[ -s $@.tmp1 ] || echo "<I>(none)</I>" >> $@.tmp1
+ @[ -s $@.tmp1 ] || ${ECHO} "<I>(none)</I>" >> $@.tmp1
@${MAKE} package-depends PACKAGE_NAME_TYPE=html | sort -u >> $@.tmp2
- @[ -s $@.tmp2 ] || echo "<I>(none)</I>" >> $@.tmp2
+ @[ -s $@.tmp2 ] || ${ECHO} "<I>(none)</I>" >> $@.tmp2
@${ECHO} ${PKGNAME} | ${HTMLIFY} >> $@.tmp3
@${MAKE} binpkg-list >> $@.tmp4
- @[ -s $@.tmp4 ] || echo "<I>(no precompiled binaries available)</I>" >> $@.tmp4
- @${CAT} ${README_NAME} | \
- ${SED} -e 's|%%PORT%%|'"`${MAKE} package-path | ${HTMLIFY}`"'|g' \
- -e '/%%PKG%%/r$@.tmp3' \
- -e '/%%PKG%%/d' \
- ${SED_LICENSE_EXPR} \
- ${SED_HOMEPAGE_EXPR} \
- -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
- -e '/%%COMMENT%%/d' \
- -e '/%%BUILD_DEPENDS%%/r$@.tmp1' \
- -e '/%%BUILD_DEPENDS%%/d' \
- -e '/%%RUN_DEPENDS%%/r$@.tmp2' \
- -e '/%%RUN_DEPENDS%%/d' \
- -e '/%%BIN_PKGS%%/r$@.tmp4' \
- -e '/%%BIN_PKGS%%/d' \
- | ${SED} \
- -e 's@%%BIN_PREREL%%@<A HREF="ftp://ftp.netbsd.org/pub/NetBSD/packages/@g' \
- -e 's@%%BIN_MEDREL%%@/${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX}">@g' \
- -e 's@%%BIN_POSTREL%%@</A>@g' \
- -e 's@%%BIN_PREARCH%%@<LI> @g' \
- -e 's@%%BIN_POSTARCH%%@@g' \
- >> $@.tmp
+ @[ -s $@.tmp4 ] || ${ECHO} "<I>(no precompiled binaries available)</I>" >> $@.tmp4
+ @${SED} -e 's|%%PORT%%|'"`${MAKE} package-path | ${HTMLIFY}`"'|g' \
+ -e '/%%PKG%%/r$@.tmp3' \
+ -e '/%%PKG%%/d' \
+ ${SED_LICENSE_EXPR} \
+ ${SED_HOMEPAGE_EXPR} \
+ -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
+ -e '/%%COMMENT%%/d' \
+ -e '/%%BUILD_DEPENDS%%/r$@.tmp1' \
+ -e '/%%BUILD_DEPENDS%%/d' \
+ -e '/%%RUN_DEPENDS%%/r$@.tmp2' \
+ -e '/%%RUN_DEPENDS%%/d' \
+ -e '/%%BIN_PKGS%%/r$@.tmp4' \
+ -e '/%%BIN_PKGS%%/d' \
+ ${README_NAME} >> $@.tmp
@if cmp -s $@.tmp $@.BAK ; then \
- mv $@.BAK $@ ; \
- rm $@.tmp ; \
+ ${MV} $@.BAK $@ ; \
+ ${RM} $@.tmp ; \
else \
${ECHO_MSG} "===> Creating README.html for ${_THISDIR_}${PKGNAME}" ; \
- mv $@.tmp $@ ; \
- rm -f $@.BAK ; \
+ ${MV} $@.tmp $@ ; \
+ ${RM} -f $@.BAK ; \
fi
- @rm -f $@.tmp1 $@.tmp2 $@.tmp3 $@.tmp4 $@.tmp5
+ @${RM} -f $@.tmp1 $@.tmp2 $@.tmp3 $@.tmp4 $@.tmp5
.if !target(print-depends-list)
print-depends-list:
@@ -1841,7 +1866,7 @@ fake-pkg: ${PLIST} ${DESCR}
@if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \
${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
- ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
+ ${PKG_CREATE} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
if [ -n "${INSTALL_FILE}" ]; then \
diff --git a/mk/bsd.pkg.subdir.mk b/mk/bsd.pkg.subdir.mk
index f5a4ea67c4a..f9c4d2aa9f3 100644
--- a/mk/bsd.pkg.subdir.mk
+++ b/mk/bsd.pkg.subdir.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.subdir.mk,v 1.20 1998/07/26 03:25:54 lukem Exp $
+# $NetBSD: bsd.pkg.subdir.mk,v 1.21 1998/09/23 13:09:33 agc Exp $
# Derived from: FreeBSD Id: bsd.port.subdir.mk,v 1.19 1997/03/09 23:10:56 wosch Exp
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
#
@@ -13,9 +13,6 @@
# own install script so that the entire system can be made
# stripped/not-stripped using a single knob. [-s]
#
-# ECHO_MSG Used to print all the '===>' style prompts - override this
-# to turn them off [echo].
-#
# OPSYS Get the operating system type [`uname -s`]
#
# SUBDIR A list of subdirectories that should be built as well.
@@ -45,7 +42,12 @@ STRIPFLAG?= -s
OPSYS!= uname -s
.endif
-ECHO_MSG?= echo
+BASENAME?= /usr/bin/basename
+ECHO?= /bin/echo
+MV?= /bin/mv
+RM?= /bin/rm
+SED?= /usr/bin/sed
+SORT?= /usr/bin/sort
_SUBDIRUSE: .USE
@for entry in ${SUBDIR}; do \
@@ -53,25 +55,25 @@ _SUBDIRUSE: .USE
for dud in $$DUDS; do \
if [ $${dud} = $${entry} ]; then \
OK="false"; \
- ${ECHO_MSG} "===> ${_THISDIR_}$${entry} skipped"; \
+ ${ECHO} "===> ${_THISDIR_}$${entry} skipped"; \
fi; \
done; \
- if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
+ if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
edir=$${entry}.${MACHINE}; \
- elif test -d ${.CURDIR}/$${entry}; then \
+ elif [ -d ${.CURDIR}/$${entry} ]; then \
edir=$${entry}; \
else \
OK="false"; \
- ${ECHO_MSG} "===> ${_THISDIR_}$${entry} non-existent"; \
+ ${ECHO} "===> ${_THISDIR_}$${entry} non-existent"; \
fi; \
if [ "$$OK" = "" ]; then \
cd ${.CURDIR}/$${edir}; \
if [ -z "${_THISDIR_}" -a ! -d "files" ]; then \
- ${ECHO_MSG} "===> category ${_THISDIR_}$${edir}"; \
+ ${ECHO} "===> category ${_THISDIR_}$${edir}"; \
${MAKE} ${.TARGET:realinstall=install} \
"_THISDIR_=${_THISDIR_}$${edir}/"; \
else \
- ${ECHO_MSG} "===> package ${_THISDIR_}$${edir}"; \
+ ${ECHO} "===> package ${_THISDIR_}$${edir}"; \
${MAKE} ${.TARGET:realinstall=install} \
"_THISDIR_=${_THISDIR_}$${edir}/" || /usr/bin/true ; \
fi ; \
@@ -79,7 +81,7 @@ _SUBDIRUSE: .USE
done
${SUBDIR}::
- @if test -d ${.TARGET}.${MACHINE}; then \
+ @if [ -d ${.TARGET}.${MACHINE} ]; then \
cd ${.CURDIR}/${.TARGET}.${MACHINE}; \
else \
cd ${.CURDIR}/${.TARGET}; \
@@ -112,8 +114,14 @@ readmes: readme _SUBDIRUSE
.if !target(readme)
readme:
- @if [ -f README.html ]; then mv -f README.html README.html.BAK ; fi
- @${MAKE} README.html
+ @if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
+ @${MAKE} README.html _README_TYPE=$@
+.endif
+
+.if !target(cdrom-readme)
+cdrom-readme:
+ @if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
+ @${MAKE} README.html _README_TYPE=$@
.endif
.if defined(PKGSRCTOP)
@@ -122,44 +130,44 @@ README= templates/README.top
README= ../templates/README.category
.endif
-HTMLIFY= sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
+HTMLIFY= ${SED} -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
README.html: .PRECIOUS
@> $@.tmp
.for entry in ${SUBDIR}
.if defined(PKGSRCTOP)
- @echo -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`echo ${entry} | ${HTMLIFY}`"'</a>: <TD>' >> $@.tmp
+ @${ECHO} -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`${ECHO} ${entry} | ${HTMLIFY}`"'</a>: <TD>' >> $@.tmp
.else
- @echo -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`cd ${entry}; ${MAKE} package-name | ${HTMLIFY}`</a>: <TD>" >> $@.tmp
+ @${ECHO} -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`cd ${entry}; ${MAKE} package-name | ${HTMLIFY}`</a>: <TD>" >> $@.tmp
.endif
.if exists(${entry}/pkg/COMMENT)
@${HTMLIFY} ${entry}/pkg/COMMENT >> $@.tmp
.else
- @echo "(no description)" >> $@.tmp
+ @${ECHO} "(no description)" >> $@.tmp
.endif
.endfor
- @sort -t '>' +3 -4 $@.tmp > $@.tmp2
+ @${SORT} -t '>' +3 -4 $@.tmp > $@.tmp2
.if exists(${.CURDIR}/pkg/DESCR)
@${HTMLIFY} ${.CURDIR}/pkg/DESCR > $@.tmp3
.else
@> $@.tmp3
.endif
@cat ${README} | \
- sed -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
+ ${SED} -e 's/%%CATEGORY%%/'"`${BASENAME} ${.CURDIR}`"'/g' \
-e '/%%DESCR%%/r$@.tmp3' \
-e '/%%DESCR%%/d' \
-e '/%%SUBDIR%%/r$@.tmp2' \
-e '/%%SUBDIR%%/d' \
> $@.tmp4
@if cmp -s $@.tmp4 $@.BAK ; then \
- mv $@.BAK $@ ; \
- rm $@.tmp4 ; \
+ ${MV} $@.BAK $@ ; \
+ ${RM} $@.tmp4 ; \
else \
- ${ECHO_MSG} "===> Creating README.html for ${_THISDIR_}${.CURDIR:T}" ; \
- mv $@.tmp4 $@ ; \
- rm -f $@.BAK ; \
+ ${ECHO} "===> Creating README.html for ${_THISDIR_}${.CURDIR:T}" ; \
+ ${MV} $@.tmp4 $@ ; \
+ ${RM} -f $@.BAK ; \
fi
- @rm -f $@.tmp $@.tmp2 $@.tmp3
+ @${RM} -f $@.tmp $@.tmp2 $@.tmp3
.for subdir in ${SUBDIR}
- @cd ${subdir} && ${MAKE} "_THISDIR_=${_THISDIR_}${.CURDIR:T}/" readme
+ @cd ${subdir} && ${MAKE} "_THISDIR_=${_THISDIR_}${.CURDIR:T}/" ${_README_TYPE}
.endfor