aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2017-04-09 02:17:45 +0800
committerbapt <bapt@FreeBSD.org>2017-04-09 02:17:45 +0800
commit3b1c71447c9884af279a64fba21b676d6d5e6c81 (patch)
treed4a1c103b006fa9ab4d50050417ffa9501d9a777 /Mk/bsd.port.mk
parent812a7406515fff456dfed1f8fb764f704a3089d1 (diff)
downloadfreebsd-ports-gnome-3b1c71447c9884af279a64fba21b676d6d5e6c81.tar.gz
freebsd-ports-gnome-3b1c71447c9884af279a64fba21b676d6d5e6c81.tar.zst
freebsd-ports-gnome-3b1c71447c9884af279a64fba21b676d6d5e6c81.zip
Use native make(1) mechanism to create the package repository directory
In order to have subpackages we need in the end do-package to depend on a target per package that would be created per subpackages For this we need to decouple the content of do-package so it becomes a target that only creates the packages. As a first step use natural make(1) mechanism for a target: if checks first for the existence of a file and it it does not exists that execute the content of the target, in that case it creates the PKGREPOSITORY Bonus it simplifies a bit the code. While here to avoid testing multiple time for the PACKAGES directory set a variable after we tested it the first time PR: 216877 Approved by: portmgr (mat) Reviewed by: mat exp-run by: antoine Differential Revision: https://reviews.freebsd.org/D9466
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk31
1 files changed, 15 insertions, 16 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index db059874e12b..2b420ec26e0f 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1056,6 +1056,9 @@ STAGEDIR?= ${WRKDIR}/stage
NOTPHONY?=
MINIMAL_PKG_VERSION= 1.6.0
+_PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
+ ${STAGEDIR}${PREFIX}
+
# make sure bmake treats -V as expected
.MAKE.EXPAND_VARIABLES= yes
@@ -2502,6 +2505,7 @@ check-categories:
PKGREPOSITORYSUBDIR?= All
PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
.if exists(${PACKAGES})
+_HAVE_PACKAGES= yes
PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
.else
PKGFILE?= ${.CURDIR}/${PKGNAME}${PKG_SUFX}
@@ -2936,9 +2940,6 @@ options-message:
@${ECHO_MSG} "===> Found saved configuration for ${_OPTIONS_READ}"
.endif
-${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR}:
- @${MKDIR} ${.TARGET}
-
# Warn user about deprecated packages. Advisory only.
.if !target(check-deprecated)
@@ -3090,7 +3091,7 @@ clean-wrkdir:
@${RM} -r ${WRKDIR}
.if !target(do-extract)
-do-extract:
+do-extract: ${EXTRACT_WRKDIR}
@for file in ${EXTRACT_ONLY}; do \
if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
then \
@@ -3333,21 +3334,17 @@ do-test:
# Package
+.if defined(_HAVE_PACKAGES)
+_EXTRA_PACKAGE_TARGET_DEP= ${PKGREPOSITORY}
+_PORTS_DIRECTORIES+= ${PKGREPOSITORY}
+.endif
+
.if !target(do-package)
PKG_CREATE_ARGS= -r ${STAGEDIR} -m ${METADIR} -p ${TMPPLIST}
.if defined(PKG_CREATE_VERBOSE)
PKG_CREATE_ARGS+= -v
.endif
-do-package: create-manifest
-do-package: ${TMPPLIST}
- @if [ -d ${PACKAGES} ]; then \
- if [ ! -d ${PKGREPOSITORY} ]; then \
- if ! ${MKDIR} ${PKGREPOSITORY}; then \
- ${ECHO_MSG} "=> Can't create directory ${PKGREPOSITORY}."; \
- exit 1; \
- fi; \
- fi; \
- fi
+do-package: create-manifest ${_EXTRA_PACKAGE_TARGET_DEP} ${TMPPLIST}
@for cat in ${CATEGORIES}; do \
${RM} ${PACKAGES}/$$cat/${PKGNAMEPREFIX}${PORTNAME}*${PKG_SUFX} ; \
done
@@ -4531,8 +4528,7 @@ compress-man:
.endif
.if !target(stage-dir)
-stage-dir:
- @${MKDIR} ${STAGEDIR}${PREFIX}
+stage-dir: ${STAGEDIR}${PREFIX}
.if !defined(NO_MTREE)
@${MTREE_CMD} ${MTREE_ARGS} ${STAGEDIR}${PREFIX} > /dev/null
.endif
@@ -5186,6 +5182,9 @@ show-dev-errors:
.endif
.endif #DEVELOPER
+${_PORTS_DIRECTORIES}:
+ @${MKDIR} ${.TARGET}
+
# Please note that the order of the following targets is important, and
# should not be modified.