diff options
Diffstat (limited to 'mk/flavor/pkg/depends.mk')
-rw-r--r-- | mk/flavor/pkg/depends.mk | 188 |
1 files changed, 78 insertions, 110 deletions
diff --git a/mk/flavor/pkg/depends.mk b/mk/flavor/pkg/depends.mk index 026580ab1fd..1e74fddeceb 100644 --- a/mk/flavor/pkg/depends.mk +++ b/mk/flavor/pkg/depends.mk @@ -1,23 +1,31 @@ -# $NetBSD: depends.mk,v 1.26 2007/03/19 16:43:59 joerg Exp $ - -_DEPENDS_FILE= ${WRKDIR}/.depends -_REDUCE_DEPENDS_CMD= ${SETENV} CAT=${CAT:Q} \ - PKG_ADMIN=${PKG_ADMIN_CMD:Q} \ - PWD_CMD=${PWD_CMD:Q} TEST=${TEST:Q} \ - ${AWK} -f ${PKGSRCDIR}/mk/flavor/pkg/reduce-depends.awk +# $NetBSD: depends.mk,v 1.27 2007/05/22 16:17:16 joerg Exp $ # This command prints out the dependency patterns for all full (run-time) # dependencies of the package. # # This is used in install.mk and metadata.mk. # -_DEPENDS_PATTERNS_CMD= \ - [ ! -f ${_COOKIE.depends} ] \ - || ${AWK} '$$1 == "full" { print $$2; }' < ${_COOKIE.depends} -_BUILD_DEPENDS_PATTERNS_CMD= \ - [ ! -f ${_COOKIE.depends} ] \ - || ${AWK} '$$1 == "build" { print $$2; }' < ${_COOKIE.depends} +# ${_DEPENDS_FILE} contains all the dependency information +# for the package. The format of each line of the file is: +# +# <depends_type> <pattern> <directory> +# +# Valid dependency types are "bootstrap", "build" and "full". +# +# ${_RDEPENDS_FILE} contains the resolved dependency information +# for the package. For each line in ${_DEPENDS_FILE} +# a corresponding line of the following form exists: +# +# <depends_type> <pattern> <pkg> +# +# "pkg" is the match for "pattern" used to fulfill the dependency. +# +_DEPENDS_FILE= ${WRKDIR}/.depends +_RDEPENDS_FILE= ${WRKDIR}/.rdepends + +_FULL_DEPENDS_CMD= \ + ${AWK} '$$1 == "full" { print $$3; }' < ${_RDEPENDS_FILE} _flavor-show-depends: .PHONY @case ${VARNAME:Q}"" in \ @@ -25,59 +33,61 @@ _flavor-show-depends: .PHONY DEPENDS|*) ${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} ;; \ esac -###################################################################### -### depends-cookie (PRIVATE, pkgsrc/mk/depends/bsd.depends.mk) -###################################################################### -### depends-cookie creates the "depends" cookie file. -### -### The "depends" cookie file contains all of the dependency information -### for the package. The format of each line of the cookie file is: -### -### <depends_type> <pattern> <directory> -### -### Valid dependency types are "build" and "full". -### -.PHONY: depends-cookie -depends-cookie: ${_DEPENDS_FILE} - ${RUN} [ ! -f ${_COOKIE.depends} ] - ${RUN} ${MKDIR} ${_COOKIE.depends:H} - ${RUN} ${MV} -f ${_DEPENDS_FILE} ${_COOKIE.depends} +_LIST_DEPENDS_CMD= \ + ${SETENV} AWK=${AWK:Q} PKG_ADMIN=${PKG_ADMIN:Q} \ + PKGSRCDIR=${PKGSRCDIR:Q} PWD_CMD=${PWD_CMD:Q} SED=${SED:Q} \ + ${SH} ${PKGSRCDIR}/mk/flavor/pkg/list-dependencies \ + " "${BOOTSTRAP_DEPENDS:Q} \ + " "${BUILD_DEPENDS:Q} \ + " "${DEPENDS:Q} + +_RESOLVE_DEPENDS_CMD= \ + ${SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} PKG_ADMIN=${PKG_ADMIN:Q} \ + _DEPENDS_FILE=${_DEPENDS_FILE:Q} \ + ${SH} ${PKGSRCDIR}/mk/flavor/pkg/resolve-dependencies \ + " "${BOOTSTRAP_DEPENDS:Q} \ + " "${BUILD_DEPENDS:Q} \ + " "${DEPENDS:Q} + +_INSTALL_DEPENDS_CMD= \ + ${SETENV} _PKG_DBDIR=${_PKG_DBDIR:Q} \ + _PKGSRC_DEPS=${_PKSRC_DEPS:Q} \ + _DEPENDS_FILE=${_DEPENDS_FILE:Q} \ + DEPENDS_TARGET=${DEPENDS_TARGET:Q} \ + MAKE=${MAKE:Q} \ + MAKEFLAGS=${MAKEFLAGS:Q} \ + OBJECT_FMT=${OBJECT_FMT:Q} \ + PKG_ADMIN=${PKG_ADMIN_CMD:Q} \ + PKG_INFO=${PKG_INFO:Q} \ + _PKGNAME=${PKGNAME:Q} \ + PKGSRC_MAKE_ENV=${PKGSRC_MAKE_ENV:Q} \ + SETENV=${SETENV:Q} \ + ${SH} ${PKGSRCDIR}/mk/flavor/pkg/install-dependencies + +bootstrap-depends: ${_DEPENDS_FILE} ${_DEPENDS_FILE}: ${RUN} ${MKDIR} ${.TARGET:H} - ${RUN} ${_REDUCE_DEPENDS_CMD} ${BOOTSTRAP_DEPENDS:Q}\ ${BUILD_DEPENDS:Q} > ${.TARGET}.build - ${RUN} \ - exec 0< ${.TARGET}.build; \ - while read dep; do \ - pattern=`${ECHO} "$$dep" | ${SED} -e "s,:.*,,"`; \ - dir=`${ECHO} "$$dep" | ${SED} -e "s,.*:,,"`; \ - [ "$$pattern" ]; \ - [ "$$dir" ]; \ - ${ECHO} "build $$pattern $$dir"; \ - done >> ${.TARGET}.tmp - ${RUN} ${_REDUCE_DEPENDS_CMD} ${DEPENDS:Q} > ${.TARGET}.full - ${RUN} \ - exec 0< ${.TARGET}.full; \ - while read dep; do \ - pattern=`${ECHO} "$$dep" | ${SED} -e "s,:.*,,"`; \ - dir=`${ECHO} "$$dep" | ${SED} -e "s,.*:,,"`; \ - [ "$$pattern" ]; \ - [ "$$dir" ]; \ - ${ECHO} "full $$pattern $$dir"; \ - done >> ${.TARGET}.tmp - ${RUN} ${MV} ${.TARGET}.tmp ${.TARGET} + ${RUN} ${_LIST_DEPENDS_CMD} > ${.TARGET} + +${_RDEPENDS_FILE}: ${_DEPENDS_FILE} + ${RUN} ${_RESOLVE_DEPENDS_CMD} > ${.TARGET} + +# _flavor-list-dependencies: +# Compute dependency list. +# +_flavor-list-dependencies: .PHONY ${_DEPENDS_FILE} # _flavor-install-dependencies: # Installs any missing dependencies. # _flavor-install-dependencies: .PHONY ${_DEPENDS_FILE} - ${RUN} \ - while read type pattern dir rest; do \ - { [ "$$dir" ] && [ ! "$$rest" ]; } \ - || ${FAIL_MSG} "[depends.mk] Internal error #1: Check ${_DEPENDS_FILE}"; \ - silent=; \ - ${_DEPENDS_INSTALL_CMD}; \ - done < ${_DEPENDS_FILE} + ${RUN}${_INSTALL_DEPENDS_CMD} + +# _flavor-post-install-dependencies: +# Targets after installing all dependencies. +# +_flavor-post-install-dependencies: .PHONY ${_RDEPENDS_FILE} ###################################################################### ### bootstrap-depends (PUBLIC, pkgsrc/mk/depends/depends.mk) @@ -87,55 +97,13 @@ _flavor-install-dependencies: .PHONY ${_DEPENDS_FILE} ### stage. These dependencies are listed in BOOTSTRAP_DEPENDS. ### .PHONY: bootstrap-depends -bootstrap-depends: - ${_PKG_SILENT}${_PKG_DEBUG}set -e; \ - args=${BOOTSTRAP_DEPENDS:S/:/ /:Q}; \ - set -- dummy $$args; shift; \ - while ${TEST} $$# -gt 0; do \ - pattern="$$1"; dir="$$2"; shift 2; \ - silent=${_BOOTSTRAP_VERBOSE:Dyes}; \ - ${_DEPENDS_INSTALL_CMD}; \ - done - -# _DEPENDS_INSTALL_CMD expects "$pattern" to hold the dependency pattern -# and "$dir" to hold the package directory path associated with -# that dependency pattern. -# -_DEPENDS_INSTALL_CMD= \ - pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \ - case "$$pkg" in \ - "") \ - ${STEP_MSG} "Required installed package $$pattern: NOT found"; \ - target=${DEPENDS_TARGET:Q}; \ - ${STEP_MSG} "Verifying $$target for $$dir"; \ - if ${TEST} ! -d "$$dir"; then \ - ${ERROR_MSG} "[depends.mk] The directory \`\`$$dir'' does not exist."; \ - exit 1; \ - fi; \ - cd $$dir; \ - ${SETENV} ${PKGSRC_MAKE_ENV} _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" PKGNAME_REQD="$$pattern" ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $$target; \ - pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`; \ - case "$$pkg" in \ - "") ${ERROR_MSG} "[depends.mk] A package matching \`\`$$pattern'' should"; \ - ${ERROR_MSG} " be installed, but one cannot be found. Perhaps there is a"; \ - ${ERROR_MSG} " stale work directory for $$dir?"; \ - exit 1; \ - esac; \ - ${STEP_MSG} "Returning to build of ${PKGNAME}"; \ - ;; \ - *) \ - objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`; \ - case "$$objfmt" in \ - "") ${WARNING_MSG} "[depends.mk] Unknown object format for installed package $$pkg" ;; \ - ${OBJECT_FMT}) ;; \ - *) ${ERROR_MSG} "[depends.mk] Installed package $$pkg has an"; \ - ${ERROR_MSG} " object format \`\`$$objfmt'' which differs from \`\`${OBJECT_FMT}''. Please"; \ - ${ERROR_MSG} " update the $$pkg package to ${OBJECT_FMT}."; \ - exit 1; \ - ;; \ - esac; \ - if ${TEST} -z "$$silent"; then \ - ${STEP_MSG} "Required installed package $$pattern: $$pkg found"; \ - fi; \ - ;; \ - esac +_BOOTSTRAP_DEPENDS_TARGETS+= acquire-bootstrap-depends-lock +_BOOTSTRAP_DEPENDS_TARGETS+= ${_DEPENDS_FILE} +_BOOTSTRAP_DEPENDS_TARGETS+= release-bootstrap-depends-lock + +bootstrap-depends: ${_BOOTSTRAP_DEPENDS_TARGETS} + ${RUN}${_INSTALL_DEPENDS_CMD} bootstrap + +.PHONY: +acquire-bootstrap-depends-lock: acquire-lock +release-bootstrap-depends-lock: release-lock |