GetOpt getopt;
getopt.add_option('a', "analyze", analyze_mode, GetOpt::REQUIRED_ARG).set_help("Perform analysis. MODE can be deps, alldeps or rebuild.", "MODE");
GetOpt getopt;
getopt.add_option('a', "analyze", analyze_mode, GetOpt::REQUIRED_ARG).set_help("Perform analysis. MODE can be deps, alldeps or rebuild.", "MODE");
getopt.add_option('l', "log", log_channels, GetOpt::REQUIRED_ARG).set_help("Set log channels to be displayed.", "LIST");
getopt.add_option('n', "dry-run", dry_run, GetOpt::NO_ARG).set_help("Don't actually do anything, only show what would be done.");
getopt.add_option('s', "silent", silent, GetOpt::NO_ARG).set_help("Don't print any messages other than errors.");
getopt.add_option('l', "log", log_channels, GetOpt::REQUIRED_ARG).set_help("Set log channels to be displayed.", "LIST");
getopt.add_option('n', "dry-run", dry_run, GetOpt::NO_ARG).set_help("Don't actually do anything, only show what would be done.");
getopt.add_option('s', "silent", silent, GetOpt::NO_ARG).set_help("Don't print any messages other than errors.");
getopt.add_option('v', "verbose", verbose, GetOpt::NO_ARG).set_help("Print more information about what's going on.");
getopt.add_option('x', "no-externals", no_externals, GetOpt::NO_ARG).set_help("Do not load external source packages.");
getopt.add_option('A', "conf-all", conf_all, GetOpt::NO_ARG).set_help("Apply configuration to all packages.");
getopt.add_option('v', "verbose", verbose, GetOpt::NO_ARG).set_help("Print more information about what's going on.");
getopt.add_option('x', "no-externals", no_externals, GetOpt::NO_ARG).set_help("Do not load external source packages.");
getopt.add_option('A', "conf-all", conf_all, GetOpt::NO_ARG).set_help("Apply configuration to all packages.");
getopt.add_option( "full-paths", full_paths, GetOpt::NO_ARG).set_help("Output full paths in analysis.");
getopt.add_option( "max-depth", max_depth, GetOpt::REQUIRED_ARG).set_help("Maximum depth to show in analysis.", "NUM");
getopt.add_option( "prefix", prfx, GetOpt::REQUIRED_ARG).set_help("Directory to install things to.", "DIR");
getopt.add_option( "full-paths", full_paths, GetOpt::NO_ARG).set_help("Output full paths in analysis.");
getopt.add_option( "max-depth", max_depth, GetOpt::REQUIRED_ARG).set_help("Maximum depth to show in analysis.", "NUM");
getopt.add_option( "prefix", prfx, GetOpt::REQUIRED_ARG).set_help("Directory to install things to.", "DIR");
getopt.add_option( "warnings", cmdline_warn, GetOpt::REQUIRED_ARG).set_help("Compiler warnings to use.", "LIST");
usagemsg = getopt.generate_usage(argv[0])+" [<target> ...]";
helpmsg = getopt.generate_help();
getopt.add_option( "warnings", cmdline_warn, GetOpt::REQUIRED_ARG).set_help("Compiler warnings to use.", "LIST");
usagemsg = getopt.generate_usage(argv[0])+" [<target> ...]";
helpmsg = getopt.generate_help();
if(arch.empty())
current_arch = &native_arch;
else
current_arch = new Architecture(*this, arch);
if(arch.empty())
current_arch = &native_arch;
else
current_arch = new Architecture(*this, arch);
- if(!current_arch->is_native())
- {
- for(StringMap::const_iterator i=cross_prefixes.begin(); i!=cross_prefixes.end(); ++i)
- if(current_arch->match_name(i->first))
- {
- current_arch->set_cross_prefix(i->second);
- break;
- }
- }
+ load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
+ load_build_file((FS::get_user_data_dir("builder")/"rc").str());
+ if(!temp_str.empty())
+ tempdir = temp_str;
+
+ if(!build_type_name.empty())
+ {
+ BuildTypeMap::iterator i = build_types.find(build_type_name);
+ if(i==build_types.end())
+ throw usage_error("Unknown build type");
+ build_type = &i->second;
+ }
+
warnings.push_back("all");
warnings.push_back("extra");
warnings.push_back("shadow");
warnings.push_back("all");
warnings.push_back("extra");
warnings.push_back("shadow");
logger.log("environment", format("Building on %s, for %s%s", native_arch.get_name(),
current_arch->get_name(), (current_arch->is_native() ? " (native)" : "")));
logger.log("environment", format("Prefix is %s", prefix));
logger.log("environment", format("Building on %s, for %s%s", native_arch.get_name(),
current_arch->get_name(), (current_arch->is_native() ? " (native)" : "")));
logger.log("environment", format("Prefix is %s", prefix));
+ if(tempdir.is_absolute())
+ logger.log("environment", format("Temporary directory is %s", tempdir));
+ else
+ logger.log("environment", format("Using per-package temporary directory %s", tempdir));
+ if(build_type)
+ logger.log("environment", format("Build type is %s", build_type->get_name()));
const PackageManager::PackageMap &packages = package_manager.get_packages();
list<string> package_details;
const PackageManager::PackageMap &packages = package_manager.get_packages();
list<string> package_details;
-void Builder::apply_profile_template(Config &config, const string &pt) const
-{
- vector<string> parts = split(pt, '-');
-
- for(vector<string>::iterator i=parts.begin(); i!=parts.end(); ++i)
- {
- ProfileTemplateMap::const_iterator j = profile_tmpl.find(*i);
- if(j==profile_tmpl.end())
- continue;
-
- config.update(j->second);
- }
-}
-
void Builder::problem(const string &p, const string &d)
{
problems.push_back(Problem(p, d));
void Builder::problem(const string &p, const string &d)
{
problems.push_back(Problem(p, d));
Target *world = new VirtualTarget(*this, "world");
Target *def_tgt = new VirtualTarget(*this, "default");
Target *world = new VirtualTarget(*this, "world");
Target *def_tgt = new VirtualTarget(*this, "default");
const PackageManager::PackageMap &packages = package_manager.get_packages();
for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
const PackageManager::PackageMap &packages = package_manager.get_packages();
for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
- for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
- if(SourcePackage *spkg = dynamic_cast<SourcePackage *>(i->second))
- spkg->get_deps_cache().save();
+ if(!dry_run)
+ {
+ for(PackageManager::PackageMap::const_iterator i=packages.begin(); i!=packages.end(); ++i)
+ i->second->save_caches();
+ }
add("profile", &Loader::profile);
add("package", &Loader::package);
}
add("profile", &Loader::profile);
add("package", &Loader::package);
}
void Builder::Loader::binpkg(const string &n)
{
BinaryPackage *pkg = new BinaryPackage(obj, n);
load_sub(*pkg);
}
void Builder::Loader::binpkg(const string &n)
{
BinaryPackage *pkg = new BinaryPackage(obj, n);
load_sub(*pkg);
}
- load_sub(*pkg);
-}
-
-
-Builder::ProfileLoader::ProfileLoader(StringMap &p):
- profile(p)
-{
- add("option", &ProfileLoader::option);
-}
+ if(obj.conf_all || pkg==obj.main_pkg)
+ load_sub(*pkg, obj.cmdline_options);
+ else
+ load_sub(*pkg);