summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-03-15 16:20:11 +0000
committerjlam <jlam@pkgsrc.org>2006-03-15 16:20:11 +0000
commit47283bca00e37d3f8fe97a2a7d515ba8cafe1b29 (patch)
tree83c4e5001e87182f4b48e1036082836a09fd6b0a /mk
parentce8c6b5c7ad3bcd97d97f6abc68430d710f251f9 (diff)
downloadpkgsrc-47283bca00e37d3f8fe97a2a7d515ba8cafe1b29.tar.gz
Always run the pkginstall framework targets to generate the
INSTALL/DEINSTALL and rc.d scripts, regardless of whether NO_BUILD is defined or not. We do this by renaming the main "build" target to "_build", and creating a new "build" target that has "_build" and "pkginstall" as dependencies. This allows the "build" and "install" targets to be consecutive, so no changes in behavior are visible to the user. Because the pkginstall targets are no longer run within the protection of the locks during the build phase, we need to manage locking within a new "pkginstall" target.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk36
-rw-r--r--mk/install/bsd.pkginstall.mk28
2 files changed, 44 insertions, 20 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 47d43b76afe..e83ceb24249 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1809 2006/03/15 14:06:09 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1810 2006/03/15 16:20:11 jlam Exp $
#
# This file is in the public domain.
#
@@ -410,6 +410,16 @@ INSTALL_MACROS= BSD_INSTALL_PROGRAM=${INSTALL_PROGRAM:Q} \
MAKE_ENV+= ${INSTALL_MACROS}
SCRIPTS_ENV+= ${INSTALL_MACROS}
+# If pkgsrc is supposed to ensure that tests are run before installation
+# of the package, then the build targets should be "build test", otherwise
+# just "build" suffices.
+#
+.if !empty(PKGSRC_RUN_TEST:M[yY][eE][sS])
+_PKGSRC_BUILD_TARGETS= build test
+.else
+_PKGSRC_BUILD_TARGETS= build
+.endif
+
# The user can override the NO_PACKAGE by specifying this from
# the make command line
.if defined(FORCE_PACKAGE)
@@ -463,17 +473,6 @@ MESSAGE_SUBST+= PKGNAME=${PKGNAME} \
MESSAGE_SUBST_SED= ${MESSAGE_SUBST:S/=/}!/:S/$/!g/:S/^/ -e s!\\\${/}
.endif
-# If pkgsrc is supposed to ensure that tests are run before installation
-# of the package, then the build targets should be "build test", otherwise
-# just "build" suffices. _PKGSRC_BUILD_TARGETS is used in the "all",
-# "install", and "uptodate-digest" targets.
-#
-.if !empty(PKGSRC_RUN_TEST:M[yY][eE][sS])
-_PKGSRC_BUILD_TARGETS= build test
-.else
-_PKGSRC_BUILD_TARGETS= build
-.endif
-
.PHONY: uptodate-digest
uptodate-digest:
.if !empty(USE_DIGEST:M[yY][eE][sS])
@@ -983,8 +982,8 @@ configure: wrapper
# Disable build
.PHONY: build
-.if defined(NO_BUILD) && !target(build)
-build: configure
+.if defined(NO_BUILD)
+_build: configure
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${_BUILD_COOKIE}
.endif
@@ -2105,11 +2104,14 @@ wrapper: tools acquire-wrapper-lock ${_WRAPPER_COOKIE} release-wrapper-lock
configure: wrapper acquire-configure-lock ${_CONFIGURE_COOKIE} release-configure-lock
.endif
-.PHONY: build
-.if !target(build)
-build: configure acquire-build-lock ${_BUILD_COOKIE} release-build-lock
+.PHONY: _build
+.if !target(_build)
+_build: configure acquire-build-lock ${_BUILD_COOKIE} release-build-lock
.endif
+.PHONY: build
+build: pkginstall
+
.PHONY: test
.if !target(test)
test: build ${_TEST_COOKIE}
diff --git a/mk/install/bsd.pkginstall.mk b/mk/install/bsd.pkginstall.mk
index 55ce5233250..ee00123a236 100644
--- a/mk/install/bsd.pkginstall.mk
+++ b/mk/install/bsd.pkginstall.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkginstall.mk,v 1.41 2006/03/15 04:52:57 jlam Exp $
+# $NetBSD: bsd.pkginstall.mk,v 1.42 2006/03/15 16:20:12 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and implements the
# common INSTALL/DEINSTALL scripts framework. To use the pkginstall
@@ -725,7 +725,6 @@ _DEINSTALL_FILE_DFLT= ${_PKGINSTALL_DIR}/DEINSTALL.default
_INSTALL_FILE_DFLT= ${_PKGINSTALL_DIR}/INSTALL.default
.PHONY: generate-install-scripts
-post-build: generate-install-scripts
generate-install-scripts: \
${_DEINSTALL_FILE} ${_INSTALL_FILE} \
${_DEINSTALL_FILE_DFLT} ${_INSTALL_FILE_DFLT}
@@ -818,7 +817,6 @@ post-install-script:
# doesn't occur.
.PHONY: generate-rcd-scripts
-post-build: generate-rcd-scripts
generate-rcd-scripts: # do nothing
.PHONY: install-rcd-scripts
@@ -849,3 +847,27 @@ install-rcd-${_script_}: ${RCD_SCRIPT_WRK.${_script_}}
. endif
. endif
.endfor
+
+_PKGINSTALL_COOKIE= ${WRKDIR}/.pkginstall_done
+
+_PKGINSTALL_TARGETS+= _build
+_PKGINSTALL_TARGETS+= acquire-pkginstall-lock
+_PKGINSTALL_TARGETS+= ${_PKGINSTALL_COOKIE}
+_PKGINSTALL_TARGETS+= release-pkginstall-lock
+
+.ORDER: ${_PKGINSTALL_TARGETS}
+
+.PHONY: pkginstall
+pkginstall: ${_PKGINSTALL_TARGETS}
+
+.PHONY: acquire-pkginstall-lock release-pkginstall-lock
+acquire-pkginstall-lock:
+ ${_ACQUIRE_LOCK}
+release-pkginstall-lock:
+ ${_RELEASE_LOCK}
+
+.PHONY: do-pkginstall
+do-pkginstall: generate-rcd-scripts generate-install-scripts
+
+${_PKGINSTALL_COOKIE}: do-pkginstall
+ ${_PKG_SILENT}${_PKG_DEBUG} ${TOUCH} ${TOUCH_FLAGS} ${.TARGET}