aboutsummaryrefslogtreecommitdiff
path: root/build2/install
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-28 15:59:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-28 16:03:35 +0200
commit96f2131e593e206f0e458409f22adfff8c1b5356 (patch)
treefdb71a7a435d631872e0413dbe13113a636932de /build2/install
parent69801c4e23f877359118e55ed291737f4fbece04 (diff)
Clean up variable usage
Diffstat (limited to 'build2/install')
-rw-r--r--build2/install/module.cxx30
-rw-r--r--build2/install/rule.cxx10
2 files changed, 22 insertions, 18 deletions
diff --git a/build2/install/module.cxx b/build2/install/module.cxx
index 3890901..0c17c05 100644
--- a/build2/install/module.cxx
+++ b/build2/install/module.cxx
@@ -77,21 +77,23 @@ namespace build2
}
static void
- set_dir (bool s, // specified
- scope& r, // root scope
- const char* n, // var name
- const string& ps, // path (as string)
- const string& fm = string (), // file mode
- const string& dm = string (), // dir mode
- const string& c = string (), // command
- bool o = false) // override
+ set_dir (bool s, // specified
+ scope& r, // root scope
+ const char* n, // var name
+ const string& ps, // path (as string)
+ const string& fm = string (), // file mode
+ const string& dm = string (), // dir mode
+ const build2::path& c = build2::path (), // command
+ bool o = false) // override
{
+ 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);
set_var<string> (s, r, n, ".sudo", nullptr);
- set_var (s, r, n, ".cmd", c.empty () ? nullptr : &c);
+ set_var<path> (s, r, n, ".cmd", c.empty () ? nullptr : &c);
set_var<strings> (s, r, n, ".options", nullptr);
}
@@ -153,22 +155,24 @@ namespace build2
//
if (first)
{
+ using build2::path;
+
bool s (config::specified (r, "config.install"));
const string& n (cast<string> (r["project"]));
- set_dir (s, r, "root", "", "", "755", "install");
+ 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, "", "", "", true);
+ set_dir (s, r, "libexec", "exec_root/libexec/" + n, "", "", path (), true);
- set_dir (s, r, "data", "data_root/share/" + n, "", "", "", true);
+ set_dir (s, r, "data", "data_root/share/" + n, "", "", path (), true);
set_dir (s, r, "include", "data_root/include");
- set_dir (s, r, "doc", "data_root/share/doc/" + n, "", "", "", 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, "man1", "man/man1");
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index 25259cf..e756fc2 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -221,7 +221,7 @@ namespace build2
dir_path dir;
string sudo;
- string cmd; //@@ VAR type
+ path cmd;
strings options;
string mode;
string dir_mode;
@@ -239,7 +239,7 @@ namespace build2
if (!base.sudo.empty ())
args.push_back (base.sudo.c_str ());
- args.push_back (base.cmd.c_str ());
+ args.push_back (base.cmd.string ().c_str ());
args.push_back ("-d");
if (!base.options.empty ())
@@ -286,7 +286,7 @@ namespace build2
if (!base.sudo.empty ())
args.push_back (base.sudo.c_str ());
- args.push_back (base.cmd.c_str ());
+ args.push_back (base.cmd.string ().c_str ());
if (!base.options.empty ())
append_options (args, base.options);
@@ -359,7 +359,7 @@ namespace build2
if (var != nullptr)
{
if (auto l = s[*var + ".sudo"]) r.sudo = cast<string> (l);
- if (auto l = s[*var + ".cmd"]) r.cmd = cast<string> (l);
+ if (auto l = s[*var + ".cmd"]) r.cmd = cast<path> (l);
if (auto l = s[*var + ".mode"]) r.mode = cast<string> (l);
if (auto l = s[*var + ".dir_mode"]) r.dir_mode = cast<string> (l);
if (auto l = s[*var + ".options"]) r.options = cast<strings> (l);
@@ -367,7 +367,7 @@ namespace build2
// Set defaults for unspecified components.
//
- if (r.cmd.empty ()) r.cmd = "install";
+ if (r.cmd.empty ()) r.cmd = path ("install");
if (r.mode.empty ()) r.mode = "644";
if (r.dir_mode.empty ()) r.dir_mode = "755";