From 0342dc2fcdd78ef28a4e59d84193a3807068d726 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Apr 2016 07:57:19 +0200 Subject: New configuration logic, iteration 1 --- build2/install/module | 4 ++-- build2/install/module.cxx | 41 ++++++++++++++++++++--------------------- build2/install/operation.cxx | 1 + build2/install/rule.cxx | 8 ++++---- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'build2/install') diff --git a/build2/install/module b/build2/install/module index a02d110..f81b6ac 100644 --- a/build2/install/module +++ b/build2/install/module @@ -15,11 +15,11 @@ namespace build2 namespace install { extern "C" void - install_boot (scope&, const location&, unique_ptr&); + install_boot (scope&, const location&, unique_ptr&); extern "C" bool install_init ( - scope&, scope&, const location&, unique_ptr&, bool, bool); + scope&, scope&, const location&, unique_ptr&, bool, bool); } } diff --git a/build2/install/module.cxx b/build2/install/module.cxx index 7838a65..e7840ca 100644 --- a/build2/install/module.cxx +++ b/build2/install/module.cxx @@ -50,7 +50,7 @@ namespace build2 vn = "config.install."; vn += name; vn += var; - const variable& vr (var_pool.insert (move (vn))); // @@ OVR + const variable& vr (var_pool.insert (move (vn), true)); cv = dv != nullptr ? &config::required (r, vr, *dv, override).first.get () @@ -60,7 +60,7 @@ namespace build2 vn = "install."; vn += name; vn += var; - const variable& vr (var_pool.insert (move (vn))); // @@ OVR + const variable& vr (var_pool.insert (move (vn))); // Not overridable. value& v (r.assign (vr)); @@ -76,11 +76,12 @@ namespace build2 } } + template static void set_dir (bool s, // specified scope& r, // root scope const char* n, // var name - const string& ps, // path (as string) + const T& p, // path const string& fm = string (), // file mode const string& dm = string (), // dir mode const build2::path& c = build2::path (), // command @@ -88,7 +89,6 @@ namespace build2 { using build2::path; - dir_path p (ps); set_var (s, r, n, "", p.empty () ? nullptr : &p, o); set_var (s, r, n, ".mode", fm.empty () ? nullptr : &fm); set_var (s, r, n, ".dir_mode", dm.empty () ? nullptr : &dm); @@ -101,7 +101,7 @@ namespace build2 static file_rule file_; extern "C" void - install_boot (scope& r, const location&, unique_ptr&) + install_boot (scope& r, const location&, unique_ptr&) { tracer trace ("install::boot"); @@ -116,7 +116,7 @@ namespace build2 install_init (scope& r, scope& b, const location& l, - unique_ptr&, + unique_ptr&, bool first, bool) { @@ -139,9 +139,9 @@ namespace build2 { auto& v (var_pool); - // @@ OVR + // Note: not overridable. // - v.insert ("install"); + v.insert ("install"); // Flag. } // Register our alias and file installer rule. @@ -162,22 +162,21 @@ namespace build2 bool s (config::specified (r, "config.install")); const string& n (cast (r["project"])); - set_dir (s, r, "root", "", "", "755", path ("install")); - set_dir (s, r, "data_root", "root", "644"); - set_dir (s, r, "exec_root", "root", "755"); - - set_dir (s, r, "sbin", "exec_root/sbin"); - set_dir (s, r, "bin", "exec_root/bin"); - set_dir (s, r, "lib", "exec_root/lib"); - set_dir (s, r, "libexec", "exec_root/libexec/" + n, "", "", path (), true); + set_dir (s, r, "root", abs_dir_path (), "", "755", path ("install")); + set_dir (s, r, "data_root", dir_path ("root"), "644"); + set_dir (s, r, "exec_root", dir_path ("root"), "755"); - set_dir (s, r, "data", "data_root/share/" + n, "", "", path (), true); - set_dir (s, r, "include", "data_root/include"); + set_dir (s, r, "sbin", dir_path ("exec_root/sbin")); + set_dir (s, r, "bin", dir_path ("exec_root/bin")); + set_dir (s, r, "lib", dir_path ("exec_root/lib")); + set_dir (s, r, "libexec", dir_path ("exec_root/libexec/" + n), "", "", path (), true); - set_dir (s, r, "doc", "data_root/share/doc/" + n, "", "", path (), true); - set_dir (s, r, "man", "data_root/share/man"); + set_dir (s, r, "data", dir_path ("data_root/share/" + n), "", "", path (), true); + set_dir (s, r, "include", dir_path ("data_root/include")); - set_dir (s, r, "man1", "man/man1"); + set_dir (s, r, "doc", dir_path ("data_root/share/doc/" + n), "", "", path (), true); + set_dir (s, r, "man", dir_path ("data_root/share/man")); + set_dir (s, r, "man1", dir_path ("man/man1")); } // Configure "installability" for built-in target types. diff --git a/build2/install/operation.cxx b/build2/install/operation.cxx index 7778c70..77deb2c 100644 --- a/build2/install/operation.cxx +++ b/build2/install/operation.cxx @@ -20,6 +20,7 @@ namespace build2 } operation_info install { + install_id, "install", "install", "installing", diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx index e756fc2..24c1df0 100644 --- a/build2/install/rule.cxx +++ b/build2/install/rule.cxx @@ -371,10 +371,10 @@ namespace build2 if (r.mode.empty ()) r.mode = "644"; if (r.dir_mode.empty ()) r.dir_mode = "755"; - // If the directory still doesn't exist, then this means it was specified - // as absolute (it will normally be install.root with everything else - // defined in term of it). We used to fail in this case but that proved - // to be just too anal. So now we just create it. + // If the directory still doesn't exist, then this means it was + // specified as absolute (it will normally be install.root with + // everything else defined in term of it). We used to fail in this + // case but that proved to be just too anal. So now we just create it. // if (!dir_exists (r.dir)) // May throw (e.g., EACCES). // fail << "installation directory " << d << " does not exist"; -- cgit v1.1