X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpackage.cpp;h=031ceb5f95c3a0bac333ed5c50df60137c71e834;hb=09325a99816a966bc17a0ec9a0a197efc6ce0349;hp=31b36bb4710365af4313f0cec4e0ec7360a9b4a0;hpb=2dd938cdc85f2c9ffaaf66a83e8e854954aced47;p=builder.git diff --git a/source/package.cpp b/source/package.cpp index 31b36bb..031ceb5 100644 --- a/source/package.cpp +++ b/source/package.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "builder.h" #include "misc.h" #include "package.h" @@ -31,6 +31,16 @@ void Package::set_path(const Msp::Path::Path &p) path=builder.get_cwd()/p; } +Msp::Path::Path Package::get_temp_dir() const +{ + return source/config.get_option("tempdir").value/config.get_option("profile").value; +} + +Msp::Path::Path Package::get_out_dir() const +{ + return source/config.get_option("outdir").value; +} + /** Checks which kinds of things the components of this package install. @@ -55,6 +65,19 @@ unsigned Package::get_install_flags() return flags; } +LibMode Package::get_library_mode() const +{ + const string &mode=config.get_option("staticlibs").value; + if(mode=="all") + return ALL_STATIC; + else if(mode=="local") + return LOCAL_STATIC; + else if(mode=="none") + return DYNAMIC; + else + throw Exception("Unknown library mode"); +} + /** Tries to resolve all references to dependency packages. */ @@ -91,11 +114,18 @@ void Package::configure(const RawOptionMap &opts, unsigned flag) { init_config(); - if(flag && config.process(opts) && !builder.get_dry_run()) + RawOptionMap::const_iterator prof=opts.find("profile"); + if(prof!=opts.end()) + config.select_profile(prof->second); + else + config.select_last_profile(); + + if(flag && config.update(opts)) { if(builder.get_verbose()>=2) cout<<"Configuration of "<get_package() && i->get_package()->get_need_path()) config.add_option(i->get_name()+"_path", "", "Path for "+i->get_name()); - config.load(source/".options.cache"); + config.set_source(source); } /** @@ -236,7 +270,7 @@ void Package::create_build_info() export_binfo.libpath.push_back((Path::Path(config.get_option("prefix").value)/"lib").str()); string optimize=config.get_option("optimize").value; - if(strtol(optimize)) + if(lexical_cast(optimize)) { build_info.cflags.push_back("-O"+optimize); string cpu=config.get_option("cpu").value; @@ -244,7 +278,7 @@ void Package::create_build_info() build_info.cflags.push_back("-march="+cpu); } - if(strtobool(config.get_option("debug").value)) + if(lexical_cast(config.get_option("debug").value)) { build_info.cflags.push_back("-ggdb"); build_info.defines.push_back("DEBUG"); @@ -261,7 +295,6 @@ void Package::create_build_info() } else if(name=="fmod4") { - cout<