X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpackage.cpp;h=5f25f1a90eb053705092d75b13f565109ffbf2a4;hb=62106ed7cef9b8ef6f07aaf491f8250f7e8d9398;hp=44444add8b04acb641d97fcccff567b4c74dae87;hpb=592fa2bca4e973678cbdc86802fe1c151b40e04d;p=builder.git diff --git a/source/package.cpp b/source/package.cpp index 44444ad..5f25f1a 100644 --- a/source/package.cpp +++ b/source/package.cpp @@ -1,8 +1,8 @@ #include #include #include +#include "booleanevaluator.h" #include "builder.h" -#include "misc.h" #include "package.h" using namespace std; @@ -11,6 +11,7 @@ using namespace Msp; Package::Package(Builder &b, const string &n): builder(b), name(n), + label(string(1, toupper(n[0]))+n.substr(1)), prepared(false), use_pkgconfig(true) { @@ -22,7 +23,7 @@ void Package::prepare() if(prepared) return; - for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i) + for(Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i) (*i)->prepare(); do_prepare(); @@ -34,14 +35,14 @@ Package::Loader::Loader(Package &p): DataFile::ObjectLoader(p) { add("if_arch", &Loader::if_arch); + add("label", &Package::label); 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); + BooleanEvaluator eval(sigc::hide<1>(sigc::mem_fun(&obj.builder.get_current_arch(), &Architecture::match_name)), false); + bool match = eval.evaluate(cond); obj.builder.get_logger().log("configure", format("%s: arch %s %smatched", obj.name, cond, (match ? "" : "not "))); if(match) load_sub_with(*this); @@ -52,4 +53,6 @@ void Package::Loader::require(const string &n) Package *req = obj.builder.get_package_manager().find_package(n); if(req) obj.requires.push_back(req); + else + obj.problems.push_back(format("Required package %s not found", n)); }