pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Flatten out recursive makes into a single re-invoca...
details: https://anonhg.NetBSD.org/pkgsrc/rev/c2d1b8f4db52
branches: trunk
changeset: 515658:c2d1b8f4db52
user: jlam <jlam%pkgsrc.org@localhost>
date: Wed Jul 05 22:21:02 2006 +0000
description:
Flatten out recursive makes into a single re-invocation of make by
introducing the concept of a "barrier". We separate the user-invokable
targets into ones that must happen before the barrier, and ones that
must happen after the barrier. The ones that happen after the barrier
are run in a sub-make process. In this case, the targets that must
be run after the barrier are from the "wrapper" step and beyond. We
rewrite the various "flow" targets, e.g. wrapper, configure, build,
etc., so that they of the right form to use the barrier target.
This now completely removes the concept of PKG_PHASE from pkgsrc. It
is replaced with the concept of "before" and "after" the barrier, and
this state can be checked by testing for the existence of the barrier
cookie file. Because we've removed most of the recursive makes, there
is now nowhere to hook the PKG_ERROR_HANDLER.* commands, so remove
them for now.
As part of this commit, put back the logic that conditionalized the
sources for the various cookie files. Because the sources are all
"phony" targets, they were always run, regardless of whether or not
the cookie file already existed. Now, if a cookie file exists, then
that entire phase associated with that cookie file is skipped.
Lastly, fix a thinko in configure/bsd.configure.mk where setting
NO_CONFIGURE in a package Makefile would manage to skip the "wrapper"
step altogether. Fix this by correctly noting "wrapper" and not
"patch" as the preceding step to "configure".
diffstat:
mk/bsd.pkg.barrier.mk | 59 +++++++++++++++++++++++++++++++++++++++++
mk/bsd.pkg.mk | 5 ++-
mk/build/bsd.build.mk | 13 +++++---
mk/build/build.mk | 28 ++++++------------
mk/buildlink3/bsd.buildlink3.mk | 27 ++++-------------
mk/configure/bsd.configure.mk | 15 ++++++----
mk/configure/configure.mk | 34 ++++++-----------------
mk/depends/bsd.depends.mk | 16 ++++++----
mk/depends/depends.mk | 13 ++++++--
mk/extract/extract.mk | 13 ++++++--
mk/install/bsd.install.mk | 13 +++++---
mk/install/install.mk | 25 ++++++++++------
mk/install/replace.mk | 6 +++-
mk/package/bsd.package.mk | 13 +++++---
mk/package/package.mk | 22 +++++++++------
mk/patch/patch.mk | 13 ++++++--
mk/pkginstall/bsd.pkginstall.mk | 12 +------
mk/tools/bsd.tools.mk | 13 ++++++--
mk/wrapper/bsd.wrapper.mk | 30 +++++++++++++-------
19 files changed, 222 insertions(+), 148 deletions(-)
diffs (truncated from 807 to 300 lines):
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/bsd.pkg.barrier.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/bsd.pkg.barrier.mk Wed Jul 05 22:21:02 2006 +0000
@@ -0,0 +1,59 @@
+# $NetBSD: bsd.pkg.barrier.mk,v 1.1 2006/07/05 22:21:02 jlam Exp $
+
+_BARRIER_COOKIE= ${WRKDIR}/.barrier_cookie
+
+# _BARRIER_POST_TARGETS is a list of the targets that must be built after
+# the "barrier" target invokes a new make.
+#
+_BARRIER_PRE_TARGETS= patch
+_BARRIER_POST_TARGETS= wrapper configure build install package
+
+# These targets have the "main" targets as sources, and so they must also
+# be barrier-aware.
+#
+_BARRIER_POST_TARGETS+= test
+_BARRIER_POST_TARGETS+= reinstall repackage
+_BARRIER_POST_TARGETS+= replace
+
+######################################################################
+### barrier (PRIVATE)
+######################################################################
+### barrier is a helper target that can be used to separate targets
+### that should be built in a new make process from being built in
+### the current one. The targets that must be built after the "barrier"
+### target invokes a new make should be listed in _BARRIER_POST_TARGETS,
+### and should be of the form:
+###
+### .if !exists(${_BARRIER_COOKIE})
+### foo: barrier
+### .else
+### foo: foo's real source dependencies
+### .endif
+###
+### Note that none of foo's real source dependencies should include
+### targets that occur before the barrier.
+###
+.PHONY: barrier
+barrier: ${_BARRIER_PRE_TARGETS} barrier-cookie
+.if !exists(${_BARRIER_COOKIE})
+. for _target_ in ${_BARRIER_POST_TARGETS}
+. if make(${_target_})
+. if defined(PKG_VERBOSE)
+ @${PHASE_MSG} "Invoking \`\`"${_target_:Q}"'' after barrier for ${PKGNAME}"
+. endif
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} ALLOW_VULNERABLE_PACKAGES= ${_target_}
+. if defined(PKG_VERBOSE)
+ @${PHASE_MSG} "Leaving \`\`"${_target_:Q}"'' after barrier for ${PKGNAME}"
+. endif
+. endif
+. endfor
+.endif
+
+######################################################################
+### barrier-cookie (PRIVATE)
+######################################################################
+### barrier-cookie creates the "barrier" cookie file.
+###
+barrier-cookie:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${_BARRIER_COOKIE:H}
+ ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${PKGNAME} > ${_BARRIER_COOKIE}
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Wed Jul 05 21:45:05 2006 +0000
+++ b/mk/bsd.pkg.mk Wed Jul 05 22:21:02 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1858 2006/07/05 06:09:15 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1859 2006/07/05 22:21:02 jlam Exp $
#
# This file is in the public domain.
#
@@ -463,6 +463,9 @@
# Tools
.include "../../mk/tools/bsd.tools.mk"
+# Barrier
+.include "../../mk/bsd.pkg.barrier.mk"
+
# Unprivileged builds
.include "../../mk/unprivileged.mk"
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/build/bsd.build.mk
--- a/mk/build/bsd.build.mk Wed Jul 05 21:45:05 2006 +0000
+++ b/mk/build/bsd.build.mk Wed Jul 05 22:21:02 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.build.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: bsd.build.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to building sources for a package.
@@ -22,12 +22,15 @@
### build is a public target to build the sources for the package.
###
.PHONY: build
-.if defined(NO_BUILD)
-. if !target(build)
+.if !defined(NO_BUILD)
+. include "${PKGSRCDIR}/mk/build/build.mk"
+.elif !target(build)
+. if exists(${_BUILD_COOKIE})
+build:
+ @${DO_NADA}
+. else
build: configure build-cookie
. endif
-.else
-. include "${PKGSRCDIR}/mk/build/build.mk"
.endif
.include "${PKGSRCDIR}/mk/build/test.mk"
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/build/build.mk
--- a/mk/build/build.mk Wed Jul 05 21:45:05 2006 +0000
+++ b/mk/build/build.mk Wed Jul 05 22:21:02 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: build.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: build.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# BUILD_MAKE_FLAGS is the list of arguments that is passed to the make
# process.
@@ -23,11 +23,13 @@
.PHONY: build
.if !target(build)
-. if !exists(${_BUILD_COOKIE})
+. if exists(${_BUILD_COOKIE})
+build:
+ @${DO_NADA}
+. elif exists(${_BARRIER_COOKIE})
build: ${_BUILD_TARGETS}
. else
-build:
- @${DO_NADA}
+build: barrier
. endif
.endif
@@ -35,21 +37,11 @@
acquire-build-lock: acquire-lock
release-build-lock: release-lock
+.if exists(${_BUILD_COOKIE})
${_BUILD_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-build PKG_PHASE=build || ${PKG_ERROR_HANDLER.build}
-
-PKG_ERROR_CLASSES+= build
-PKG_ERROR_MSG.build= \
- "" \
- "There was an error during the \`\`build'' phase." \
- "Please investigate the following for more information:" \
- " * log of the build" \
- " * ${WRKLOG}" \
- ""
-.if defined(BROKEN_IN)
-PKG_ERROR_MSG.build+= \
- " * This package is broken in ${BROKEN_IN}." \
- " * It may be removed in the next branch unless fixed."
+ @${DO_NADA}
+.else
+${_BUILD_COOKIE}: real-build
.endif
######################################################################
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk Wed Jul 05 21:45:05 2006 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk Wed Jul 05 22:21:02 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.179 2006/06/09 06:02:33 rillig Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.180 2006/07/05 22:21:02 jlam Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -163,19 +163,6 @@
BUILDLINK_DEPMETHOD.${_pkg_}?= full
.endfor
-# We skip the dependency calculation for some phases since they never
-# use the dependency information.
-#
-_BLNK_PHASES_SKIP_DEPENDS= configure build test
-_BLNK_PHASES_RECURSIVE_DEPENDS= none
-.if !empty(_BLNK_PHASES_SKIP_DEPENDS:M${PKG_PHASE})
-_BLNK_DEPENDS_LIST= # empty
-.elif !empty(_BLNK_PHASES_RECURSIVE_DEPENDS:M${PKG_PHASE})
-_BLNK_DEPENDS_LIST= ${_BLNK_RECURSIVE_DEPENDS}
-.else
-_BLNK_DEPENDS_LIST= ${_BLNK_DEPENDS}
-.endif
-
# Add the proper dependency on each package pulled in by buildlink3.mk
# files. BUILDLINK_DEPMETHOD.<pkg> contains a list of either "full" or
# "build", and if any of that list is "full" then we use a full dependency
@@ -185,7 +172,7 @@
_BLNK_ADD_TO.BUILD_DEPENDS= # empty
_BLNK_ADD_TO.ABI_DEPENDS= # empty
_BLNK_ADD_TO.BUILD_ABI_DEPENDS= # empty
-.for _pkg_ in ${_BLNK_DEPENDS_LIST}
+.for _pkg_ in ${_BLNK_DEPENDS}
. if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
_BLNK_DEPMETHOD.${_pkg_}= _BLNK_ADD_TO.DEPENDS
_BLNK_ABIMETHOD.${_pkg_}= _BLNK_ADD_TO.ABI_DEPENDS
@@ -214,12 +201,12 @@
. if !empty(_BLNK_ADD_TO.${_depmethod_})
${_depmethod_}+= ${_BLNK_ADD_TO.${_depmethod_}}
. endif
-.endfor # _BLNK_DEPENDS_LIST
+.endfor # _BLNK_DEPENDS
###
-### BEGIN: after "wrapper" phase
+### BEGIN: after the barrier
###
-.if !empty(PHASES_AFTER_WRAPPER:M${PKG_PHASE})
+.if exists(${_BARRIER_COOKIE})
# Generate default values for:
#
@@ -1081,7 +1068,7 @@
@${DO_NADA}
.endif
-.endif # PHASES_AFTER_WRAPPER
+.endif
###
-### END: after "wrapper" phase
+### END: after the barrier
###
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/configure/bsd.configure.mk
--- a/mk/configure/bsd.configure.mk Wed Jul 05 21:45:05 2006 +0000
+++ b/mk/configure/bsd.configure.mk Wed Jul 05 22:21:02 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.configure.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: bsd.configure.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to configuring packages for building.
@@ -20,12 +20,15 @@
### configure is a public target to configure the software for building.
###
.PHONY: configure
-.if defined(NO_CONFIGURE)
-. if !target(configure)
-configure: patch configure-cookie
+.if !defined(NO_CONFIGURE)
+. include "${PKGSRCDIR}/mk/configure/configure.mk"
+.elif !target(configure)
+. if exists(${_CONFIGURE_COOKIE})
+configure:
+ @${DO_NADA}
+. else
+configure: wrapper configure-cookie
. endif
-.else
-. include "${PKGSRCDIR}/mk/configure/configure.mk"
.endif
######################################################################
diff -r d630fa2c9a43 -r c2d1b8f4db52 mk/configure/configure.mk
--- a/mk/configure/configure.mk Wed Jul 05 21:45:05 2006 +0000
+++ b/mk/configure/configure.mk Wed Jul 05 22:21:02 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: configure.mk,v 1.2 2006/07/05 09:08:35 jlam Exp $
+# $NetBSD: configure.mk,v 1.3 2006/07/05 22:21:02 jlam Exp $
#
# CONFIGURE_SCRIPT is the path to the script to run in order to
# configure the software for building. If the path is relative,
@@ -48,11 +48,13 @@
.PHONY: configure
.if !target(configure)
-. if !exists(${_CONFIGURE_COOKIE})
+. if exists(${_CONFIGURE_COOKIE})
+configure:
+ @${DO_NADA}
+. elif exists(${_BARRIER_COOKIE})
configure: ${_CONFIGURE_TARGETS}
. else
-configure:
- @${DO_NADA}
+configure: barrier
. endif
.endif
@@ -60,29 +62,11 @@
acquire-configure-lock: acquire-lock
release-configure-lock: release-lock
+.if exists(${_CONFIGURE_COOKIE})
${_CONFIGURE_COOKIE}:
- ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${SETENV} ${BUILD_ENV} ${MAKE} ${MAKEFLAGS} real-configure PKG_PHASE=configure || ${PKG_ERROR_HANDLER.configure}
-
-PKG_ERROR_CLASSES+= configure
-PKG_ERROR_MSG.configure= \
- "" \
- "There was an error during the \`\`configure'' phase." \
- "Please investigate the following for more information:"
-.if defined(GNU_CONFIGURE)
-PKG_ERROR_MSG.configure+= \
- " * config.log" \
- " * ${WRKLOG}" \
Home |
Main Index |
Thread Index |
Old Index