Thu Oct 27 13:22:44 2016 UTC ()
pkgtools/pkg: Allow PORTSDIR to be specified

As pointed out by jperkins, defaulting to builder's setting for PKGSRCDIR
for the sources isn't aways correct for the binary package consumers.
This is not a problem unique to pkgtools/pkg and really requires a system-
wide solution.  Until there is such a global variable, rename the PORTSDIR
variable to PKG.portsdir and allow it to be modified by e.g. make.conf.

In the case of pkg, PORTSDIR just refers to a default configuration
location which is overridable by a configuration file.


(marino)
diff -r1.8 -r1.9 pkgsrc/pkgtools/pkg/Makefile

cvs diff -r1.8 -r1.9 pkgsrc/pkgtools/pkg/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg/Makefile 2016/10/27 00:24:58 1.8
+++ pkgsrc/pkgtools/pkg/Makefile 2016/10/27 13:22:44 1.9
@@ -1,31 +1,31 @@ @@ -1,31 +1,31 @@
1# $NetBSD: Makefile,v 1.8 2016/10/27 00:24:58 khorben Exp $ 1# $NetBSD: Makefile,v 1.9 2016/10/27 13:22:44 marino Exp $
2 2
3DISTNAME= pkg-1.8.7 3DISTNAME= pkg-1.8.7
4PKGREVISION= 3 4PKGREVISION= 3
5CATEGORIES= pkgtools 5CATEGORIES= pkgtools
6MASTER_SITES= http://files.etoilebsd.net/pkg/ 6MASTER_SITES= http://files.etoilebsd.net/pkg/
7EXTRACT_SUFX= .tar.xz 7EXTRACT_SUFX= .tar.xz
8 8
9MAINTAINER= khorben@defora.org 9MAINTAINER= khorben@defora.org
10HOMEPAGE= https://wiki.freebsd.org/pkgng 10HOMEPAGE= https://wiki.freebsd.org/pkgng
11COMMENT= Package management tool for FreeBSD 11COMMENT= Package management tool for FreeBSD
12LICENSE= 2-clause-bsd 12LICENSE= 2-clause-bsd
13 13
14GNU_CONFIGURE= yes 14GNU_CONFIGURE= yes
15USE_LANGUAGES= c 15USE_LANGUAGES= c
16 16
17CPPFLAGS+= -D_LOCALBASE="\"${PREFIX}\"" 17CPPFLAGS+= -D_LOCALBASE="\"${PREFIX}\""
18CPPFLAGS+= -DPORTSDIR="\"${PKGSRCDIR}\"" 18CPPFLAGS+= -DPORTSDIR="\"${PKG.portsdir}\""
19 19
20AUTO_MKDIRS= yes 20AUTO_MKDIRS= yes
21 21
22EGDIR= ${PREFIX}/share/examples/pkg 22EGDIR= ${PREFIX}/share/examples/pkg
23 23
24CONF_FILES+= ${EGDIR}/bash_completion.d/_pkg.bash \ 24CONF_FILES+= ${EGDIR}/bash_completion.d/_pkg.bash \
25 ${PKG_SYSCONFDIR}/bash_completion.d/_pkg.bash 25 ${PKG_SYSCONFDIR}/bash_completion.d/_pkg.bash
26CONF_FILES+= ${EGDIR}/periodic/daily/411.pkg-backup \ 26CONF_FILES+= ${EGDIR}/periodic/daily/411.pkg-backup \
27 ${PKG_SYSCONFDIR}/periodic/daily/411.pkg-backup 27 ${PKG_SYSCONFDIR}/periodic/daily/411.pkg-backup
28CONF_FILES+= ${EGDIR}/periodic/daily/490.status-pkg-changes \ 28CONF_FILES+= ${EGDIR}/periodic/daily/490.status-pkg-changes \
29 ${PKG_SYSCONFDIR}/periodic/daily/490.status-pkg-changes 29 ${PKG_SYSCONFDIR}/periodic/daily/490.status-pkg-changes
30CONF_FILES+= ${EGDIR}/periodic/security/410.pkg-audit \ 30CONF_FILES+= ${EGDIR}/periodic/security/410.pkg-audit \
31 ${PKG_SYSCONFDIR}/periodic/security/410.pkg-audit 31 ${PKG_SYSCONFDIR}/periodic/security/410.pkg-audit
@@ -51,35 +51,35 @@ SUBST_FILES.pkgconf-prefix= src/pkg.conf @@ -51,35 +51,35 @@ SUBST_FILES.pkgconf-prefix= src/pkg.conf
51SUBST_SED.pkgconf-prefix+= -e "s|/usr/local|${PREFIX}|g" 51SUBST_SED.pkgconf-prefix+= -e "s|/usr/local|${PREFIX}|g"
52SUBST_MESSAGE.pkgconf-prefix= Correct the installation prefix in pkg.conf(5). 52SUBST_MESSAGE.pkgconf-prefix= Correct the installation prefix in pkg.conf(5).
53 53
54SUBST_CLASSES+= portsdir 54SUBST_CLASSES+= portsdir
55SUBST_STAGE.portsdir= pre-install 55SUBST_STAGE.portsdir= pre-install
56SUBST_FILES.portsdir= libpkg/pkg_config.c \ 56SUBST_FILES.portsdir= libpkg/pkg_config.c \
57 src/pkg.conf.sample \ 57 src/pkg.conf.sample \
58 docs/pkg-create.8 \ 58 docs/pkg-create.8 \
59 docs/pkg-set.8 \ 59 docs/pkg-set.8 \
60 docs/pkg-repo.8 \ 60 docs/pkg-repo.8 \
61 docs/pkg.conf.5 \ 61 docs/pkg.conf.5 \
62 docs/pkg-version.8 \ 62 docs/pkg-version.8 \
63 docs/pkg.8 63 docs/pkg.8
64SUBST_SED.portsdir= -e "s|/usr/ports|${PORTSDIR}|g" \ 64SUBST_SED.portsdir= -e "s|/usr/ports|${PKG.portsdir}|g" \
65 -e "s|/var/db/pkg|/var/db/pkgng|g" \ 65 -e "s|/var/db/pkg|/var/db/pkgng|g" \
66 -e "s|/var/cache/pkg|/var/cache/pkgng|g" 66 -e "s|/var/cache/pkg|/var/cache/pkgng|g"
67SUBST_MESSAGE.portsdir= Correct reference to FreeBSD portsdir. 67SUBST_MESSAGE.portsdir= Correct reference to FreeBSD portsdir.
68 68
69.if defined(PACKAGE_BUILDING) # set by Synth which has custom location, so use default path 69.if defined(PACKAGE_BUILDING) # set by Synth which has custom location, so use default path
70PORTSDIR= /usr/pkgsrc 70PKG.portsdir?= /usr/pkgsrc
71.else 71.else
72PORTSDIR= ${PKGSRCDIR} 72PKG.portsdir?= ${PKGSRCDIR}
73.endif 73.endif
74 74
75# DragonFly SSL libraries are private. pkg(8) is the one exception of a userland 75# DragonFly SSL libraries are private. pkg(8) is the one exception of a userland
76# program that is allowed to link to them due to bootstrap reasons 76# program that is allowed to link to them due to bootstrap reasons
77.if exists(/usr/lib/priv/libprivate_ssl.so) 77.if exists(/usr/lib/priv/libprivate_ssl.so)
78BUILDLINK_PASSTHRU_RPATHDIRS= /lib/priv 78BUILDLINK_PASSTHRU_RPATHDIRS= /lib/priv
79.endif 79.endif
80 80
81post-patch: 81post-patch:
82 ${CP} ${FILESDIR}/readpassphrase_compat.h \ 82 ${CP} ${FILESDIR}/readpassphrase_compat.h \
83 ${WRKSRC}/src/ 83 ${WRKSRC}/src/
84 84
85# DragonFly SSL libraries are private. 85# DragonFly SSL libraries are private.