aboutsummaryrefslogtreecommitdiff
path: root/build2/install
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-08 16:16:11 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2017-09-11 13:57:29 +0300
commitffa0839de796fbefc48bacc4777648ff19b3fee6 (patch)
tree0f493314df633b6f35f9b9db78c7163506c8eed1 /build2/install
parent66e516ad81225b888469b24e726095533c4f9c4c (diff)
Add ability to pass scope to buildfile functions, add $install.resolve()
Diffstat (limited to 'build2/install')
-rw-r--r--build2/install/functions.cxx27
-rw-r--r--build2/install/init.cxx11
2 files changed, 37 insertions, 1 deletions
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 <build2/function.hxx>
+#include <build2/variable.hxx>
+
+#include <build2/install/utility.hxx>
+
+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 <build2/scope.hxx>
#include <build2/target.hxx>
#include <build2/rule.hxx>
+#include <build2/function.hxx>
#include <build2/operation.hxx>
#include <build2/diagnostics.hxx>
@@ -125,12 +126,20 @@ namespace build2
}
void
+ functions (); // functions.cxx
+
+ void
boot (scope& r, const location&, unique_ptr<module_base>&)
{
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);