From 0d0d9a9c56822919e9794658d31db57f8fc3e2bf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Dec 2015 13:54:59 +0200 Subject: Implement two-phase initialization of modules loaded from bootstrap.build --- build/dist/module | 3 +++ build/dist/module.cxx | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'build/dist') diff --git a/build/dist/module b/build/dist/module index 20082ec..f2e024a 100644 --- a/build/dist/module +++ b/build/dist/module @@ -14,6 +14,9 @@ namespace build { namespace dist { + extern "C" void + dist_boot (scope&, const location&, unique_ptr&); + extern "C" bool dist_init ( scope&, scope&, const location&, unique_ptr&, bool, bool); diff --git a/build/dist/module.cxx b/build/dist/module.cxx index f0a446b..f39ef18 100644 --- a/build/dist/module.cxx +++ b/build/dist/module.cxx @@ -22,9 +22,21 @@ namespace build { static rule rule_; + extern "C" void + dist_boot (scope& r, const location&, unique_ptr&) + { + tracer trace ("dist::boot"); + + level5 ([&]{trace << "for " << r.out_path ();}); + + // Register meta-operation. + // + r.meta_operations.insert (dist_id, dist); + } + extern "C" bool dist_init (scope& r, - scope& b, + scope&, const location& l, unique_ptr&, bool first, @@ -32,9 +44,6 @@ namespace build { tracer trace ("dist::init"); - if (&r != &b) - fail (l) << "dist module must be initialized in bootstrap.build"; - if (!first) { warn (l) << "multiple dist module initializations"; @@ -66,10 +75,6 @@ namespace build v.find ("config.dist.archives", strings_type); } - // Register meta-operation. - // - r.meta_operations.insert (dist_id, dist); - // Register our wildcard rule. Do it explicitly for the alias // to prevent something like insert(dist_id, test_id) // taking precedence. -- cgit v1.1