X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsourcepackage.cpp;h=a466089ae75aad13b049d5e5e3660a930f597ec3;hb=835948343817c0e359330f8522dc4b8a0e025224;hp=df1677fcce8edc638f8a8eb66cfafe2b6dee7b25;hpb=49ee08bb6f63f6b3a8cdd3b7cf032dea9b2cba8a;p=builder.git diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index df1677f..a466089 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -5,6 +5,7 @@ Copyright © 2007-2010 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include #include #include @@ -78,6 +79,50 @@ LibMode SourcePackage::get_library_mode() const throw Exception("Unknown library mode"); } +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 Exception("Too much variable expansions"); + + string::size_type end; + string var; + if(dollar+1get_requires(); - for(PackageList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j) - (*j)->configure(opts, flag&2); - } + i->configure(opts, flag); } void SourcePackage::init_config() @@ -164,7 +205,7 @@ void SourcePackage::create_build_info() export_binfo.libpath.push_back((builder.get_prefix()/"lib").str()); string optimize = config.get_option("optimize").value; - if(lexical_cast(optimize)) + if(!optimize.empty() && optimize!="0") { build_info.cflags.push_back("-O"+optimize); build_info.ldflags.push_back("-O"+optimize); @@ -274,5 +315,5 @@ void SourcePackage::Loader::tar_file(const string &f) SourcePackage &spkg = static_cast(pkg); for(ComponentList::iterator i=spkg.components.begin(); i!=spkg.components.end(); ++i) if(i->get_type()==Component::TARBALL && i->get_name()=="@src") - const_cast(i->get_sources()).push_back(spkg.source/f); + const_cast(i->get_sources()).push_back((spkg.source/f).str()); }