From 877d4798b657bc10cbc9e0d852d80849b05104b7 Mon Sep 17 00:00:00 2001
From: rillig
- release=pkgsrc +release=pkgsrc
@@ -1506,7 +1506,7 @@ file and inspect the contents before extracting it. don't have a termcap/terminfo entry for it, but the following .termcap entry provides adequate emulation in most cases:
- interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi: +interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
- PKGSRC_COMPILER= mipspro +PKGSRC_COMPILER= mipspro
@@ -1643,8 +1643,8 @@ file and inspect the contents before extracting it.
To bootstrap using icc, assuming the default icc installation directory:
- env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \ - ac_cv___attribute__=yes ./bootstrap +env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \ +ac_cv___attribute__=yes ./bootstrap
After bootstrapping, you should set PKGSRC_COMPILER
in /etc/mk.conf
:
- PKGSRC_COMPILER= icc +PKGSRC_COMPILER= icc
The default installation directory for icc is
/opt/intel_cc_80
, which
@@ -1667,7 +1667,7 @@ file and inspect the contents before extracting it.
directory, set ICCBASE
in
/etc/mk.conf
:
- ICCBASE= /opt/icc +ICCBASE= /opt/icc
pkgsrc uses the static linking method of the runtime libraries provided by icc, so binaries can be run on other systems which do not @@ -1711,11 +1711,11 @@ file and inspect the contents before extracting it. as well. You can work around this by enclosing all the pkgsrc-specific parts of the file with:
- .ifdef BSD_PKG_MK - # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here - .else - # OpenBSD stuff - .endif +.ifdef BSD_PKG_MK +# pkgsrc stuff, e.g. insert defaults/mk.conf or similar here +.else +# OpenBSD stuff +.endif
You should set the following variables in your
mk.conf
file:
- CC= cc - CXX= CC - CPP= cc -E - CXXCPP= CC -E +CC= cc +CXX= CC +CPP= cc -E +CXXCPP= CC -E
mk.conf
file:
- PKGSRC_COMPILER= sunpro - ABI= 64 +PKGSRC_COMPILER= sunpro +ABI= 64
shells/bash
and adding the following lines
to your mk.conf
:
- CONFIG_SHELL= ${LOCALBASE}/bin/bash - WRAPPER_SHELL= ${LOCALBASE}/bin/bash +CONFIG_SHELL= ${LOCALBASE}/bin/bash +WRAPPER_SHELL= ${LOCALBASE}/bin/bash
Then, rebuild the devel/libtool-base
package.
+=
operator
instead of the =
operator:
- CFLAGS+= -your -flags +CFLAGS+= -your -flags
Using CFLAGS=
(i.e. without the
“+”) may lead to problems with packages that need
@@ -2477,7 +2477,7 @@ the inclusion of mk/x11.buildlink3.mk
. As with
CFLAGS
, if you do not wish to override these
settings, use the +=
operator:
- LDFLAGS+= -your -linkerflags +LDFLAGS+= -your -linkerflags
_ACCEPTABLE=yes
accepts all licenses.
- PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH} - WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc - BSDSRCDIR= /usr/src - BSDXSRCDIR= /usr/xsrc # for x11/xservers - OBJHOSTNAME?= yes # use work.`hostname` - FAILOVER_FETCH= yes # insist on the correct checksum - PKG_DEVELOPER?= yes - _ACCEPTABLE= yes -+PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH} +WRKOBJDIR?= /usr/tmp/pkgsrc # build here instead of in pkgsrc +BSDSRCDIR= /usr/src +BSDXSRCDIR= /usr/xsrc # for x11/xservers +OBJHOSTNAME?= yes # use work.`hostname` +FAILOVER_FETCH= yes # insist on the correct checksum +PKG_DEVELOPER?= yes +_ACCEPTABLE= yes +
Some options that are especially useful for bulk builds
can be found at the top lines of the file
mk/bulk/bsd.bulk-pkg.mk
. The most useful
@@ -2767,11 +2767,11 @@ PKG_OPTIONS.apache= suexec
version of ssh for some reason, be sure to install ssh before
starting it from rc.local
:
- ( cd /usr/pkgsrc/security/ssh ; make bulk-install ) - if [ -f /usr/pkg/etc/rc.d/sshd ]; then - /usr/pkg/etc/rc.d/sshd - fi -+(cd /usr/pkgsrc/security/ssh && make bulk-install) +if [ -f /usr/pkg/etc/rc.d/sshd ]; then + /usr/pkg/etc/rc.d/sshd +fi +
Not doing so will result in you being not able to log in via ssh after the bulk build is finished or if the machine gets rebooted or crashes. You have been warned! :)
@@ -3109,18 +3109,18 @@ configurable in thebootstrap/bootstrap
script.
When pkgsrc has been installed as root, the default locations
are:
- LOCALBASE= /usr/pkg - PKG_SYSCONFBASE= /usr/pkg/etc - VARBASE= /var - PKG_DBDIR= /var/db/pkg +LOCALBASE= /usr/pkg +PKG_SYSCONFBASE= /usr/pkg/etc +VARBASE= /var +PKG_DBDIR= /var/db/pkg
In unprivileged mode (when pkgsrc has been installed as any other user), the default locations are:
- LOCALBASE= ${HOME}/pkg - PKG_SYSCONFBASE= ${HOME}/pkg/etc - VARBASE= ${HOME}/pkg/var - PKG_DBDIR= ${HOME}/pkg/var/db/pkg +LOCALBASE= ${HOME}/pkg +PKG_SYSCONFBASE= ${HOME}/pkg/etc +VARBASE= ${HOME}/pkg/var +PKG_DBDIR= ${HOME}/pkg/var/db/pkg
What these four directories are for, and what they look like is explained below.
@@ -3284,7 +3284,7 @@ it contains items for both pkgsrc users and developers.To subscribe, do:
-%
echo subscribelistname
| mail majordomo@NetBSD.org +%
echo subscribelistname
| mail majordomo@NetBSD.org
Archives for all these mailing lists are available from http://mail-index.NetBSD.org/.
@@ -3412,10 +3412,10 @@ values.wget
to resume downloads, you'll have to use something
like:
- FETCH_CMD= wget - FETCH_BEFORE_ARGS= --passive-ftp - FETCH_RESUME_ARGS= -c - FETCH_OUTPUT_ARGS= -O +FETCH_CMD= wget +FETCH_BEFORE_ARGS= --passive-ftp +FETCH_RESUME_ARGS= -c +FETCH_OUTPUT_ARGS= -O
/usr/X11R6
, /usr/openw
...), you will have to add the following line into
/etc/mk.conf
:
- X11_TYPE=XFree86
+X11_TYPE=XFree86
/usr/X11R6
, /usr/openw
you will have to add the following line into
/etc/mk.conf
:
- X11_TYPE=xorg
+X11_TYPE=xorg
Note
@@ -3456,8 +3456,8 @@ form of a URL, e.g. in Amdahl, the machine
port 80 as the proxy port number. So the proxy environment variables
are:
- ftp_proxy=ftp://orpheus.amdahl.com:80/
- http_proxy=http://orpheus.amdahl.com:80/
+ftp_proxy=ftp://orpheus.amdahl.com:80/
+http_proxy=http://orpheus.amdahl.com:80/
@@ -3551,9 +3551,9 @@ following into your /etc/mk.conf
, somewhere
after the definition of the
LOCALBASE
variable:
- .if exists(${LOCALBASE}/bin/sudo)
- SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
- .endif
+.if exists(${LOCALBASE}/bin/sudo)
+SU_CMD= ${LOCALBASE}/bin/sudo /bin/sh -c
+.endif
@@ -3858,7 +3858,7 @@ anymore, you can remove that file and run cvs -q u
- 18.6.1. Creating needed directories
- 18.6.2. Where to install documentation
-- 18.6.3. Installing score files
+- 18.6.3. Installing highscore files
- 18.6.4. Packages with hardcoded paths to other interpreters
- 18.6.5. Packages installing perl modules
- 18.6.6. Packages installing info files
@@ -3949,17 +3949,17 @@ needed for building the package, but not when using it, use
BUILD_DEPENDS
instead of DEPENDS
.
Your package may then look like this:
- [...]
+[...]
- BUILD_DEPENDS+= lua>=5.0:../../lang/lua
- DEPENDS+= screen-[0-9]*:../../misc/screen
- DEPENDS+= screen>=4.0:../../misc/screen
+BUILD_DEPENDS+= lua>=5.0:../../lang/lua
+DEPENDS+= screen-[0-9]*:../../misc/screen
+DEPENDS+= screen>=4.0:../../misc/screen
- [...]
+[...]
- .include "../../category
/package
/buildlink3.mk"
- .include "../../devel/glib2/buildlink3.mk"
- .include "../../mk/bsd.pkg.mk"
+.include "../../category
/package
/buildlink3.mk"
+.include "../../devel/glib2/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Run pkglint to see what things still need
@@ -4029,13 +4029,13 @@ that the “nvu” package has not yet been i
pkgsrc. As the description says it has to do with the web, the obvious
choice for the category is “www”.
- $
mkdir www/nvu
- $
cd www/nvu
+$
mkdir www/nvu
+$
cd www/nvu
The web site says that the sources are available as a tar file, so
I fed that URL to the url2pkg program:
- $
url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
+$
url2pkg http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
My editor popped up, and I added a PKGNAME
line
below the DISTNAME
line, as the package name should
@@ -4044,44 +4044,44 @@ not have the word “sources” in it. I also
COMMENT
fields. Then the package
Makefile
looked like that:
- # $NetBSD$
- #
+# $NetBSD$
+#
- DISTNAME= nvu-1.0-sources
- PKGNAME= nvu-1.0
- CATEGORIES= www
- MASTER_SITES= http://cvs.nvu.com/download/
- EXTRACT_SUFX= .tar.bz2
+DISTNAME= nvu-1.0-sources
+PKGNAME= nvu-1.0
+CATEGORIES= www
+MASTER_SITES= http://cvs.nvu.com/download/
+EXTRACT_SUFX= .tar.bz2
- MAINTAINER= rillig@NetBSD.org
- HOMEPAGE= http://cvs.nvu.com/
- COMMENT= Web Authoring System
+MAINTAINER= rillig@NetBSD.org
+HOMEPAGE= http://cvs.nvu.com/
+COMMENT= Web Authoring System
- # url2pkg-marker (please do not remove this line.)
- .include "../../mk/bsd.pkg.mk"
+# url2pkg-marker (please do not remove this line.)
+.include "../../mk/bsd.pkg.mk"
Then, I quit the editor and watched pkgsrc downloading a large
source archive:
- url2pkg> Running "make makesum" ...
- => Required installed package digest>=20010302: digest-20060826 found
- => Fetching nvu-1.0-sources.tar.bz2
- Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
- 100% |*************************************| 28992 KB 150.77 KB/s 00:00 ETA
- 29687976 bytes retrieved in 03:12 (150.77 KB/s)
- url2pkg> Running "make extract" ...
- => Required installed package digest>=20010302: digest-20060826 found
- => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
- => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
- work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
- ===> Installing dependencies for nvu-1.0
- ===> Overriding tools for nvu-1.0
- ===> Extracting for nvu-1.0
- url2pkg> Adjusting the Makefile.
+url2pkg> Running "make makesum" ...
+=> Required installed package digest>=20010302: digest-20060826 found
+=> Fetching nvu-1.0-sources.tar.bz2
+Requesting http://cvs.nvu.com/download/nvu-1.0-sources.tar.bz2
+100% |*************************************| 28992 KB 150.77 KB/s00:00 ETA
+29687976 bytes retrieved in 03:12 (150.77 KB/s)
+url2pkg> Running "make extract" ...
+=> Required installed package digest>=20010302: digest-20060826 found
+=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
+=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
+work.bacc -> /tmp/roland/pkgsrc/www/nvu/work.bacc
+===> Installing dependencies for nvu-1.0
+===> Overriding tools for nvu-1.0
+===> Extracting for nvu-1.0
+url2pkg> Adjusting the Makefile.
- Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
+Remember to correct CATEGORIES, HOMEPAGE, COMMENT, and DESCR when you're done!
- Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
+Good luck! (See pkgsrc/doc/pkgsrc.txt for some more help :-)
@@ -4094,18 +4094,18 @@ dependencies this package has. But since there is a GNU configure script
in the package, let's hope that it will complain about everything it
needs.
- $
bmake
- => Required installed package digest>=20010302: digest-20060826 found
- => Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
- => Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
- ===> Patching for nvu-1.0
- ===> Creating toolchain wrappers for nvu-1.0
- ===> Configuring for nvu-1.0
- [...]
- configure: error: Perl 5.004 or higher is required.
- [...]
- WARNING: Please add USE_TOOLS+=perl to the package Makefile.
- [...]
+$
bmake
+=> Required installed package digest>=20010302: digest-20060826 found
+=> Checksum SHA1 OK for nvu-1.0-sources.tar.bz2
+=> Checksum RMD160 OK for nvu-1.0-sources.tar.bz2
+===> Patching for nvu-1.0
+===> Creating toolchain wrappers for nvu-1.0
+===> Configuring for nvu-1.0
+[...]
+configure: error: Perl 5.004 or higher is required.
+[...]
+WARNING: Please add USE_TOOLS+=perl to the package Makefile.
+[...]
That worked quite well. So I opened the package Makefile in my
editor, and since it already has a USE_TOOLS
line, I
@@ -4114,33 +4114,33 @@ package have changed now, and since a perl wrapper is automatically
installed in the “tools” phase, I need to build the package
from scratch.
- $
bmake clean
- ===> Cleaning for nvu-1.0
- $
bmake
- [...]
- *** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
- GNU Make. You will not be able to build Mozilla without GNU Make.
- [...]
+$
bmake clean
+===> Cleaning for nvu-1.0
+$
bmake
+[...]
+*** /tmp/roland/pkgsrc/www/nvu/work.bacc/.tools/bin/make is not \
+GNU Make. You will not be able to build Mozilla without GNU Make.
+[...]
So I added “gmake” to the
USE_TOOLS
line and tried again (from scratch).
- [...]
- checking for GTK - version >= 1.2.0... no
- *** Could not run GTK test program, checking why...
- [...]
+[...]
+checking for GTK - version >= 1.2.0... no
+*** Could not run GTK test program, checking why...
+[...]
Now to the other dependencies. The first question is: Where is the
GTK package hidden in pkgsrc?
- $
echo ../../*/gtk*
- [many packages ...]
- $
echo ../../*/gtk
- ../../x11/gtk
- $
echo ../../*/gtk2
- ../../x11/gtk2
- $
echo ../../*/gtk2/bui*
- ../../x11/gtk2/buildlink3.mk
+$
echo ../../*/gtk*
+[many packages ...]
+$
echo ../../*/gtk
+../../x11/gtk
+$
echo ../../*/gtk2
+../../x11/gtk2
+$
echo ../../*/gtk2/bui*
+../../x11/gtk2/buildlink3.mk
The first try was definitely too broad. The second one had exactly
one result, which is very good. But there is one pitfall with GNOME
@@ -4154,23 +4154,23 @@ file, adding the dependency is very easy. I just inserted an
.include
line before the last line of the package
Makefile
, so that it now looks like this:
- [...]
- .include "../../x11/gtk2/buildlink3.mk"
- .include "../../mk/bsd.pkg.mk
+[...]
+.include "../../x11/gtk2/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk
After another bmake clean && bmake, the answer
was:
- [...]
- checking for gtk-config... /home/roland/pkg/bin/gtk-config
- checking for GTK - version >= 1.2.0... no
- *** Could not run GTK test program, checking why...
- *** The test program failed to compile or link. See the file config.log for the
- *** exact error that occured. This usually means GTK was incorrectly installed
- *** or that you have moved GTK since it was installed. In the latter case, you
- *** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
- configure: error: Test for GTK failed.
- [...]
+[...]
+checking for gtk-config... /home/roland/pkg/bin/gtk-config
+checking for GTK - version >= 1.2.0... no
+*** Could not run GTK test program, checking why...
+*** The test program failed to compile or link. See the file config.log for the
+*** exact error that occured. This usually means GTK was incorrectly installed
+*** or that you have moved GTK since it was installed. In the latter case, you
+*** may want to edit the gtk-config script: /home/roland/pkg/bin/gtk-config
+configure: error: Test for GTK failed.
+[...]
In this particular case, the assumption that “every package
prefers GNOME 2” had been wrong. The first of the lines above
@@ -4181,22 +4181,22 @@ So I changed the x11/gtk2
to
x11/gtk
in the package Makefile
,
and tried again.
- [...]
- cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" -I../../../dist/include/xpcom -I../../../dist/include -I/tmp/roland/pkgsrc/www/nvu/work.bacc/mozilla/dist/include/nspr -I/usr/X11R6/include -fPIC -DPIC -I/home/roland/pkg/include -I/usr/include -I/usr/X11R6/include -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -O2 -I/home/roland/pkg/include -I/usr/include -Dunix -pthread -pipe -DDEBUG -D_DEBUG -DDEBUG_roland -DTRACING -g -I/home/roland/pkg/include/glib/glib-1.2 -I/home/roland/pkg/lib/glib/include -I/usr/pkg/include/orbit-1.0 -I/home/roland/pkg/include -I/usr/include -I/usr/X11R6/include -include ../../../mozilla-config.h -DMOZILLA_CLIENT -Wp,-MD,.deps/xpidl.pp xpidl.c
- In file included from xpidl.c:42:
- xpidl.h:53:24: libIDL/IDL.h: No such file or directory
- In file included from xpidl.c:42:
- xpidl.h:132: error: parse error before "IDL_ns"
- [...]
+[...]
+cc -o xpidl.o -c -DOSTYPE=\"NetBSD3\" -DOSARCH=\"NetBSD\" -I../../../dist/include/xpcom -I../../../dist/include -I/tmp/roland/pkgsrc/www/nvu/work.bacc/mozilla/dist/include/nspr -I/usr/X11R6/include -fPIC -DPIC -I/home/roland/pkg/include -I/usr/include -I/usr/X11R6/include -Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -O2 -I/home/roland/pkg/include -I/usr/include -Dunix -pthread -pipe -DDEBUG -D_DEBUG -DDEBUG_roland -DTRACING -g -I/home/roland/pkg/include/glib/glib-1.2 -I/home/roland/pkg/lib/glib/include -I/usr/pkg/include/orbit-1.0 -I/home/roland/pkg/include -I/usr/include -I/usr/X11R6/include -include ../../../mozilla-config.h -DMOZILLA_CLIENT -Wp,-MD,.deps/xpidl.pp xpidl.c
+In file included from xpidl.c:42:
+xpidl.h:53:24: libIDL/IDL.h: No such file or directory
+In file included from xpidl.c:42:
+xpidl.h:132: error: parse error before "IDL_ns"
+[...]
The package still does not find all of its dependencies. Now the
question is: Which package provides the
libIDL/IDL.h
header file?
- $
echo ../../*/*idl*
- ../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
- $
echo ../../*/*IDL*
- ../../net/libIDL
+$
echo ../../*/*idl*
+../../devel/py-idle ../../wip/idled ../../x11/acidlaunch
+$
echo ../../*/*IDL*
+../../net/libIDL
Let's take the one from the second try. So I included the
../../net/libIDL/buildlink3.mk
file and tried
@@ -4206,8 +4206,8 @@ couldn't have ever worked, but since the Mozilla source tree is quite
large, I didn't want to fix it. So I added the following to the package
Makefile
and tried again:
- CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
- BUILDLINK_TRANSFORM+= -l:IDL:IDL-2
+CPPFLAGS+= -I${BUILDLINK_PREFIX.libIDL}/include/libIDL-2.0
+BUILDLINK_TRANSFORM+= -l:IDL:IDL-2
The latter line is needed because the package expects the library
libIDL.so
, but only
@@ -4224,11 +4224,11 @@ everything worked.
- $
bmake CHECK_FILES=no install
- [...]
- $
bmake print-PLIST >PLIST
- $
bmake deinstall
- $
bmake install
+$
bmake CHECK_FILES=no install
+[...]
+$
bmake print-PLIST >PLIST
+$
bmake deinstall
+$
bmake install
CATEGORIES
. If more than
one is used, they need to be separated by spaces:
- archivers cross geography meta-pkgs security - audio databases graphics misc shells - benchmarks devel ham multimedia sysutils - biology editors inputmethod net textproc - cad emulators lang news time - chat finance mail parallel wm - comms fonts math pkgtools www - converters games mbone print x11 -+archivers cross geography meta-pkgs security +audio databases graphics misc shells +benchmarks devel ham multimedia sysutils +biology editors inputmethod net textproc +cad emulators lang news time +chat finance mail parallel wm +comms fonts math pkgtools www +converters games mbone print x11 +
MASTER_SITES
,
DYNAMIC_MASTER_SITES
,
@@ -4507,7 +4507,7 @@ sections.
PATCHDIR
to the path where the patch files
can be found, e.g.:
- PATCHDIR= ${.CURDIR}/../xemacs/patches +PATCHDIR= ${.CURDIR}/../xemacs/patches
Patch files that are distributed by the author or other maintainers can be listed in @@ -4568,53 +4568,65 @@ sections.
case ${target_os} in - netbsd*) have_kvm=yes ;; - *) have_kvm=no ;; - esac+
+case ${target_os} in +netbsd*) have_kvm=yes ;; +*) have_kvm=no ;; +esac +
AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no)+
+AC_CHECK_LIB(kvm, kvm_open, have_kvm=yes, have_kvm=no) +
#if defined(__NetBSD__) - # include <sys/event.h> - #endif+
+#if defined(__NetBSD__) +# include <sys/event.h> +#endif +
#if defined(HAVE_SYS_EVENT_H) - # include <sys/event.h> - #endif+
+#if defined(HAVE_SYS_EVENT_H) +# include <sys/event.h> +#endif +
int - monitor_file(...) - { - #if defined(__NetBSD__) - int fd = kqueue(); - ... - #else - ... - #endif - }+
+int +monitor_file(...) +{ +#if defined(__NetBSD__) + int fd = kqueue(); + ... +#else + ... +#endif +} +
int - monitor_file(...) - { - #if defined(HAVE_KQUEUE) - int fd = kqueue(); - ... - #else - ... - #endif - }+
+int +monitor_file(...) +{ +#if defined(HAVE_KQUEUE) + int fd = kqueue(); + ... +#else + ... +#endif +} +
MESSAGE_SUBST
in the package's
Makefile
:
- MESSAGE_SUBST+= SOMEVAR="somevalue" -+MESSAGE_SUBST+= SOMEVAR="somevalue" +
replaces "${SOMEVAR}" with “somevalue” in
MESSAGE
. By default, substitution is
performed for PKGNAME
,
@@ -4794,8 +4806,8 @@ sections.
files
directory,
e.g.:
- FILESDIR=${.CURDIR}/../xemacs/files -+FILESDIR=${.CURDIR}/../xemacs/files +
- wrong: - @echo "line 1" > ${.TARGET} - @echo "line 2" >> ${.TARGET} - @false +wrong: + @echo "line 1" > ${.TARGET} + @echo "line 2" >> ${.TARGET} + @false - correct: - @echo "line 1" > ${.TARGET}.tmp - @echo "line 2" >> ${.TARGET}.tmp - @false - @mv ${.TARGET}.tmp ${.TARGET} +correct: + @echo "line 1" > ${.TARGET}.tmp + @echo "line 2" >> ${.TARGET}.tmp + @false + @mv ${.TARGET}.tmp ${.TARGET}
When you run make wrong twice, the file
wrong
will exist, although there was an error
@@ -4949,16 +4961,16 @@ sections.
- STRING= foo * bar `date` - INT_LIST= # empty - ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache - EXT_LIST= # empty - ANOTHER_EXT_LIST= a=b c=d +STRING= foo * bar `date` +INT_LIST= # empty +ANOTHER_INT_LIST= apache-[0-9]*:../../www/apache +EXT_LIST= # empty +ANOTHER_EXT_LIST= a=b c=d - INT_LIST+= ${STRING} # 1 - INT_LIST+= ${ANOTHER_INT_LIST} # 2 - EXT_LIST+= ${STRING:Q} # 3 - EXT_LIST+= ${ANOTHER_EXT_LIST} # 4 +INT_LIST+= ${STRING} # 1 +INT_LIST+= ${ANOTHER_INT_LIST} # 2 +EXT_LIST+= ${STRING:Q} # 3 +EXT_LIST+= ${ANOTHER_EXT_LIST} # 4
When you add a string to an external list (example 3), it must be quoted. In all other cases, you must not add a quoting @@ -4970,10 +4982,10 @@ sections.
- EXT_LIST= # empty - .for i in ${INT_LIST} - EXT_LIST+= ${i:Q}"" - .endfor +EXT_LIST= # empty +.for i in ${INT_LIST} +EXT_LIST+= ${i:Q}"" +.endfor
This code converts the internal list
INT_LIST
into the external list
@@ -4988,17 +5000,17 @@ sections.
- STRING= foo bar < > * `date` $$HOME ' " - EXT_LIST= string=${STRING:Q} x=second\ item +STRING= foo bar < > * `date` $$HOME ' " +EXT_LIST= string=${STRING:Q} x=second\ item - all: - echo ${STRING} # 1 - echo "${STRING}" # 2 - echo "${STRING:Q}" # 3 - echo ${STRING:Q} # 4 - echo x${STRING:Q} | sed 1s,.,, # 5 - printf "%s\\n" ${STRING:Q}"" # 6 - env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"' +all: + echo ${STRING} # 1 + echo "${STRING}" # 2 + echo "${STRING:Q}" # 3 + echo ${STRING:Q} # 4 + echo x${STRING:Q} | sed 1s,.,, # 5 + printf "%s\\n" ${STRING:Q}"" # 6 + env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
Example 1 leads to a syntax error in the shell, as the characters are just copied.
@@ -5051,15 +5063,15 @@ sections. pass theCPPFLAGS
value properly trimmed. And
here is how we do it:
- CPPFLAGS= # empty - CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\" - CPPFLAGS+= ${MY_CPPFLAGS} +CPPFLAGS= # empty +CPPFLAGS+= -Wundef -DPREFIX=\"${PREFIX:Q}\" +CPPFLAGS+= ${MY_CPPFLAGS} - CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q} +CONFIGURE_ARGS+= CPPFLAGS=${CPPFLAGS:M*:Q} - all: - echo x${CPPFLAGS:Q}x # leading and trailing whitespace - echo x${CONFIGURE_ARGS}x # properly trimmed +all: + echo x${CPPFLAGS:Q}x # leading and trailing whitespace + echo x${CONFIGURE_ARGS}x # properly trimmed
The example above contains one bug: The @@ -5079,17 +5091,17 @@ sections.
are two completely different cases which can be solved with the same trick.- EMPTY= # empty - empty_test: - for i in a ${EMPTY:Q} c; do \ - echo "$$i"; \ - done +EMPTY= # empty +empty_test: + for i in a ${EMPTY:Q} c; do \ + echo "$$i"; \ + done - for_test: - .for i in a:\ a:\test.txt - echo ${i:Q} - echo "foo" - .endfor +for_test: +.for i in a:\ a:\test.txt + echo ${i:Q} + echo "foo" +.endfor
The first example will only print two of the three lines we might have expected. This is because @@ -5116,7 +5128,7 @@ sections.
contains a ``-'' character, one of the closing braces is included in${VAR}
after this code executes.
- VAR:= ${VAR:N${_othervar_:C/-//}} +VAR:= ${VAR:N${_othervar_:C/-//}}
For a more complex code snippet and a workaround, see the
package regress/make-quoting
, testcase
@@ -5154,7 +5166,7 @@ sections.
Be sure to add a RCS ID line as the first thing in any
PLIST
file you write:
- @comment $NetBSD$ +@comment $NetBSD$
libdata/foo
directory removed from the
resulting PLIST:
- PRINT_PLIST_AWK+= /^libdata\/foo/ { next; } +PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
And to get all the @dirrm
lines referring
to a specific (shared) directory converted to
@comment
s:
- PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; } +PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
MESSAGE_SUBST
(see Section 10.5, “Optional files”):
- PLIST_SUBST+= SOMEVAR="somevalue" +PLIST_SUBST+= SOMEVAR="somevalue"
This replaces all occurrences of “${SOMEVAR}”
in the PLIST
with
@@ -5299,7 +5311,7 @@ sections.
- @unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE} +@unexec ${RMDIR} %D/path/to/shared/directory 2>/dev/null || ${TRUE}
in the PLISTs of all affected packages, instead of the regular "@dirrm" line.
@@ -5318,8 +5330,8 @@ sections.From now on, we'll discuss the second solution. To get an idea of the *-dirs packages available, issue:
-%
cd .../pkgsrc -%
ls -d */*-dirs +%
cd .../pkgsrc +%
ls -d */*-dirs
Their use from other packages is very simple. The
USE_DIRS
variable takes a list of package names
@@ -5330,7 +5342,7 @@ sections.
share/applications
, it should have the
following line in it:
- USE_DIRS+= xdg-1.1 +USE_DIRS+= xdg-1.1
After regenerating the PLIST using make print-PLIST, you should get the right (commented out) @@ -5409,19 +5421,19 @@ sections.
If a dependency on a particular package is required for its libraries and headers, then we replace:
- DEPENDS+= foo>=1.1.0:../../category/foo -+DEPENDS+= foo>=1.1.0:../../category/foo +
with
- .include "../../category/foo/buildlink3.mk" -+.include "../../category/foo/buildlink3.mk" +
The buildlink3.mk files usually define the required dependencies. If you need a newer version of the dependency when using buildlink3.mk files, then you can define it in your Makefile; for example:
- BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0 - .include "../../category/foo/buildlink3.mk" -+BUILDLINK_API_DEPENDS.foo+= foo>=1.1.0 +.include "../../category/foo/buildlink3.mk" +
There are several buildlink3.mk
files in pkgsrc/mk
that handle special package issues:
buildlink3.mk
is taken
from pkgsrc/graphics/tiff
:
- # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $ +# $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $ - BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ - TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+ +BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ +TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+ - .if !empty(BUILDLINK_DEPTH:M+) - BUILDLINK_DEPENDS+= tiff - .endif +.if ${BUILDLINK_DEPTH} == "+" +BUILDLINK_DEPENDS+= tiff +.endif - BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff} - BUILDLINK_PACKAGES+= tiff +BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntiff} +BUILDLINK_PACKAGES+= tiff - .if !empty(TIFF_BUILDLINK3_MK:M+) - BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1 - BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff - .endif # TIFF_BUILDLINK3_MK +.if ${TIFF_BUILDLINK3_MK} == "+" +BUILDLINK_API_DEPENDS.tiff+= tiff>=3.6.1 +BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff +.endif # TIFF_BUILDLINK3_MK - .include "../../devel/zlib/buildlink3.mk" - .include "../../graphics/jpeg/buildlink3.mk" +.include "../../devel/zlib/buildlink3.mk" +.include "../../graphics/jpeg/buildlink3.mk" - BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} -+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} +
The header and footer manipulate
BUILDLINK_DEPTH
, which is common across all
buildlink3.mk
files and is used to track
@@ -5690,45 +5702,42 @@ sections.
The following is the recommended template for builtin.mk files:
- .if !defined(IS_BUILTIN.foo) - # - # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo" - # genuinely exists in the system or not. - # - IS_BUILTIN.foo?= no +.if !defined(IS_BUILTIN.foo) +# +# IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo" +# genuinely exists in the system or not. +# +IS_BUILTIN.foo?= no - # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package - # version can be determined. - # - . if !empty(IS_BUILTIN.foo:M[yY][eE][sS]) - BUILTIN_PKG.foo?= foo-1.0 - . endif - .endif # IS_BUILTIN.foo +# BUILTIN_PKG.foo should be set here if "foo" is built-in and its package +# version can be determined. +# +. if !empty(IS_BUILTIN.foo:M[yY][eE][sS]) +BUILTIN_PKG.foo?= foo-1.0 +. endif +.endif # IS_BUILTIN.foo - .if !defined(USE_BUILTIN.foo) - USE_BUILTIN.foo?= ${IS_BUILTIN.foo} - . if defined(BUILTIN_PKG.foo) - . for _depend_ in ${BUILDLINK_API_DEPENDS.foo} - . if !empty(USE_BUILTIN.foo:M[yY][eE][sS]) - USE_BUILTIN.foo!= \ - if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then \ - ${ECHO} "yes"; \ - else \ - ${ECHO} "no"; \ - fi - . endif - . endfor - . endif - .endif # USE_BUILTIN.foo +.if !defined(USE_BUILTIN.foo) +USE_BUILTIN.foo?= ${IS_BUILTIN.foo} +. if defined(BUILTIN_PKG.foo) +. for _depend_ in ${BUILDLINK_API_DEPENDS.foo} +. if !empty(USE_BUILTIN.foo:M[yY][eE][sS]) +USE_BUILTIN.foo!= \ + ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo} \ + && ${ECHO} "yes" || ${ECHO} "no" +. endif +. endfor +. endif +.endif # USE_BUILTIN.foo - CHECK_BUILTIN.foo?= no - .if !empty(CHECK_BUILTIN.foo:M[nN][oO]) - # - # Here we place code that depends on whether USE_BUILTIN.foo is set to - # "yes" or "no". - # - .endif # CHECK_BUILTIN.foo -+CHECK_BUILTIN.foo?= no +.if !empty(CHECK_BUILTIN.foo:M[nN][oO]) +# +# Here we place code that depends on whether USE_BUILTIN.foo is set to +# "yes" or "no". +# +.endif # CHECK_BUILTIN.foo +
The first section sets
IS_BUILTIN.
depending on if pkg
pkg
really exists
@@ -5797,9 +5806,9 @@ sections.
- PREFER_PKGSRC= yes - PREFER_NATIVE= getopt skey tcp_wrappers -+PREFER_PKGSRC= yes +PREFER_NATIVE= getopt skey tcp_wrappers +
A package must have a
builtin.mk
file to be listed in PREFER_NATIVE
,
@@ -5908,7 +5917,7 @@ directories anywhere in the file system:
- MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700 +MAKE_DIRS_PERMS+= ${VARBASE}/foo/private ${ROOT_USER} ${ROOT_GROUP} 0700
The difference between the two is exactly the same as their
non-PERMS
counterparts.
- SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700 +SUPPORT_FILES_PERMS+= ${PREFIX}/share/somefile ${VARBASE}/somefile ${ROOT_USER} ${ROOT_GROUP} 0700
The difference between the two is exactly the same as their
non-PERMS
counterparts.
- CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} +CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
Note that this specifies where the package has to look
for its configuration files, not where they will be originally
@@ -6059,8 +6068,8 @@ used. Check out mail/mutt
package:
- EGDIR= ${PREFIX}/share/doc/mutt/samples - CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc +EGDIR= ${PREFIX}/share/doc/mutt/samples +CONF_FILES= ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
Note that the EGDIR
variable is specific to that
package and has no meaning outside it.
RCD_SCRIPTS
variable.
Continuing the previous example:
- RCD_SCRIPTS+= cupsd +RCD_SCRIPTS+= cupsd
PKG_USERS
variable. Each entry has the following
syntax:
- user:group +user:group
Further specification of user details may be done by setting per-user variables. @@ -6147,7 +6156,7 @@ not specified.
Similarly, groups can be created by adding entries to the
PKG_GROUPS
variable, whose syntax is:
- group +group
The numeric GID of the group may be set by defining
PKG_GID.
.group
shells/zsh
:
- PKG_SHELL= ${PREFIX}/bin/zsh +PKG_SHELL= ${PREFIX}/bin/zsh
fonts/dbz-ttf
:
- FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF +FONTS_DIRS.ttf= ${PREFIX}/lib/X11/fonts/TTF
options.mk
, that is included by the
main package Makefile
.
- PKG_OPTIONS_VAR= PKG_OPTIONS.wibble - PKG_SUPPORTED_OPTIONS= wibble-foo ldap - PKG_OPTIONS_OPTIONAL_GROUPS= database - PKG_OPTIONS_GROUP.database= mysql pgsql - PKG_SUGGESTED_OPTIONS= wibble-foo - PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap - PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo +PKG_OPTIONS_VAR= PKG_OPTIONS.wibble +PKG_SUPPORTED_OPTIONS= wibble-foo ldap +PKG_OPTIONS_OPTIONAL_GROUPS= database +PKG_OPTIONS_GROUP.database= mysql pgsql +PKG_SUGGESTED_OPTIONS= wibble-foo +PKG_OPTIONS_LEGACY_VARS+= WIBBLE_USE_OPENLDAP:ldap +PKG_OPTIONS_LEGACY_OPTS+= foo:wibble-foo - .include "../../mk/bsd.prefs.mk" +.include "../../mk/bsd.prefs.mk" - # this package was previously named wibble2 - .if defined(PKG_OPTIONS.wibble2) - PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2} - PKG_OPTIONS_DEPRECATED_WARNINGS+= \ - "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead." - .endif +# this package was previously named wibble2 +.if defined(PKG_OPTIONS.wibble2) +PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.wibble2} +PKG_OPTIONS_DEPRECATED_WARNINGS+= \ + "Deprecated variable PKG_OPTIONS.wibble2 used, use ${PKG_OPTIONS_VAR} instead." +.endif - .include "../../mk/bsd.options.mk" +.include "../../mk/bsd.options.mk" - # Package-specific option-handling +# Package-specific option-handling - ### - ### FOO support - ### - .if !empty(PKG_OPTIONS:Mwibble-foo) - CONFIGURE_ARGS+= --enable-foo - .endif +### +### FOO support +### +.if !empty(PKG_OPTIONS:Mwibble-foo) +CONFIGURE_ARGS+= --enable-foo +.endif - ### - ### LDAP support - ### - .if !empty(PKG_OPTIONS:Mldap) - . include "../../databases/openldap-client/buildlink3.mk" - CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client} - .endif +### +### LDAP support +### +.if !empty(PKG_OPTIONS:Mldap) +. include "../../databases/openldap-client/buildlink3.mk" +CONFIGURE_ARGS+= --enable-ldap=${BUILDLINK_PREFIX.openldap-client} +.endif - ### - ### database support - ### - .if !empty(PKG_OPTIONS:Mmysql) - . include "../../mk/mysql.buildlink3.mk" - .endif - .if !empty(PKG_OPTIONS:Mpgsql) - . include "../../mk/pgsql.buildlink3.mk" - .endif +### +### database support +### +.if !empty(PKG_OPTIONS:Mmysql) +. include "../../mk/mysql.buildlink3.mk" +.endif +.if !empty(PKG_OPTIONS:Mpgsql) +. include "../../mk/pgsql.buildlink3.mk" +.endif
The first section contains the information about which build options are supported by the package, and any default options settings @@ -6370,7 +6379,7 @@ options.
each option. The correct way to check for an option is to check whether it is listed inPKG_OPTIONS
:
- .if !empty(PKG_OPTIONS:Moption
) +.if !empty(PKG_OPTIONS:Moption
)
The following lines are taken from
pkgsrc/wm/scwm/Makefile
:
- EVAL_PREFIX+= GTKDIR=gtk+ - CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q} - CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q} - CONFIGURE_ARGS+= --enable-multibyte -+EVAL_PREFIX+= GTKDIR=gtk+ +CONFIGURE_ARGS+= --with-guile-prefix=${LOCALBASE:Q} +CONFIGURE_ARGS+= --with-gtk-prefix=${GTKDIR:Q} +CONFIGURE_ARGS+= --enable-multibyte +
Specific defaults can be defined for the packages
evaluated using EVAL_PREFIX
, by using a
definition of the form:
- GTKDIR_DEFAULT= ${LOCALBASE} -+GTKDIR_DEFAULT= ${LOCALBASE} +
where GTKDIR
corresponds
to the first definition in
the EVAL_PREFIX
pair.
+=
operator, but you have write for example:
- DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz -+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz +
Each distfile is fetched from a list of sites, usually
MASTER_SITES
. If the package has multiple
DISTFILES
or multiple
@@ -6640,12 +6649,12 @@ support.” The file is sorted by option names.
distfile
(including the suffix) can be found.
- DISTFILES= ${DISTNAME}${EXTRACT_SUFX} - DISTFILES+= foo-file.tar.gz - SITES.foo-file.tar.gz= \ - http://www.somewhere.com/somehow/ \ - http://www.somewhereelse.com/mirror/somehow/ -+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} +DISTFILES+= foo-file.tar.gz +SITES.foo-file.tar.gz= \ +http://www.somewhere.com/somehow/ \ +http://www.somewhereelse.com/mirror/somehow/ +
When actually fetching the distfiles, each item from
MASTER_SITES
or
SITES.*
gets the name of each distfile
@@ -6656,39 +6665,39 @@ support.” The file is sorted by option names.
- MASTER_SITES= http://www.example.com/download.cgi?file= -+MASTER_SITES= http://www.example.com/download.cgi?file= +
There are some predefined values for
MASTER_SITES
, which can be used in
packages. The names of the variables should speak for
themselves.
- ${MASTER_SITE_APACHE} - ${MASTER_SITE_BACKUP} - ${MASTER_SITE_CYGWIN} - ${MASTER_SITE_DEBIAN} - ${MASTER_SITE_FREEBSD} - ${MASTER_SITE_FREEBSD_LOCAL} - ${MASTER_SITE_GENTOO} - ${MASTER_SITE_GNOME} - ${MASTER_SITE_GNU} - ${MASTER_SITE_GNUSTEP} - ${MASTER_SITE_IFARCHIVE} - ${MASTER_SITE_KDE} - ${MASTER_SITE_MOZILLA} - ${MASTER_SITE_MYSQL} - ${MASTER_SITE_OPENOFFICE} - ${MASTER_SITE_PERL_CPAN} - ${MASTER_SITE_PGSQL} - ${MASTER_SITE_R_CRAN} - ${MASTER_SITE_SOURCEFORGE} - ${MASTER_SITE_SOURCEFORGE_JP} - ${MASTER_SITE_SUNSITE} - ${MASTER_SITE_SUSE} - ${MASTER_SITE_TEX_CTAN} - ${MASTER_SITE_XCONTRIB} - ${MASTER_SITE_XEMACS} -+${MASTER_SITE_APACHE} +${MASTER_SITE_BACKUP} +${MASTER_SITE_CYGWIN} +${MASTER_SITE_DEBIAN} +${MASTER_SITE_FREEBSD} +${MASTER_SITE_FREEBSD_LOCAL} +${MASTER_SITE_GENTOO} +${MASTER_SITE_GNOME} +${MASTER_SITE_GNU} +${MASTER_SITE_GNUSTEP} +${MASTER_SITE_IFARCHIVE} +${MASTER_SITE_KDE} +${MASTER_SITE_MOZILLA} +${MASTER_SITE_MYSQL} +${MASTER_SITE_OPENOFFICE} +${MASTER_SITE_PERL_CPAN} +${MASTER_SITE_PGSQL} +${MASTER_SITE_R_CRAN} +${MASTER_SITE_SOURCEFORGE} +${MASTER_SITE_SOURCEFORGE_JP} +${MASTER_SITE_SUNSITE} +${MASTER_SITE_SUSE} +${MASTER_SITE_TEX_CTAN} +${MASTER_SITE_XCONTRIB} +${MASTER_SITE_XEMACS} +
Some explanations for the less self-explaining ones:
MASTER_SITE_BACKUP
contains backup sites
for packages that are maintained in ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/${DIST_SUBDIR}. MASTER_SITE_LOCAL
contains local
@@ -6699,9 +6708,9 @@ support.” The file is sorted by option names.
- MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/} - MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/} -+MASTER_SITES= ${MASTER_SITE_GNU:=subdirectory/name/} +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=project_name/} +
Note the trailing slash after the subdirectory name.
- ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS} -+${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS} +
where ${site}
varies through
several possibilities in turn: first,
MASTER_SITE_OVERRIDE
is tried, then the
@@ -6869,11 +6878,12 @@ support.” The file is sorted by option names.
- .for d in ${CONFIGURE_DIRS} - cd ${WRKSRC} && cd ${d} && env ${CONFIGURE_ENV} \ - ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS} - .endfor -+.for d in ${CONFIGURE_DIRS} + cd ${WRKSRC} \ + && cd ${d} \ + && env ${CONFIGURE_ENV} ${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS} +.endfor +
CONFIGURE_DIRS
(default:
“.”) is a list of pathnames relative to
WRKSRC
. In each of these directories, the
@@ -6902,12 +6912,15 @@ support.” The file is sorted by option names.
For building a package, a rough equivalent of the following code is executed.
- .for d in ${BUILD_DIRS} - cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \ - ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \ - -f ${MAKE_FILE} ${BUILD_TARGET} - .endfor -+.for d in ${BUILD_DIRS} + cd ${WRKSRC} \ + && cd ${d} \ + && env ${MAKE_ENV} \ + ${MAKE_PROGRAM} ${BUILD_MAKE_FLAGS} \ + -f ${MAKE_FILE} \ + ${BUILD_TARGET} +.endfor +
BUILD_DIRS
(default:
“.”) is a list of pathnames relative to
WRKSRC
. In each of these directories,
@@ -6944,12 +6957,15 @@ support.” The file is sorted by option names.
- .for d in ${INSTALL_DIRS} - cd ${WRKSRC} && cd ${d} && env ${MAKE_ENV} \ - ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \ - -f ${MAKE_FILE} ${BUILD_TARGET} - .endfor -+.for d in ${INSTALL_DIRS} + cd ${WRKSRC} \ + && cd ${d} \ + && env ${MAKE_ENV} \ + ${MAKE_PROGRAM} ${INSTALL_MAKE_FLAGS} \ + -f ${MAKE_FILE} \ + ${INSTALL_TARGET} +.endfor +
The variable's meanings are analogous to the ones in the
build phase.
INSTALL_DIRS
defaults to
@@ -7500,7 +7516,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
How do I add a new tool?
How do I get a list of all available tools?
How can I get a list of all the tools that a package is using while being built? I want to know whether it @@ -7587,7 +7603,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
Makefile
, e.g.:
- INTERACTIVE_STAGE= build +INTERACTIVE_STAGE= build
Multiple interactive stages can be specified:
- INTERACTIVE_STAGE= configure install +INTERACTIVE_STAGE= configure install
The user can then decide to skip this package by setting the
BATCH
variable.
LICENSE
variable to a string identifying the
license, e.g. in graphics/xv
:
- LICENSE= xv-license +LICENSE= xv-license
When trying to build, the user will get a notice that the
package is covered by a license which has not been placed in the
ACCEPTABLE_LICENSES
variable:
-%
make
- ===> xv-3.10anb9 has an unacceptable license: xv-license. - ===> To view the license, enter "/usr/bin/make show-license". - ===> To indicate acceptance, add this line to your /etc/mk.conf: - ===> ACCEPTABLE_LICENSES+=xv-license - *** Error code 1 +%
make
+===> xv-3.10anb9 has an unacceptable license: xv-license. +===> To view the license, enter "/usr/bin/make show-license". +===> To indicate acceptance, add this line to your /etc/mk.conf: +===> ACCEPTABLE_LICENSES+=xv-license +*** Error code 1
The license can be viewed with make show-license, and if the user so chooses, the line @@ -7744,7 +7760,7 @@ TOOLS_PLATFORM.true?= true # shell builtin convey to pkgsrc that it should not in the future fail because of that license:
- ACCEPTABLE_LICENSES+=xv-license +ACCEPTABLE_LICENSES+=xv-license
When adding a package with a new license, the license text
should be added to pkgsrc/licenses
for
@@ -7858,7 +7874,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
The format for a BUILD_DEPENDS
and a
DEPENDS
definition is:
- <pre-req-package-name>:../../<category>/<pre-req-package> +<pre-req-package-name>:../../<category>/<pre-req-package>
Please note that the “pre-req-package-name”
may include any of the wildcard version numbers recognized by
@@ -7869,7 +7885,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
libraries to build or run, and if that package has a
buildlink3.mk
file available, use it:
- .include "../../graphics/jpeg/buildlink3.mk" +.include "../../graphics/jpeg/buildlink3.mk"
BUILD_DEPENDS
definition:
- BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf +BUILD_DEPENDS+= autoconf-2.13:../../devel/autoconf
DEPENDS
definition. For example:
- DEPENDS+= xpm-3.4j:../../graphics/xpm +DEPENDS+= xpm-3.4j:../../graphics/xpm
You can also use wildcards in package dependences:
- DEPENDS+= xpm-[0-9]*:../../graphics/xpm +DEPENDS+= xpm-[0-9]*:../../graphics/xpm
Note that such wildcard dependencies are retained when creating binary packages. The dependency is checked when @@ -7906,7 +7922,7 @@ TOOLS_PLATFORM.true?= true # shell builtin will only build against a certain minimum version of a pre-requisite:
- DEPENDS+= tiff>=3.5.4:../../graphics/tiff +DEPENDS+= tiff>=3.5.4:../../graphics/tiff
This means that the package will build against version
3.5.4 of the tiff library or newer. Such a dependency may
@@ -7920,7 +7936,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
correctly. Such recommendations can be expressed using
ABI_DEPENDS
:
- ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff +ABI_DEPENDS+= tiff>=3.6.1:../../graphics/tiff
In addition to the above DEPENDS
line, this denotes that while a package will build against
@@ -7954,7 +7970,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
be able to execute the latex binary from the teTeX package
when it runs, and that is specified:
- DEPENDS+= teTeX-[0-9]*:../../print/teTeX +DEPENDS+= teTeX-[0-9]*:../../print/teTeX
The comment about wildcard dependencies from previous paragraph applies here, too.
@@ -7982,11 +7998,11 @@ TOOLS_PLATFORM.true?= true # shell builtin install the same shared library, thus you set inpkgsrc/x11/Xaw3d/Makefile
:
- CONFLICTS= Xaw-Xpm-[0-9]* +CONFLICTS= Xaw-Xpm-[0-9]*
and in pkgsrc/x11/Xaw-Xpm/Makefile
:
- CONFLICTS= Xaw3d-[0-9]* +CONFLICTS= Xaw3d-[0-9]*
Packages will automatically conflict with other packages with the name prefix and a different version @@ -8059,8 +8075,8 @@ TOOLS_PLATFORM.true?= true # shell builtin (2, ...). The “nb” is treated like a “.” by the package tools. e.g.
- DISTNAME= foo-17.42 - PKGREVISION= 9 +DISTNAME= foo-17.42 +PKGREVISION= 9
will result in a PKGNAME
of
“foo-17.42nb9”. If you want to use the original
@@ -8071,7 +8087,7 @@ TOOLS_PLATFORM.true?= true # shell builtin
PKGREVISION
should be removed, e.g. on a new
minor release of the above package, things should be like:
- DISTNAME= foo-17.43 +DISTNAME= foo-17.43
PKGREVISION
should be incremented for any
non-trivial change in the resulting binary package. Without a
@@ -8084,20 +8100,26 @@ TOOLS_PLATFORM.true?= true # shell builtin
PKGREVISION
is appropriate. Examples of
changes that do not merit increasing
PKGREVISION
are:
- Changing+HOMEPAGE
,MAINTAINER
, - or comments in Makefile. - Changing build variables if the resulting binary package is the same. - ChangingDESCR
. - AddingPKG_OPTIONS
if the default options don't change. -
Changing HOMEPAGE
, MAINTAINER
,
+ or comments in Makefile.
+ Changing build variables if the resulting binary package is the same.
+ Changing DESCR
.
+ Adding PKG_OPTIONS
if the default options don't change.
Examples of changes that do merit an increase to
PKGREVISION
include:
- Security fixes
- Changes or additions to a patch file
- Changes to the PLIST
-
++ Security fixes
+ Changes or additions to a patch file
+ Changes to the PLIST
PKGREVISION must also be incremented when dependencies have ABI changes.
@@ -8110,13 +8132,13 @@ TOOLS_PLATFORM.true?= true # shell builtin easy-to-use interface for replacing text in files. Example:- SUBST_CLASSES+= fix-paths - SUBST_STAGE.fix-paths= pre-configure - SUBST_MESSAGE.fix-paths= Fixing absolute paths. - SUBST_FILES.fix-paths= src/*.c - SUBST_FILES.fix-paths+= scripts/*.sh - SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' - SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g' +SUBST_CLASSES+= fix-paths +SUBST_STAGE.fix-paths= pre-configure +SUBST_MESSAGE.fix-paths= Fixing absolute paths. +SUBST_FILES.fix-paths= src/*.c +SUBST_FILES.fix-paths+= scripts/*.sh +SUBST_SED.fix-paths= -e 's,"/usr/local,"${PREFIX},g' +SUBST_SED.fix-paths+= -e 's,"/var/log,"${VARBASE}/log,g'
SUBST_CLASSES
is a list of identifiers
that are used to identify the different SUBST blocks that are
@@ -8180,9 +8202,9 @@ TOOLS_PLATFORM.true?= true # shell builtin
FETCH_MESSAGE
to a list of lines that are
displayed to the user before aborting the build. Example:
- FETCH_MESSAGE= "Please download the files" - FETCH_MESSAGE+= " "${DISTFILES:Q} - FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"." +FETCH_MESSAGE= "Please download the files" +FETCH_MESSAGE+= " "${DISTFILES:Q} +FETCH_MESSAGE+= "manually from "${MASTER_SITES:Q}"."
- ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \ - -rpath ${PREFIX}/lib -version-info major:minor +${LIBTOOL} --mode=link \ + ${CC} -o ${.TARGET:.a=.la} \ + ${OBJS:.o=.lo} \ + -rpath ${PREFIX}/lib \ + -version-info major:minor
Note that the library is changed to have a
.la
extension, and the objects are
@@ -8267,22 +8292,22 @@ TOOLS_PLATFORM.true?= true # shell builtin
shared library version.
From the libtool manual:
- So, libtool library versions are described by three integers: +So, libtool library versions are described by three integers: - CURRENT - The most recent interface number that this library implements. +CURRENT +The most recent interface number that this library implements. - REVISION - The implementation number of the CURRENT interface. +REVISION +The implementation number of the CURRENT interface. - AGE - The difference between the newest and oldest interfaces that - this library implements. In other words, the library implements - all the interface numbers in the range from number `CURRENT - - AGE' to `CURRENT'. +AGE +The difference between the newest and oldest interfaces that +this library implements. In other words, the library implements +all the interface numbers in the range from number `CURRENT - +AGE' to `CURRENT'. - If two libraries have identical CURRENT and AGE numbers, then the - dynamic linker chooses the library with the greater REVISION number. +If two libraries have identical CURRENT and AGE numbers, then the +dynamic linker chooses the library with the greater REVISION number.
The “-release” option will produce
different results for a.out and ELF (excluding symlinks)
@@ -8318,11 +8343,11 @@ TOOLS_PLATFORM.true?= true # shell builtin
expects you to change that argument to be the
.la
file. e.g.
- ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib +${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
should be changed to:
- ${LIBTOOL} --mode=link ${CC} -osomeprog
../somelib/somelib.la
+${LIBTOOL} --mode=link ${CC} -osomeprog
../somelib/somelib.la
and it will do the right thing with the libraries.
@@ -8332,7 +8357,7 @@ TOOLS_PLATFORM.true?= true # shell builtin --mode=install”, and change the library name to.la
. e.g.
- ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib +${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
This will install the static .a
,
shared library, any needed symlinks, and run
@@ -8393,27 +8418,26 @@ TOOLS_PLATFORM.true?= true # shell builtin
target.
For packages that need only autoconf:
- AUTOCONF_REQD= 2.50 # if default version is not good enough - USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 - ... +AUTOCONF_REQD= 2.50 # if default version is not good enough +USE_TOOLS+= autoconf # use "autoconf213" for autoconf-2.13 +... - pre-configure: - cd ${WRKSRC}; autoconf +pre-configure: + cd ${WRKSRC} && autoconf - ... +...
and for packages that need automake and autoconf:
- AUTOMAKE_REQD= 1.7.1 # if default version is not good enough - USE_TOOLS+= automake # use "automake14" for automake-1.4 - ... +AUTOMAKE_REQD= 1.7.1 # if default version is not good enough +USE_TOOLS+= automake # use "automake14" for automake-1.4 +... - pre-configure: - cd ${WRKSRC}; \ - aclocal; autoheader; \ - automake -a --foreign -i; autoconf +pre-configure: + set -e; cd ${WRKSRC}; \ + aclocal; autoheader; automake -a --foreign -i; autoconf - ... +...
Packages which use GNU Automake will almost certainly require GNU Make.
@@ -8529,43 +8553,43 @@ TOOLS_PLATFORM.true?= true # shell builtinTo distinguish between 4.4 BSD-derived systems and the rest of the world, you should use the following code.
- #include <sys/param.h> - #if (defined(BSD) && BSD >= 199306) - /* BSD-specific code goes here */ - #else - /* non-BSD-specific code goes here */ - #endif +#include <sys/param.h> +#if (defined(BSD) && BSD >= 199306) +/* BSD-specific code goes here */ +#else +/* non-BSD-specific code goes here */ +#endif
If this distinction is not fine enough, you can also test for the following macros.
- FreeBSD __FreeBSD__ - DragonFly __DragonFly__ - Interix __INTERIX - IRIX __sgi (TODO: get a definite source for this) - Linux linux, __linux, __linux__ - NetBSD __NetBSD__ - OpenBSD __OpenBSD__ - Solaris sun, __sun +FreeBSD __FreeBSD__ +DragonFly __DragonFly__ +Interix __INTERIX +IRIX __sgi (TODO: get a definite source for this) +Linux linux, __linux, __linux__ +NetBSD __NetBSD__ +OpenBSD __OpenBSD__ +Solaris sun, __sun
- i386 i386, __i386, __i386__ - MIPS __mips - SPARC sparc, __sparc +i386 i386, __i386, __i386__ +MIPS __mips +SPARC sparc, __sparc
- GCC __GNUC__ (major version), __GNUC_MINOR__ - MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) - SunPro __SUNPRO_C (0x570 for Sun C 5.7) - SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8) +GCC __GNUC__ (major version), __GNUC_MINOR__ +MIPSpro _COMPILER_VERSION (0x741 for MIPSpro 7.41) +SunPro __SUNPRO_C (0x570 for Sun C 5.7) +SunPro C++ __SUNPRO_CC (0x580 for Sun C++ 5.8)
When you are using the SunPro compiler, there is another possibility. That compiler cannot handle the following code:
- extern int extern_func(int); +extern int extern_func(int); - static inline int - inline_func(int x) - { +static inline int +inline_func(int x) +{ return extern_func(x); - } +} - int main(void) - { +int main(void) +{ return 0; - } +}
It generates the code for inline_func
even if
that function is never used. This code then refers to
@@ -8697,8 +8721,8 @@ of functions.
${INSTALL_*_DIR}
like this:
- ${INSTALL_DATA_DIR} ${PREFIX}/dir1 - ${INSTALL_DATA_DIR} ${PREFIX}/dir2 +${INSTALL_DATA_DIR} ${PREFIX}/dir1 +${INSTALL_DATA_DIR} ${PREFIX}/dir2
You can also just append “dir1
dir2
” to the
@@ -8736,7 +8760,7 @@ of functions.
Certain packages, most of them in the games category, install a score file that allows all users on the system to record their highscores. In order for this to work, the binaries need to be @@ -8764,11 +8788,11 @@ of functions.
following definitions in yourMakefile
(we
shall use tclsh in this example):
- REPLACE_INTERPRETER+= tcl - REPLACE.tcl.old= .*/bin/tclsh - REPLACE.tcl.new= ${PREFIX}/bin/tclsh - REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, - # relative to ${WRKSRC}, just as in REPLACE_PERL +REPLACE_INTERPRETER+= tcl +REPLACE.tcl.old= .*/bin/tclsh +REPLACE.tcl.new= ${PREFIX}/bin/tclsh +REPLACE_FILES.tcl= # list of tcl scripts which need to be fixed, +# relative to ${WRKSRC}, just as in REPLACE_PERL
PERL5_PACKLIST
to a space-separated list of
paths to packlist files, e.g.:
- PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist +PERL5_PACKLIST= ${PERL5_SITEARCH}/auto/Pg/.packlist
The variables PERL5_SITELIB
,
PERL5_SITEARCH
, and
@@ -9372,8 +9396,8 @@ of functions.
-$
cd .../pkgsrc/category/pkgname -$
cvs import pkgsrc/category/pkgname TNF pkgsrc-base +$
cd .../pkgsrc/category/pkgname +$
cvs import pkgsrc/category/pkgname TNF pkgsrc-base
Remember to move the directory from which you imported out of
the way, or cvs will complain the next time you “cvs
@@ -9495,7 +9519,7 @@ do?
What is the difference between
What is the difference between
What is the difference between
What is the difference between
Why does make show-var
VARNAME=BUILDLINK_PREFIX. What does
Which mailing lists are there for package
developers? Where is the pkgsrc
documentation? I have a little time to kill. What shall I
do? Almost all GNOME applications use the GNU Autotools as their
build system. As a general rule you will need to tell this to your
package: If the package uses pkg-config to detect dependencies, add this
@@ -10122,7 +10148,7 @@ details. Because of the selection of this default value, the same
value appears in many package Makefiles. Similarly for
@@ -10157,13 +10183,13 @@ details. This code shows how the use of the
-21.1.
+21.1.
MAKEFLAGS
, .MAKEFLAGS
and
@@ -9511,7 +9535,7 @@ do?
-21.2.
+21.2.
MAKE
, GMAKE
and
@@ -9529,7 +9553,7 @@ do?
-21.3.
+21.3.
CC
, PKG_CC
and
@@ -9547,7 +9571,7 @@ do?
-21.4.
+21.4.
BUILDLINK_LDFLAGS
,
@@ -9560,7 +9584,7 @@ do?
-21.5.
+21.5.
foo
@@ -9576,7 +9600,7 @@ do?
-21.6.
+21.6.
${MASTER_SITE_SOURCEFORGE:=package/}
mean? I
@@ -9600,7 +9624,7 @@ do?
-21.7.
+21.7.
@@ -9625,7 +9649,7 @@ do?
-21.8.
+21.8.
@@ -9673,7 +9697,7 @@ do?
-21.9.
+21.9.
@@ -9792,9 +9816,11 @@ give you a general idea on the minimum required tools:
GNU_CONFIGURE=yes
+
+GNU_CONFIGURE=yes
USE_LIBTOOL=yes
-USE_TOOLS+=gmake
+USE_TOOLS+=gmake
+
- DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX} additional-files.tar.gz
CONFIGURE_ARGS
. To make the effect more
clear, here is an example:
- CONFIGURE_ARGS= # none
- CFLAGS= -O
- CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
+CONFIGURE_ARGS= # none
+CFLAGS= -O
+CONFIGURE_ARGS+= CFLAGS=${CFLAGS:Q}
- CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
+CONFIGURE_ARGS:= ${CONFIGURE_ARGS}
- CFLAGS+= -Wall
+CFLAGS+= -Wall
:=
operator can quickly lead to unexpected results. The first
@@ -10516,41 +10542,41 @@ details.
- # $NetBSD$
- #
+# $NetBSD$
+#
- DISTNAME= bison-1.25
- CATEGORIES= devel
- MASTER_SITES= ${MASTER_SITE_GNU}
+DISTNAME= bison-1.25
+CATEGORIES= devel
+MASTER_SITES= ${MASTER_SITE_GNU}
- MAINTAINER= thorpej@NetBSD.org
- HOMEPAGE= http://www.gnu.org/software/bison/bison.html
- COMMENT= GNU yacc clone
+MAINTAINER= thorpej@NetBSD.org
+HOMEPAGE= http://www.gnu.org/software/bison/bison.html
+COMMENT= GNU yacc clone
- GNU_CONFIGURE= yes
- INFO_FILES= bison.info
+GNU_CONFIGURE= yes
+INFO_FILES= bison.info
- .include "../../mk/bsd.pkg.mk"
+.include "../../mk/bsd.pkg.mk"
- GNU version of yacc. Can make re-entrant parsers, and numerous other
- improvements. Why you would want this when Berkeley yacc(1) is part
- of the NetBSD source tree is beyond me.
+GNU version of yacc. Can make re-entrant parsers, and numerous other
+improvements. Why you would want this when Berkeley yacc(1) is part
+of the NetBSD source tree is beyond me.
- @comment $NetBSD$
- bin/bison
- man/man1/bison.1.gz
- share/bison.simple
- share/bison.hairy
+@comment $NetBSD$
+bin/bison
+man/man1/bison.1.gz
+share/bison.simple
+share/bison.hairy