X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinarypackage.cpp;h=aa1aed3c2fce4a0ecbfc7214299621724df27fdf;hb=92d81529ec8f3b84f5471162d0b27914eff7adb5;hp=22a415457e75844e52e3c8675953e3e351c8338c;hpb=08015c0f27f377fcd4aa186fca5bd8cf70723a5a;p=builder.git diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp index 22a4154..aa1aed3 100644 --- a/source/binarypackage.cpp +++ b/source/binarypackage.cpp @@ -1,7 +1,10 @@ +#include #include #include #include "binarypackage.h" #include "builder.h" +#include "filetarget.h" +#include "staticlibrary.h" using namespace std; using namespace Msp; @@ -60,7 +63,7 @@ void BinaryPackage::do_prepare() *j = prefix/ *j; for(HeaderList::const_iterator j=headers.begin(); j!=headers.end(); ++j) - all_found &= (builder.get_vfs().find_header(*j, incpath, system)!=0); + all_found &= (builder.get_vfs().find_header(*j, 0, incpath, system)!=0); if(all_found) { @@ -72,7 +75,9 @@ void BinaryPackage::do_prepare() if(base_path.empty()) { - builder.problem(name, "Cannot locate files"); + // TODO report which files were not found + builder.get_logger().log("problems", format("Cannot locate files for %s", name)); + problems.push_back("Cannot locate files"); return; } @@ -90,15 +95,43 @@ void BinaryPackage::do_prepare() for(BuildInfo::PathList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i) *i = base_path/ *i; } + + if(!static_binfo.libs.empty()) + { + BuildInfo::PathList combined_libpath = static_binfo.libpath; + combined_libpath.insert(combined_libpath.end(), export_binfo.libpath.begin(), export_binfo.libpath.end()); + + for(BuildInfo::WordList::const_iterator i=export_binfo.libs.begin(); i!=export_binfo.libs.end(); ++i) + if(Target *lib = builder.get_vfs().find_library(*i, export_binfo.libpath, BuildInfo::FORCE_STATIC, system)) + if(StaticLibrary *stlib = dynamic_cast(lib)) + { + for(BuildInfo::WordList::const_iterator j=static_binfo.libs.begin(); j!=static_binfo.libs.end(); ++j) + stlib->add_required_library(*j); + for(BuildInfo::PathList::const_iterator j=combined_libpath.begin(); j!=combined_libpath.end(); ++j) + stlib->add_library_path(*j); + } + } } -BinaryPackage *BinaryPackage::from_flags(Builder &builder, const string &name, const vector &flags) +BinaryPackage *BinaryPackage::from_flags(Builder &builder, const string &name, const Flags &flags, const Flags &static_flags) { BinaryPackage *pkg = new BinaryPackage(builder, name); pkg->use_pkgconfig = true; - BuildInfo &binfo = pkg->export_binfo; - for(vector::const_iterator i=flags.begin(); i!=flags.end(); ++i) + process_flags(flags, pkg->export_binfo); + + Flags exclusive_static_flags; + for(Flags::const_iterator i=static_flags.begin(); i!=static_flags.end(); ++i) + if(find(flags.begin(), flags.end(), *i)==flags.end()) + exclusive_static_flags.push_back(*i); + process_flags(exclusive_static_flags, pkg->static_binfo); + + return pkg; +} + +void BinaryPackage::process_flags(const Flags &flags, BuildInfo &binfo) +{ + for(Flags::const_iterator i=flags.begin(); i!=flags.end(); ++i) { if(!i->compare(0, 2, "-I")) binfo.incpath.push_back(i->substr(2)); @@ -117,8 +150,6 @@ BinaryPackage *BinaryPackage::from_flags(Builder &builder, const string &name, c else if(*i=="-pthread") binfo.threads = true; } - - return pkg; }