aboutsummaryrefslogtreecommitdiff
path: root/build2/install
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-11 07:57:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-11 07:57:19 +0200
commit0342dc2fcdd78ef28a4e59d84193a3807068d726 (patch)
treee750c3062d6ff54f0d409fe1a25984b7e78592c8 /build2/install
parent5f7c3f923de106f9d204a8f3500274731ae84fd9 (diff)
New configuration logic, iteration 1
Diffstat (limited to 'build2/install')
-rw-r--r--build2/install/module4
-rw-r--r--build2/install/module.cxx41
-rw-r--r--build2/install/operation.cxx1
-rw-r--r--build2/install/rule.cxx8
4 files changed, 27 insertions, 27 deletions
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<module>&);
+ install_boot (scope&, const location&, unique_ptr<module_base>&);
extern "C" bool
install_init (
- scope&, scope&, const location&, unique_ptr<module>&, bool, bool);
+ scope&, scope&, const location&, unique_ptr<module_base>&, 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<T> (move (vn))); // @@ OVR
+ const variable& vr (var_pool.insert<T> (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<T> (move (vn))); // @@ OVR
+ const variable& vr (var_pool.insert<T> (move (vn))); // Not overridable.
value& v (r.assign (vr));
@@ -76,11 +76,12 @@ namespace build2
}
}
+ template <typename T>
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<module>&)
+ install_boot (scope& r, const location&, unique_ptr<module_base>&)
{
tracer trace ("install::boot");
@@ -116,7 +116,7 @@ namespace build2
install_init (scope& r,
scope& b,
const location& l,
- unique_ptr<module>&,
+ unique_ptr<module_base>&,
bool first,
bool)
{
@@ -139,9 +139,9 @@ namespace build2
{
auto& v (var_pool);
- // @@ OVR
+ // Note: not overridable.
//
- v.insert<dir_path> ("install");
+ v.insert<dir_path> ("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<string> (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";