summaryrefslogtreecommitdiff
path: root/mk/flavor
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2006-10-09 12:25:44 +0000
committerjoerg <joerg@pkgsrc.org>2006-10-09 12:25:44 +0000
commit5b374e445d1af7cb5c191eded8e436c25ef84c54 (patch)
tree9814d8b785561d4625d3535aa344ea9c5b84ef85 /mk/flavor
parenta8e70089029ef60b4f74d3451dfa967cab20e71e (diff)
downloadpkgsrc-5b374e445d1af7cb5c191eded8e436c25ef84c54.tar.gz
Main infrastructure for DESTDIR support.
Packages may set PKG_DESTDIR_SUPPORT to either "destdir" or "user-destdir" to flag support for this, following the same rules as PKG_INSTALLATION_TYPES (e.g. define before first include of bsd.prefs.mk). The user activates it via USE_DESTDIR. When set to "yes", packages with "user-destdir" are handled as "destdir". The installation of the package will not go to ${LOCALBASE}, but a subdirectory of ${WRKDIR} instead. pre/post install scripts are not run and the package is not registered either. A binary package can be created instead to be installed normally with pkg_add. For "user-destdir" packages, everything is run as normal user and ownership is supposed to be correctled by pkg_create later. Since the current pkg_install code uses pax and it doesn't allow overwriting owners, this does not work yet. For "destdir" packages, installation, packaging and cleaning is run as root. This commit does not change the handling of DEPENDS_TARGET or bin-install to allow recursive usage.
Diffstat (limited to 'mk/flavor')
-rw-r--r--mk/flavor/pkg/metadata.mk16
-rw-r--r--mk/flavor/pkg/package.mk8
2 files changed, 16 insertions, 8 deletions
diff --git a/mk/flavor/pkg/metadata.mk b/mk/flavor/pkg/metadata.mk
index 17576364edd..98c5f701f99 100644
--- a/mk/flavor/pkg/metadata.mk
+++ b/mk/flavor/pkg/metadata.mk
@@ -1,4 +1,4 @@
-# $NetBSD: metadata.mk,v 1.11 2006/10/08 20:25:43 rillig Exp $
+# $NetBSD: metadata.mk,v 1.12 2006/10/09 12:25:44 joerg Exp $
######################################################################
### The targets below are all PRIVATE.
@@ -61,14 +61,14 @@ ${_BUILD_INFO_FILE}: plist
"") ldd=`${TYPE} ldd 2>/dev/null | ${AWK} '{ print $$NF }'` ;; \
*) ldd=${LDD:Q} ;; \
esac; \
- bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
+ bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
case ${OBJECT_FMT:Q}"" in \
ELF) \
- libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
+ libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
if ${TEST} -n "$$bins" -o -n "$$libs"; then \
requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '$$2 == "=>" && $$3 ~ "/" { print $$3 }' | ${SORT} -u`; \
fi; \
- linklibs=`${AWK} '/[^@].*\.so\.[0-9\.]+$$/ { print "${PREFIX}/" $$0 }' ${PLIST}`; \
+ linklibs=`${AWK} '/[^@].*\.so\.[0-9\.]+$$/ { print "${DESTDIR}${PREFIX}/" $$0 }' ${PLIST}`; \
for i in $$linklibs; do \
if ${TEST} -r $$i -a ! -x $$i -a ! -h $$i; then \
${TEST} ${PKG_DEVELOPER:Uno:Q} = "no" || \
@@ -78,7 +78,7 @@ ${_BUILD_INFO_FILE}: plist
done; \
;; \
Mach-O) \
- libs=`${AWK} '/(^|\/)lib\/lib.*\.dylib/ { print "${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
+ libs=`${AWK} '/(^|\/)lib\/lib.*\.dylib/ { print "${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${PLIST}`; \
if ${TEST} "$$bins" != "" -o "$$libs" != ""; then \
requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) | ${AWK} '/compatibility version/ { print $$1 }' | ${SORT} -u`; \
fi; \
@@ -301,7 +301,7 @@ ${_SIZE_PKG_FILE}: plist
/^@/ { next } \
{ print base $$0 }' | \
${SORT} -u | \
- ${SED} -e "s/'/'\\\\''/g" -e "s/.*/'&'/" | \
+ ${SED} -e "s,^/,${DESTDIR}/," -e "s/'/'\\\\''/g" -e "s/.*/'&'/" | \
${XARGS} -n 256 ${LS} -ld 2>/dev/null | \
${AWK} 'BEGIN { s = 0 } { s += $$5 } END { print s }' \
> ${.TARGET}
@@ -333,7 +333,11 @@ _PKG_CREATE_ARGS+= ${INSTALL_FILE:D ${_INSTALL_ARG_cmd:sh}}
_PKG_CREATE_ARGS+= ${DEINSTALL_FILE:D ${_DEINSTALL_ARG_cmd:sh}}
_PKG_ARGS_INSTALL+= ${_PKG_CREATE_ARGS}
+.if ${_USE_DESTDIR} == "no"
_PKG_ARGS_INSTALL+= -p ${PREFIX}
+.else
+_PKG_ARGS_INSTALL+= -I ${PREFIX} -p ${DESTDIR}${PREFIX}
+.endif
_DEPENDS_ARG_cmd= depends=`${_DEPENDS_PATTERNS_CMD}`; \
if ${TEST} -n "$$depends"; then \
diff --git a/mk/flavor/pkg/package.mk b/mk/flavor/pkg/package.mk
index d27e8b2a9cb..291cef480ca 100644
--- a/mk/flavor/pkg/package.mk
+++ b/mk/flavor/pkg/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.4 2006/10/08 20:24:03 rillig Exp $
+# $NetBSD: package.mk,v 1.5 2006/10/09 12:25:44 joerg Exp $
PKG_SUFX?= .tgz
PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
@@ -29,8 +29,12 @@ package-check-installed:
package-create: package-remove ${PKGFILE} package-links
_PKG_ARGS_PACKAGE+= ${_PKG_CREATE_ARGS}
+.if ${_USE_DESTDIR} == "no"
_PKG_ARGS_PACKAGE+= -p ${PREFIX}
-_PKG_ARGS_PACKAGE+= -L ${PREFIX} # @src ...
+.else
+_PKG_ARGS_PACKAGE+= -I ${PREFIX} -p ${DESTDIR}${PREFIX}
+.endif
+_PKG_ARGS_PACKAGE+= -L ${DESTDIR}${PREFIX} # @src ...
.if ${PKG_INSTALLATION_TYPE} == "pkgviews"
_PKG_ARGS_PACKAGE+= -E
.endif