X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinarypackage.cpp;h=b9c558eff44f96a9dcb4f21c0d80c9da8af19036;hb=968db78efd29b1f4890068693728299b2c7c92c7;hp=f804da08394c31fc3489109a46b1abf9eb9ef5fd;hpb=43bd25ffcb0b4f7882773f4676b209a99cb73c04;p=builder.git diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp index f804da0..b9c558e 100644 --- a/source/binarypackage.cpp +++ b/source/binarypackage.cpp @@ -20,34 +20,39 @@ void BinaryPackage::set_path(const FS::Path &p) void BinaryPackage::create_build_info() { - for(StringList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i) - if((*i)[0]=='@') - *i = (path/i->substr(1)).str(); + for(BuildInfo::PathList::iterator i=export_binfo.incpath.begin(); i!=export_binfo.incpath.end(); ++i) + if((*i)[0]=="@") + *i = path/i->subpath(1); - for(StringList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i) - if((*i)[0]=='@') - *i = (path/i->substr(1)).str(); + for(BuildInfo::PathList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i) + if((*i)[0]=="@") + *i = path/i->subpath(1); } -BinaryPackage *BinaryPackage::from_pkgconfig(Builder &builder, const string &name) +BinaryPackage *BinaryPackage::from_flags(Builder &builder, const string &name, const vector &flags) { - string info = builder.run_pkgconfig(name, "flags"); - BinaryPackage *pkg = new BinaryPackage(builder, name); pkg->use_pkgconfig = true; BuildInfo &binfo = pkg->export_binfo; - vector flags = split(info); for(vector::const_iterator i=flags.begin(); i!=flags.end(); ++i) { if(!i->compare(0, 2, "-I")) binfo.incpath.push_back(i->substr(2)); else if(!i->compare(0, 2, "-D")) - binfo.defines.push_back(i->substr(2)); + { + string::size_type equals = i->find('='); + if(equals!=string::npos) + binfo.defines[i->substr(2, equals-2)] = i->substr(equals+1); + else + binfo.defines[i->substr(2)] = string(); + } else if(!i->compare(0, 2, "-L")) binfo.libpath.push_back(i->substr(2)); else if(!i->compare(0, 2, "-l")) binfo.libs.push_back(i->substr(2)); + else if(*i=="-pthread") + binfo.threads = true; } return pkg;