aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/config/module.cxx4
-rw-r--r--build2/config/operation.cxx2
-rw-r--r--build2/dist/operation.cxx8
-rw-r--r--build2/file2
-rw-r--r--build2/file.cxx23
-rw-r--r--build2/install/module.cxx37
6 files changed, 47 insertions, 29 deletions
diff --git a/build2/config/module.cxx b/build2/config/module.cxx
index 9113166..d4b9b49 100644
--- a/build2/config/module.cxx
+++ b/build2/config/module.cxx
@@ -22,10 +22,6 @@ namespace build2
{
const string module::name ("config");
- //@@ Same as in operation.cxx
- //
- static const path config_file ("build/config.build");
-
void
boot (scope& root, const location&, unique_ptr<module_base>&)
{
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index 0773f00..89ddcfb 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -24,8 +24,6 @@ namespace build2
{
namespace config
{
- static const path config_file ("build/config.build");
-
// configure
//
static operation_id
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index c87f0e7..0ab9241 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -140,9 +140,9 @@ namespace build2
// ignored on the next step if the user explicitly marked them
// nodist.
//
- auto add_adhoc = [&trace] (scope& rs, const char* f)
+ auto add_adhoc = [&trace] (scope& rs, const path& f)
{
- path p (rs.src_path () / path (f));
+ path p (rs.src_path () / f);
if (file_exists (p))
{
dir_path d (p.directory ());
@@ -163,7 +163,7 @@ namespace build2
}
};
- add_adhoc (*rs, "build/export.build");
+ add_adhoc (*rs, export_file);
// The same for subprojects that have been loaded.
//
@@ -181,7 +181,7 @@ namespace build2
if (!nrs.src_path ().sub (src_root)) // Not a strong amalgamation.
continue;
- add_adhoc (nrs, "build/export.build");
+ add_adhoc (nrs, export_file);
}
}
diff --git a/build2/file b/build2/file
index 062487a..f5dac83 100644
--- a/build2/file
+++ b/build2/file
@@ -27,6 +27,8 @@ namespace build2
extern const path root_file; // build/root.build
extern const path bootstrap_file; // build/bootstrap.build
extern const path src_root_file; // build/bootstrap/src-root.build
+ extern const path export_file; // build/export.build
+ extern const path config_file; // build/config.build
bool
is_src_root (const dir_path&);
diff --git a/build2/file.cxx b/build2/file.cxx
index a70c97a..1aa8c9e 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -25,11 +25,18 @@ using namespace butl;
namespace build2
{
const dir_path build_dir ("build");
- const dir_path bootstrap_dir ("build/bootstrap");
+ const dir_path bootstrap_dir (dir_path (build_dir) /= "bootstrap");
- const path root_file ("build/root.build");
- const path bootstrap_file ("build/bootstrap.build");
- const path src_root_file ("build/bootstrap/src-root.build");
+ const path root_file (build_dir / "root.build");
+ const path bootstrap_file (build_dir / "bootstrap.build");
+ const path src_root_file (bootstrap_dir / "src-root.build");
+ const path export_file (build_dir / "export.build");
+
+ // While strictly speaking it belongs in, say, config/module.cxx, the static
+ // initialization order strikes again. If we ever make the config module
+ // loadable, then we can move it there.
+ //
+ const path config_file (build_dir / "config.build");
bool
is_src_root (const dir_path& d)
@@ -248,7 +255,7 @@ namespace build2
void
bootstrap_out (scope& root)
{
- path bf (root.out_path () / path ("build/bootstrap/src-root.build"));
+ path bf (root.out_path () / src_root_file);
if (!file_exists (bf))
return;
@@ -434,7 +441,7 @@ namespace build2
const dir_path& out_root (root.out_path ());
const dir_path& src_root (root.src_path ());
- path bf (src_root / path ("build/bootstrap.build"));
+ path bf (src_root / bootstrap_file);
if (file_exists (bf))
{
@@ -780,7 +787,7 @@ namespace build2
// Load root.build.
//
- path bf (root.src_path () / path ("build/root.build"));
+ path bf (root.src_path () / root_file);
if (file_exists (bf))
source_once (bf, root, root);
@@ -963,7 +970,7 @@ namespace build2
// stub will normally switch to the imported root scope at some
// point.
//
- path es (root->src_path () / path ("build/export.build"));
+ path es (root->src_path () / export_file);
try
{
diff --git a/build2/install/module.cxx b/build2/install/module.cxx
index 5a18899..89b8a96 100644
--- a/build2/install/module.cxx
+++ b/build2/install/module.cxx
@@ -112,6 +112,20 @@ namespace build2
r.operations.insert (install_id, install);
}
+ static const dir_path dir_root ("root");
+
+ static const dir_path dir_sbin (dir_path ("exec_root") /= "sbin");
+ static const dir_path dir_bin (dir_path ("exec_root") /= "bin");
+ static const dir_path dir_lib (dir_path ("exec_root") /= "lib");
+ static const dir_path dir_libexec (dir_path ("exec_root") /= "libexec");
+
+ static const dir_path dir_data (dir_path ("data_root") /= "share");
+ static const dir_path dir_include (dir_path ("data_root") /= "include");
+
+ static const dir_path dir_doc (dir_path (dir_data) /= "doc");
+ static const dir_path dir_man (dir_path (dir_data) /= "man");
+ static const dir_path dir_man1 (dir_path ("man") /= "man1");
+
bool
init (scope& r,
scope& b,
@@ -167,20 +181,21 @@ namespace build2
const string& n (cast<string> (r["project"]));
set_dir (s, r, "root", abs_dir_path (), false, "", "755", path ("install"));
- set_dir (s, r, "data_root", dir_path ("root"), false, "644");
- set_dir (s, r, "exec_root", dir_path ("root"), false, "755");
- 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), true);
+ set_dir (s, r, "data_root", dir_root, false, "644");
+ set_dir (s, r, "exec_root", dir_root, false, "755");
+
+ set_dir (s, r, "sbin", dir_sbin);
+ set_dir (s, r, "bin", dir_bin);
+ set_dir (s, r, "lib", dir_lib);
+ set_dir (s, r, "libexec", dir_path (dir_libexec) /= n, true);
- set_dir (s, r, "data", dir_path ("data_root/share/" + n), true);
- set_dir (s, r, "include", dir_path ("data_root/include"));
+ set_dir (s, r, "data", dir_path (dir_data) /= n, true);
+ set_dir (s, r, "include", dir_include);
- set_dir (s, r, "doc", dir_path ("data_root/share/doc/" + n), true);
- set_dir (s, r, "man", dir_path ("data_root/share/man"));
- set_dir (s, r, "man1", dir_path ("man/man1"));
+ set_dir (s, r, "doc", dir_path (dir_doc) /= n, true);
+ set_dir (s, r, "man", dir_man);
+ set_dir (s, r, "man1", dir_man1);
}
// Configure "installability" for built-in target types.