]> git.tdb.fi Git - builder.git/commitdiff
Move if_arch to Package so binary packages can use it too
authorMikko Rasa <tdb@tdb.fi>
Sun, 22 Jul 2012 17:09:19 +0000 (20:09 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 22 Jul 2012 17:10:06 +0000 (20:10 +0300)
source/package.cpp
source/package.h
source/sourcepackage.cpp
source/sourcepackage.h

index 7ec986e1c2c2d4395d76c8e20d78a2d91235538d..22d19983cbc0574c5d2aae2fc68dd80cc192c5d5 100644 (file)
@@ -34,9 +34,20 @@ void Package::prepare()
 Package::Loader::Loader(Package &p):
        DataFile::ObjectLoader<Package>(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);
index 5c80779aa67d94aeb60ee0d8383ef993afd1bc22..4d4012589b82ed71920efe93240a24b3bb0be757 100644 (file)
@@ -25,6 +25,7 @@ public:
        public:
                Loader(Package &);
        private:
+               void if_arch(const std::string &);
                void require(const std::string &);
        };
 
index e74c0b7540c409fd07e0ed3048dd7ee167da3be4..94bb4ba9c0321b7a726e43e21c4552e8baaff3a4 100644 (file)
@@ -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<Component::PROGRAM>);
        add("library",     &Loader::component<Component::LIBRARY>);
@@ -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;
index bdcba478262a786d5e3a91369787ec2b00632bb7..2f6a9a11e79c1632f3107c59eb6f62d58d983066 100644 (file)
@@ -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 &);