summaryrefslogtreecommitdiff
path: root/src/bootstrap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap.cc')
-rw-r--r--src/bootstrap.cc46
1 files changed, 35 insertions, 11 deletions
diff --git a/src/bootstrap.cc b/src/bootstrap.cc
index 471c844..836504e 100644
--- a/src/bootstrap.cc
+++ b/src/bootstrap.cc
@@ -19,6 +19,7 @@
#include "tasks.cc"
#include "build.cc"
#include "tools.cc"
+#include "pointerlist.cc"
const std::filesystem::path configurationFile("configuration.cc");
const std::filesystem::path configHeaderFile("config.h");
@@ -41,46 +42,69 @@ bool ctor::configuration::has(const std::string& key) const
return false;
}
-const std::string& ctor::configuration::get(const std::string& key, const std::string& default_value) const
+std::string ctor::configuration::get(const std::string& key, const std::string& default_value) const
{
+ static auto paths = get_paths();
auto cxx_env = std::getenv("CXX");
if(key == ctor::cfg::build_cxx && cxx_env)
{
- static std::string s = cxx_env;
- return s;
+ static auto cxx_prog = locate(cxx_env, paths);
+ return cxx_prog;
}
auto cc_env = std::getenv("CC");
if(key == ctor::cfg::build_cc && cc_env)
{
- static std::string s = cc_env;
- return s;
+ static auto cc_prog = locate(cc_env, paths);
+ return cc_prog;
}
auto ld_env = std::getenv("LD");
if(key == ctor::cfg::build_ld && ld_env)
{
- static std::string s = ld_env;
- return s;
+ static auto ld_prog = locate(ld_env, paths);
+ return ld_prog;
}
auto ar_env = std::getenv("AR");
if(key == ctor::cfg::build_ar && ar_env)
{
- static std::string s = ar_env;
- return s;
+ static auto ar_prog = locate(ar_env, paths);
+ return ar_prog;
}
auto builddir_env = std::getenv("BUILDDIR");
if(key == ctor::cfg::builddir && builddir_env)
{
- static std::string s = builddir_env;
- return s;
+ return builddir_env;
}
return default_value;
}
+std::string ctor::configuration::getenv(const std::string& key) const
+{
+ auto envit = env.find(key);
+ if(envit != env.end())
+ {
+ return envit->second;
+ }
+
+ auto env = std::getenv(key.data());
+ if(env)
+ {
+ return env;
+ }
+
+ return {};
+}
+
+std::vector<std::string> readDeps(const std::string& depFile,
+ ctor::toolchain toolchain)
+{
+ return {};
+}
+
int main(int argc, char* argv[])
{
auto args = std::span(argv, static_cast<std::size_t>(argc));