X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpackage.cpp;h=22d19983cbc0574c5d2aae2fc68dd80cc192c5d5;hb=70dc2ce96bd3ba878b60cbb61b2bcc1c5c570485;hp=8a05ddc89699950dd5d59ce2977741b4f4be47ad;hpb=1d687970cc35e54c3335f4aa2fdef23424fe0a06;p=builder.git diff --git a/source/package.cpp b/source/package.cpp index 8a05ddc..22d1998 100644 --- a/source/package.cpp +++ b/source/package.cpp @@ -11,43 +11,46 @@ using namespace Msp; Package::Package(Builder &b, const string &n): builder(b), name(n), - conf_done(false), + prepared(false), use_pkgconfig(true) { builder.get_package_manager().add_package(this); } -void Package::configure(const StringMap &opts, unsigned flag) +void Package::prepare() { - if(conf_done) + if(prepared) return; - if(builder.get_verbose()>=3) - IO::print("Configuring %s\n", name); - - do_configure(opts, flag); - - requires.sort(); - requires.unique(); - - for(PackageList::iterator i=requires.begin(); i!=requires.end(); ++i) - (*i)->configure(opts, flag&2); + for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i) + (*i)->prepare(); create_build_info(); - - conf_done = true; + create_targets(); + prepared = true; } Package::Loader::Loader(Package &p): - pkg(p) + DataFile::ObjectLoader(p) { + add("if_arch", &Loader::if_arch); add("require", &Loader::require); } +void Package::Loader::if_arch(const string &cond) +{ + const Architecture &arch = obj.builder.get_current_arch(); + bool negate = (cond[0]=='!'); + bool match = (arch.match_name(cond.substr(negate))!=negate); + obj.builder.get_logger().log("configure", format("%s: arch %s %smatched", obj.name, cond, (match ? "" : "not "))); + if(match) + load_sub_with(*this); +} + void Package::Loader::require(const string &n) { - Package *req = pkg.builder.get_package_manager().find_package(n); + Package *req = obj.builder.get_package_manager().find_package(n); if(req) - pkg.requires.push_back(req); + obj.requires.push_back(req); }