summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/bsd.pkg.clean.mk12
-rw-r--r--mk/bsd.prefs.mk7
-rw-r--r--mk/package/bsd.package.mk16
-rw-r--r--mk/package/package.mk8
4 files changed, 20 insertions, 23 deletions
diff --git a/mk/bsd.pkg.clean.mk b/mk/bsd.pkg.clean.mk
index 567807a7d80..0dcd21cac0d 100644
--- a/mk/bsd.pkg.clean.mk
+++ b/mk/bsd.pkg.clean.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.clean.mk,v 1.8 2006/08/09 15:31:01 jlam Exp $
+# $NetBSD: bsd.pkg.clean.mk,v 1.9 2006/10/09 11:44:06 joerg Exp $
#
# This Makefile fragment is included to bsd.pkg.mk and defines the
# relevant variables and targets for the "clean" phase.
@@ -50,7 +50,14 @@ post-clean:
.PHONY: do-clean
.if !target(do-clean)
-do-clean:
+. if !empty(_MAKE_CLEAN_AS_ROOT:M[Yy][Ee][Ss])
+do-clean: su-target
+. else
+do-clean: su-do-clean
+. endif
+.endif
+
+su-do-clean:
@${PHASE_MSG} "Cleaning for ${PKGNAME}"
${_PKG_SILENT}${_PKG_DEBUG} \
if ${TEST} -d ${WRKDIR:Q}; then \
@@ -65,7 +72,6 @@ do-clean:
${RMDIR} ${BUILD_DIR} 2>/dev/null || ${TRUE}; \
${RM} -f ${WRKDIR_BASENAME} 2>/dev/null || ${TRUE}
. endif
-.endif
_CLEAN_TARGETS+= pre-clean
.if empty(CLEANDEPENDS:M[nN][oO])
diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk
index 6a90a65c8d9..52094248522 100644
--- a/mk/bsd.prefs.mk
+++ b/mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.238 2006/10/06 14:51:36 joerg Exp $
+# $NetBSD: bsd.prefs.mk,v 1.239 2006/10/09 11:44:06 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,11 @@ PKG_FAIL_REASON+= "missing mk/platform/${OPSYS}.mk"
PKGDIRMODE?= 755
+_MAKE_CLEAN_AS_ROOT?= no
+# Whether to run the clean target as root.
+_MAKE_PACKAGE_AS_ROOT?= yes
+# Whether to run the package target as root.
+
PKG_INSTALLATION_TYPES?= overwrite
# This is a whitespace-separated list of installation types supported
# by the package.
diff --git a/mk/package/bsd.package.mk b/mk/package/bsd.package.mk
index 91f4d112675..4cf693056ca 100644
--- a/mk/package/bsd.package.mk
+++ b/mk/package/bsd.package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.package.mk,v 1.8 2006/10/08 20:31:38 rillig Exp $
+# $NetBSD: bsd.package.mk,v 1.9 2006/10/09 11:44:07 joerg Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to binary packages.
@@ -6,20 +6,6 @@
# The following are the "public" targets provided by this module:
#
# 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 8b4920b4d13..d3a9ca63530 100644
--- a/mk/package/package.mk
+++ b/mk/package/package.mk
@@ -1,4 +1,4 @@
-# $NetBSD: package.mk,v 1.16 2006/10/08 20:31:38 rillig Exp $
+# $NetBSD: package.mk,v 1.17 2006/10/09 11:44:07 joerg Exp $
######################################################################
### package (PUBLIC)
@@ -83,12 +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])
+.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}
+package-all: su-package-all
.endif
+su-package-all: ${_PACKAGE_ALL_TARGETS}
######################################################################
### package-check-installed (PRIVATE, override)