From: Mikko Rasa Date: Sun, 22 Jul 2012 17:09:19 +0000 (+0300) Subject: Move if_arch to Package so binary packages can use it too X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=70dc2ce96bd3ba878b60cbb61b2bcc1c5c570485;p=builder.git Move if_arch to Package so binary packages can use it too --- diff --git a/source/package.cpp b/source/package.cpp index 7ec986e..22d1998 100644 --- a/source/package.cpp +++ b/source/package.cpp @@ -34,9 +34,20 @@ void Package::prepare() Package::Loader::Loader(Package &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 = obj.builder.get_package_manager().find_package(n); diff --git a/source/package.h b/source/package.h index 5c80779..4d40125 100644 --- a/source/package.h +++ b/source/package.h @@ -25,6 +25,7 @@ public: public: Loader(Package &); private: + void if_arch(const std::string &); void require(const std::string &); }; diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index e74c0b7..94bb4ba 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -151,7 +151,6 @@ void SourcePackage::Loader::init(const Config::InputOptions *o) add("build_info", &Loader::build_info); add("feature", &Loader::feature); add("if", &Loader::condition); - add("if_arch", &Loader::if_arch); add("if_feat", &Loader::if_feature); add("program", &Loader::component); add("library", &Loader::component); @@ -232,16 +231,6 @@ void SourcePackage::Loader::headers(const string &n) install_map[*i] = "include/"+comp.get_name(); } -void SourcePackage::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 SourcePackage::Loader::if_feature(const string &cond) { bool match = false; diff --git a/source/sourcepackage.h b/source/sourcepackage.h index bdcba47..2f6a9a1 100644 --- a/source/sourcepackage.h +++ b/source/sourcepackage.h @@ -46,7 +46,6 @@ public: void condition(const std::string &); void build_info(); void headers(const std::string &); - void if_arch(const std::string &); void if_feature(const std::string &); void source_tarball(); void tarball(const std::string &);