From 239f0bc9b5e72f632aa3d65a45b745d6c9df9b70 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 21 Feb 2022 07:38:47 +0200 Subject: Do lazy build system initialization only if/when actually needed --- bpkg/package-skeleton.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'bpkg/package-skeleton.cxx') diff --git a/bpkg/package-skeleton.cxx b/bpkg/package-skeleton.cxx index 76bd816..9bef69a 100644 --- a/bpkg/package-skeleton.cxx +++ b/bpkg/package-skeleton.cxx @@ -36,6 +36,9 @@ namespace bpkg extern build2::global_mutexes build2_mutexes; extern build2::file_cache build2_fcache; + void + build2_init (const common_options&); + package_skeleton:: ~package_skeleton () { @@ -52,6 +55,7 @@ namespace bpkg { if (this != &v) { + co_ = v.co_; db_ = v.db_; available_ = v.available_; config_vars_ = move (v.config_vars_); @@ -74,7 +78,8 @@ namespace bpkg package_skeleton:: package_skeleton (const package_skeleton& v) - : db_ (v.db_), + : co_ (v.co_), + db_ (v.db_), available_ (v.available_), config_vars_ (v.config_vars_), src_root_ (v.src_root_), @@ -90,12 +95,13 @@ namespace bpkg } package_skeleton:: - package_skeleton (database& db, + package_skeleton (const common_options& co, + database& db, const available_package& ap, strings cvs, optional src_root, optional out_root) - : db_ (&db), available_ (&ap), config_vars_ (move (cvs)) + : co_ (&co), db_ (&db), available_ (&ap), config_vars_ (move (cvs)) { // Should not be created for stubs. // @@ -715,6 +721,11 @@ namespace bpkg created_ = true; } + // Initialize the build system. + // + if (!build2_sched.started ()) + build2_init (*co_); + try { using namespace build2; -- cgit v1.1