]> git.tdb.fi Git - builder.git/blobdiff - source/sourcepackage.cpp
ComponentList typedef isn't needed outside of SourcePackage
[builder.git] / source / sourcepackage.cpp
index bb239b22b7d60cc83e1486aa1860aa4666a37258..06ab5fe7441953a9652b9ae40b2c2df208755de9 100644 (file)
@@ -63,84 +63,6 @@ FS::Path SourcePackage::get_out_dir() const
                return source/arch.get_name()/detail;
 }
 
-string SourcePackage::expand_string(const string &str) const
-{
-       string result = str;
-       string::size_type dollar = 0;
-       unsigned n = 0;
-       while((dollar = result.find('$'))!=string::npos)
-       {
-               if(n>1000)
-                       throw bad_expansion("nested too deep");
-
-               string::size_type end;
-               string var;
-               if(dollar+1<result.size() && result[dollar+1]=='{')
-               {
-                       end = result.find('}', dollar+2);
-                       if(end==string::npos)
-                               throw bad_expansion("unterminated variable reference");
-                       var = result.substr(dollar+2, end-dollar-2);
-                       ++end;
-               }
-               else
-               {
-                       for(end=dollar+1; (isalnum(result[end]) || result[end]=='_'); ++end) ;
-                       var = result.substr(dollar+1, end-dollar-1);
-               }
-
-               string value;
-               if(config.is_option(var))
-                       value = config.get_option(var).value;
-               else if(var=="arch")
-                       value = builder.get_current_arch().get_name();
-               else if(var=="system")
-                       value = builder.get_current_arch().get_system();
-               else if(const char *ptr = getenv(var.c_str()))
-                       value = ptr;
-
-               result.replace(dollar, end-dollar, value);
-
-               ++n;
-       }
-
-       return result;
-}
-
-void SourcePackage::do_configure(const StringMap &opts, unsigned flag)
-{
-       init_config();
-
-       config.load();
-
-       if(flag && config.update(opts))
-               builder.get_logger().log("configure", format("Configuration of %s changed", name));
-
-       config.finish();
-
-       for(PackageList::iterator i=requires.begin(); i!=requires.end(); ++i)
-       {
-               BinaryPackage *bpkg = dynamic_cast<BinaryPackage *>(*i);
-               if(bpkg && bpkg->get_need_path())
-                       bpkg->set_path(config.get_option(bpkg->get_name()+"_path").value);
-       }
-
-       deps_cache.load();
-
-       for(ComponentList::iterator i=components.begin(); i!=components.end(); ++i)
-               i->configure(opts, flag);
-}
-
-void SourcePackage::init_config()
-{
-       for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
-       {
-               BinaryPackage *bpkg = dynamic_cast<BinaryPackage *>(*i);
-               if(bpkg && bpkg->get_need_path())
-                       config.add_option(bpkg->get_name()+"_path", "/usr", "Path for "+bpkg->get_name());
-       }
-}
-
 void SourcePackage::create_build_info()
 {
        if(build_type)
@@ -169,6 +91,7 @@ void SourcePackage::create_build_info()
 
        for(list<Component>::iterator i=components.begin(); i!=components.end(); ++i)
        {
+               i->prepare();
                i->create_build_info();
                if(i->get_type()==Component::LIBRARY)
                        export_binfo.libs.push_back(i->get_name());
@@ -177,6 +100,8 @@ void SourcePackage::create_build_info()
 
 void SourcePackage::create_targets()
 {
+       deps_cache.load();
+
        bool pc_needed = false;
        for(ComponentList::const_iterator i=components.begin(); i!=components.end(); ++i)
        {