summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2016-12-17 23:41:51 +0000
committerjoerg <joerg@pkgsrc.org>2016-12-17 23:41:51 +0000
commitd36ec83762676256a3deb0608f9c948d4c863afb (patch)
treec757fd2116e20eaaaad5ba1210560d673c5c9d58 /mk
parente004920a7893f54f29ec01143775aff9f3301b9a (diff)
downloadpkgsrc-d36ec83762676256a3deb0608f9c948d4c863afb.tar.gz
Add optional caching of extracted build options. As the number of users
of this feature has exploded over recent years, this avoids quadratic complexity for many packages during scan and build phase of a bulk build. Pbulk logic for exploiting this feature will be committed separately. Over all, this saves ~66% for wm/xfce4-wm with initially empty cache and ~90% when the cache is populated. Total scan time can be cut in half.
Diffstat (limited to 'mk')
-rw-r--r--mk/pbulk/pbulk-index.mk10
-rw-r--r--mk/pkg-build-options.mk11
2 files changed, 17 insertions, 4 deletions
diff --git a/mk/pbulk/pbulk-index.mk b/mk/pbulk/pbulk-index.mk
index 45c76d642fa..61a70320be7 100644
--- a/mk/pbulk/pbulk-index.mk
+++ b/mk/pbulk/pbulk-index.mk
@@ -1,4 +1,4 @@
-# $NetBSD: pbulk-index.mk,v 1.22 2016/09/08 15:19:18 joerg Exp $
+# $NetBSD: pbulk-index.mk,v 1.23 2016/12/17 23:41:52 joerg Exp $
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to the parallel bulk build
@@ -104,6 +104,12 @@ pbulk-index:
${_PBULK_MULTI_NEEDED:@._t.@;done@}
.endif
+.if defined(PBULK_CACHE_DIRECTORY)
+_PBULK_SCAN_DEPENDS= ${.MAKE.MAKEFILES:N${PBULK_CACHE_DIRECTORY}/*}
+.else
+_PBULK_SCAN_DEPENDS= ${.MAKE.MAKEFILES}
+.endif
+
pbulk-index-item:
@echo "PKGNAME="${PKGNAME:Q}
@echo "ALL_DEPENDS="${_ALL_DEPENDS:Q}
@@ -116,7 +122,7 @@ pbulk-index-item:
@echo "USE_DESTDIR="${_USE_DESTDIR:Q}
@echo "BOOTSTRAP_PKG="${BOOTSTRAP_PKG}
@echo "USERGROUP_PHASE="${USERGROUP_PHASE:Q}
- @echo "SCAN_DEPENDS="${.MAKE.MAKEFILES:Q}
+ @echo "SCAN_DEPENDS="${_PBULK_SCAN_DEPENDS:Q}
.if defined(_PBULK_MULTI_NEEDED)
@printf "MULTI_VERSION="
.for _t in ${_PBULK_MULTI_NEEDED}
diff --git a/mk/pkg-build-options.mk b/mk/pkg-build-options.mk
index ba0417acc3f..b4de4bfdded 100644
--- a/mk/pkg-build-options.mk
+++ b/mk/pkg-build-options.mk
@@ -1,4 +1,4 @@
-# $NetBSD: pkg-build-options.mk,v 1.10 2016/07/09 09:54:27 rillig Exp $
+# $NetBSD: pkg-build-options.mk,v 1.11 2016/12/17 23:41:51 joerg Exp $
#
# This procedure determines the PKG_OPTIONS that have been in effect
# when the package ${pkgbase} has been built. When the package is not
@@ -40,13 +40,20 @@ PKG_FAIL_REASON+= "[pkg-build-options.mk] This file may only be included from a
. endfor
.else
. for b in ${pkgbase}
+. if !defined(PKG_BUILD_OPTIONS.${b}) && defined(PBULK_CACHE_DIRECTORY)
+.sinclude "${PBULK_CACHE_DIRECTORY}/build-options.${b}"
+. endif
. if !defined(PKG_BUILD_OPTIONS.${b})
PKG_BUILD_OPTIONS.${b}!= \
echo ""; \
${PKG_INFO} -Q PKG_OPTIONS ${b} 2>/dev/null \
|| { cd ${BUILDLINK_PKGSRCDIR.${b}} \
&& ${MAKE} ${MAKEFLAGS} show-var VARNAME=PKG_OPTIONS; }
-
+. if defined(PBULK_CACHE_DIRECTORY)
+_PKG_BUILD_OPTIONS.${b}!= \
+ echo PKG_BUILD_OPTIONS.${b:Q}=${PKG_BUILD_OPTIONS.${b:Q}} > ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}.$$$$; \
+ mv ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}.$$$$ ${PBULK_CACHE_DIRECTORY:Q}/build-options.${pkgbase}
+. endif
MAKEFLAGS+= PKG_BUILD_OPTIONS.${b}=${PKG_BUILD_OPTIONS.${b}:Q}
. endif