]> git.tdb.fi Git - builder.git/commitdiff
Better way to set cross_prefix in architectures
authorMikko Rasa <tdb@tdb.fi>
Tue, 10 Jul 2012 20:52:57 +0000 (23:52 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 10 Jul 2012 20:55:53 +0000 (23:55 +0300)
builderrc
source/architecture.cpp
source/architecture.h
source/builder.cpp
source/builder.h

index 8fed1dc7f3e233d52b59acb6cdfca3a754d791c9..cb2cd6b197918acc28a3fa18efac71f7aa73fbc1 100644 (file)
--- a/builderrc
+++ b/builderrc
@@ -76,8 +76,15 @@ binary_package "openal/windows"
        };
 };
 
-cross_prefix "arm" "arm-linux-gnueabi";
-cross_prefix "windows" "i586-mingw32msvc";
+architecture "arm"
+{
+       prefix "arm-linux-gnueabi";
+};
+
+architecture "windows"
+{
+       prefix "i586-mingw32msvc";
+};
 
 profile "debug"
 {
index 97ed2fe07dce2a0b0ebe9c5be4325e2c91486378..efe9c732dd707696d3d74610e340065c480960f2 100644 (file)
@@ -120,11 +120,6 @@ Architecture::Architecture(Builder &b, const string &spec):
        }
 }
 
-void Architecture::set_cross_prefix(const string &p)
-{
-       cross_prefix = p;
-}
-
 bool Architecture::match_name(const string &pattern) const
 {
        vector<string> parts = split(pattern, "-");
index 00719cfab91387d23f2ec6935a687a61f1a9dc59..2d7ca5f18c8f51017b82ecebc96f3b15c730d321 100644 (file)
@@ -46,7 +46,6 @@ public:
        bool is_native() const { return native; }
        bool is_cross() const { return !cross_prefix.empty(); }
 
-       void set_cross_prefix(const std::string &);
        const std::string &get_cross_prefix() const { return cross_prefix; }
 
        const PatternList &get_shared_library_patterns() const { return sharedlib_patterns; }
index 94bbce04d3a552480994b2d4597fdeb5e154f3b1..df6eda42fcfe535f2074b1939b5a0c6afe677782 100644 (file)
@@ -165,23 +165,13 @@ Builder::Builder(int argc, char **argv):
 
        package_manager.set_no_externals(no_externals);
 
-       load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
-       load_build_file((FS::get_user_data_dir("builder")/"rc").str());
-
        if(arch.empty())
                current_arch = &native_arch;
        else
                current_arch = new Architecture(*this, arch);
 
-       if(!current_arch->is_native())
-       {
-               for(StringMap::const_iterator i=cross_prefixes.begin(); i!=cross_prefixes.end(); ++i)
-                       if(current_arch->match_name(i->first))
-                       {
-                               current_arch->set_cross_prefix(i->second);
-                               break;
-                       }
-       }
+       load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
+       load_build_file((FS::get_user_data_dir("builder")/"rc").str());
 
        if(prfx.empty())
        {
@@ -609,21 +599,22 @@ Builder::Loader::Loader(Builder &b, const FS::Path &s):
        DataFile::ObjectLoader<Builder>(b),
        src(s)
 {
+       add("architecture", &Loader::architecture);
        add("binary_package", &Loader::binpkg);
-       add("cross_prefix", &Loader::cross_prefix);
        add("profile", &Loader::profile);
        add("package", &Loader::package);
 }
 
-void Builder::Loader::binpkg(const string &n)
+void Builder::Loader::architecture(const string &n)
 {
-       BinaryPackage *pkg = new BinaryPackage(obj, n);
-       load_sub(*pkg);
+       if(obj.current_arch->match_name(n))
+               load_sub(*obj.current_arch);
 }
 
-void Builder::Loader::cross_prefix(const string &a, const string &p)
+void Builder::Loader::binpkg(const string &n)
 {
-       obj.cross_prefixes[a] = p;
+       BinaryPackage *pkg = new BinaryPackage(obj, n);
+       load_sub(*pkg);
 }
 
 void Builder::Loader::profile(const string &n)
index e524864564cfee83b64d59acddea2709eb334b6e..90380a696b81ab3018746afc82b8c999ef4b16b1 100644 (file)
@@ -38,8 +38,8 @@ private:
        public:
                Loader(Builder &, const Msp::FS::Path &);
        private:
+               void architecture(const std::string &);
                void binpkg(const std::string &);
-               void cross_prefix(const std::string &, const std::string &);
                void profile(const std::string &);
                void package(const std::string &);
        };
@@ -73,7 +73,6 @@ private:
 
        Architecture native_arch;
        Architecture *current_arch;
-       StringMap cross_prefixes;
        ProfileTemplateMap profile_tmpl;
        Toolchain toolchain;
        VirtualFileSystem vfs;