summaryrefslogtreecommitdiff
path: root/mk/package
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-10-08 20:31:38 +0000
committerrillig <rillig@pkgsrc.org>2006-10-08 20:31:38 +0000
commit3fce7deb8065d0dab8d73fa52543914ec25ffe56 (patch)
treecdd47d1804317c7f92af614fd638ab1fe2ced7ad /mk/package
parentb52b81957abad61a5b62367d9e1dd83684754dc5 (diff)
downloadpkgsrc-3fce7deb8065d0dab8d73fa52543914ec25ffe56.tar.gz
Added a new variable MAKE_PACKAGE_AS_ROOT that controls whether the
package needs to be packed by root or whether the unprivileged user can do that as well. Most packages don't need root privileges, but the default value is nevertheless "yes" to not break too many existing packages. pkgsrc users are encouraged to add the following to their mk.conf: MAKE_PACKAGES_AS_ROOT?= no The "?=" operator here is important because after the testing phase, this variable is only intended to be set by packages. If "=" would be used instead, packages could not override the value.
Diffstat (limited to 'mk/package')
-rw-r--r--mk/package/bsd.package.mk15
-rw-r--r--mk/package/package.mk6
2 files changed, 19 insertions, 2 deletions
diff --git a/mk/package/bsd.package.mk b/mk/package/bsd.package.mk
index 4c1530f0c7b..91f4d112675 100644
--- a/mk/package/bsd.package.mk
+++ b/mk/package/bsd.package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.package.mk,v 1.7 2006/07/22 16:31:35 jlam Exp $
+# $NetBSD: bsd.package.mk,v 1.8 2006/10/08 20:31:38 rillig Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to binary packages.
@@ -7,6 +7,19 @@
#
# package, repackage
#
+# The following variables may be set by the package:
+#
+# MAKE_PACKAGE_AS_ROOT: YesNo
+# When this variable is set to "no", the package is created by
+# the user that also built the package. Since most packages don't
+# need root privileges to create the package, the default value
+# is "no". Packages that install unreadable files (for example
+# with mode 4111) need to set this variable to "yes".
+#
+# Default value: "yes", but this will change to "no" after most
+# packages that really need this option have been identified.
+
+MAKE_PACKAGE_AS_ROOT?= yes
_COOKIE.package= ${WRKDIR}/.package_done
diff --git a/mk/package/package.mk b/mk/package/package.mk
index e956f751d37..8b4920b4d13 100644
--- a/mk/package/package.mk
+++ b/mk/package/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.15 2006/07/22 16:31:35 jlam Exp $
+# $NetBSD: package.mk,v 1.16 2006/10/08 20:31:38 rillig Exp $
######################################################################
### package (PUBLIC)
@@ -83,8 +83,12 @@ _PACKAGE_ALL_TARGETS+= package-warnings
_PACKAGE_ALL_TARGETS+= error-check
.PHONY: package-all su-package-all
+.if !empty(MAKE_PACKAGE_AS_ROOT:M[Yy][Ee][Ss])
package-all: su-target
su-package-all: ${_PACKAGE_ALL_TARGETS}
+.else
+package-all: ${_PACKAGE_ALL_TARGETS}
+.endif
######################################################################
### package-check-installed (PRIVATE, override)