X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsourcepackage.cpp;h=4f42051e6b654d9baac64fabde7bb44e479e6ebe;hb=dad4c41302de525a1456e9d5b738831487c8acac;hp=df1677fcce8edc638f8a8eb66cfafe2b6dee7b25;hpb=49ee08bb6f63f6b3a8cdd3b7cf032dea9b2cba8a;p=builder.git diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index df1677f..4f42051 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -1,10 +1,4 @@ -/* $Id$ - -This file is part of builder -Copyright © 2007-2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include #include #include @@ -75,7 +69,51 @@ LibMode SourcePackage::get_library_mode() const else if(mode=="none") return DYNAMIC; else - throw Exception("Unknown library mode"); + throw runtime_error("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 bad_expansion("nested too deep"); + + 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 +198,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 +308,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()); }