From ffa0839de796fbefc48bacc4777648ff19b3fee6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Sep 2017 16:16:11 +0200 Subject: Add ability to pass scope to buildfile functions, add $install.resolve() --- build2/install/functions.cxx | 27 +++++++++++++++++++++++++++ build2/install/init.cxx | 11 ++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 build2/install/functions.cxx (limited to 'build2/install') diff --git a/build2/install/functions.cxx b/build2/install/functions.cxx new file mode 100644 index 0000000..b9298b2 --- /dev/null +++ b/build2/install/functions.cxx @@ -0,0 +1,27 @@ +// file : build2/install/functions.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include +#include + +#include + +using namespace std; + +namespace build2 +{ + namespace install + { + void + functions () + { + function_family f ("install"); + + // Resolve potentially relative install.* value to an absolute directory + // based on (other) install.* values visible from the calling scope. + // + f["resolve"] = &resolve_dir; + } + } +} diff --git a/build2/install/init.cxx b/build2/install/init.cxx index 757d4ef..b5fd007 100644 --- a/build2/install/init.cxx +++ b/build2/install/init.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -125,12 +126,20 @@ namespace build2 } void + functions (); // functions.cxx + + void boot (scope& r, const location&, unique_ptr&) { tracer trace ("install::boot"); - l5 ([&]{trace << "for " << r.out_path ();}); + // Register install function family if this is the first instance of the + // install modules. + // + if (!function_family::defined ("install")) + functions (); + // Register the install and uninstall operations. // r.operations.insert (install_id, install); -- cgit v1.1