summaryrefslogtreecommitdiff
path: root/mk/bsd.prefs.mk
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/bsd.prefs.mk
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/bsd.prefs.mk')
-rw-r--r--mk/bsd.prefs.mk38
1 files changed, 37 insertions, 1 deletions
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index 39077cb81eb..da3654789be 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.240 2006/10/09 11:59:08 joerg Exp $
+# $NetBSD: bsd.prefs.mk,v 1.241 2006/10/09 12:25:44 joerg Exp $
#
# Make file, included to get the site preferences, if any. Should
# only be included by package Makefiles before any .if defined()
@@ -326,6 +326,42 @@ PKG_FAIL_REASON+= "missing mk/platform/${OPSYS}.mk"
PKGDIRMODE?= 755
+# PKG_DESTDIR_SUPPORT can only be one of "destdir" or "user-destdir".
+USE_DESTDIR?= no
+PKG_DESTDIR_SUPPORT?= # empty
+
+.if empty(PKG_DESTDIR_SUPPORT) || (empty(USE_DESTDIR:M[Yy][Ee][Ss]) && empty(USE_DESTDIR:M[Ff][Uu][Ll][Ll]))
+_USE_DESTDIR= no
+.elif ${PKG_DESTDIR_SUPPORT} == "user-destdir"
+. if !empty(USE_DESTDIR:M[Ff][Uu][Ll][Ll])
+_USE_DESTDIR= user-destdir
+. else
+_USE_DESTDIR= destdir
+. endif
+.elif ${PKG_DESTDIR_SUPPORT} == "destdir"
+_USE_DESTDIR= destdir
+.else
+PKG_FAIL_REASON+= "PKG_DESTDIR_SUPPORT must be \`\`destdir'' or \`\`user-destdir''."
+.endif
+
+# When using staged installation, everything gets installed into
+# ${DESTDIR}${PREFIX} instead of ${PREFIX} directly.
+#
+.if ${_USE_DESTDIR} != "no"
+DESTDIR= ${WRKDIR}/.destdir
+. if ${_USE_DESTDIR} == "destdir"
+_MAKE_PACKAGE_AS_ROOT= yes
+_MAKE_CLEAN_AS_ROOT= yes
+_MAKE_INSTALL_AS_ROOT= yes
+. elif ${_USE_DESTDIR} == "user-destdir"
+_MAKE_PACKAGE_AS_ROOT= no
+_MAKE_CLEAN_AS_ROOT= no
+_MAKE_INSTALL_AS_ROOT= no
+. endif
+.else
+DESTDIR=
+.endif
+
_MAKE_CLEAN_AS_ROOT?= no
# Whether to run the clean target as root.
_MAKE_INSTALL_AS_ROOT?= yes