pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Introduce concept of the "phase" that we're in as w...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5ed0f6c2c0ab
branches:  trunk
changeset: 466635:5ed0f6c2c0ab
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Jan 21 18:13:27 2004 +0000

description:
Introduce concept of the "phase" that we're in as we progress through
fetching, extracting, configuring, building, etc. of a package.  We
can check what phase we're in by examining the value of ${PKG_PHASE}
and comparing against PHASES_AFTER_<phase>, which list phases that
are "greater than or equal to" <phase>.

One useful example of how to use PKG_PHASE is:

.if !empty(PHASES_AFTER_EXTRACT:${PKG_PHASE})
#
# Some variable settings or targets here that rely on dependencies to
# already be installed, or ${WRKDIR} to be created, etc., as these are
# things that should have happened by the time "make extract" is
# completed.
#
.endif

diffstat:

 mk/bsd.pkg.mk   |  20 ++++++++++----------
 mk/bsd.prefs.mk |  16 +++++++++++++++-
 2 files changed, 25 insertions(+), 11 deletions(-)

diffs (98 lines):

diff -r 47e58358676a -r 5ed0f6c2c0ab mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed Jan 21 17:43:55 2004 +0000
+++ b/mk/bsd.pkg.mk     Wed Jan 21 18:13:27 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1350 2004/01/20 22:15:21 snj Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1351 2004/01/21 18:13:27 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -3135,17 +3135,17 @@
        @${TOUCH} ${INTERACTIVE_COOKIE}
        @${FALSE}
 .else
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-extract DEPENDS_TARGET=${DEPENDS_TARGET}
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-extract DEPENDS_TARGET=${DEPENDS_TARGET} PKG_PHASE=extract
 .endif
 
 ${PATCH_COOKIE}:
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-patch
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-patch PKG_PHASE=patch
 
 ${TOOLS_COOKIE}:
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-tools
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-tools PKG_PHASE=tools
 
 ${BUILDLINK_COOKIE}:
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-buildlink
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-buildlink PKG_PHASE=buildlink
 
 ${CONFIGURE_COOKIE}:
 .if ${INTERACTIVE_STAGE:Mconfigure} == "configure" && defined(BATCH)
@@ -3154,7 +3154,7 @@
        @${TOUCH} ${INTERACTIVE_COOKIE}
        @${FALSE}
 .else
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-configure
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure
 .endif
 
 ${BUILD_COOKIE}:
@@ -3164,11 +3164,11 @@
        @${TOUCH} ${INTERACTIVE_COOKIE}
        @${FALSE}
 .else
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-build
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-build PKG_PHASE=build
 .endif
 
 ${TEST_COOKIE}:
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-test
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-test PKG_PHASE=test
 
 ${INSTALL_COOKIE}:
 .if ${INTERACTIVE_STAGE:Minstall} == "install" && defined(BATCH)
@@ -3177,11 +3177,11 @@
        @${TOUCH} ${INTERACTIVE_COOKIE}
        @${FALSE}
 .else
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-install
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-install PKG_PHASE=install
 .endif
 
 ${PACKAGE_COOKIE}:
-       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-package
+       ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} real-package PKG_PHASE=package
 
 .PHONY: extract-message patch-message tools-message buildlink-message
 .PHONY: configure-message build-message test-message
diff -r 47e58358676a -r 5ed0f6c2c0ab mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk   Wed Jan 21 17:43:55 2004 +0000
+++ b/mk/bsd.prefs.mk   Wed Jan 21 18:13:27 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.139 2003/12/28 11:23:28 agc Exp $
+# $NetBSD: bsd.prefs.mk,v 1.140 2004/01/21 18:13:27 jlam Exp $
 #
 # Make file, included to get the site preferences, if any.  Should
 # only be included by package Makefiles before any .if defined()
@@ -238,6 +238,20 @@
 .  include "${.CURDIR}/mk/defs.NetBSD.mk"
 .endif
 
+PKG_PHASE?=            none
+#
+# The PHASES_AFTER_<phase> variables list every phase "greater than or
+# equal to" <phase>.
+#
+PHASES_AFTER_EXTRACT=  extract ${PHASES_AFTER_PATCH}
+PHASES_AFTER_PATCH=    patch ${PHASES_AFTER_TOOLS}
+PHASES_AFTER_TOOLS=    tools ${PHASES_AFTER_BUILDLINK}
+PHASES_AFTER_BUILDLINK=        buildlink ${PHASES_AFTER_CONFIGURE}
+PHASES_AFTER_CONFIGURE=        configure ${PHASES_AFTER_BUILD}
+PHASES_AFTER_BUILD=    build ${PHASES_AFTER_INSTALL}
+PHASES_AFTER_INSTALL=  install ${PHASES_AFTER_PACKAGE}
+PHASES_AFTER_PACKAGE=  package
+
 # if the system is IPv6-ready, compile with IPv6 support turned on.
 .if defined(USE_INET6)
 .  if empty(USE_INET6:M[Yy][Ee][Ss]) || defined(USE_SOCKS)



Home | Main Index | Thread Index | Old Index