X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbinarypackage.cpp;h=8c3571d103ac4fb9cc955e7178d3a8b745d26d95;hb=8b9f2196ec0a930992614f174b7970c2ed523699;hp=8c9ba5c442ef239be662c36672e7f35837ff0773;hpb=04c316da6d5d90e43cba262f54d90ca231f703bf;p=builder.git diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp index 8c9ba5c..8c3571d 100644 --- a/source/binarypackage.cpp +++ b/source/binarypackage.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of builder -Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include #include "binarypackage.h" @@ -36,25 +29,30 @@ void BinaryPackage::create_build_info() *i = (path/i->substr(1)).str(); } -BinaryPackage *BinaryPackage::from_pkgconfig(Builder &builder, const string &name) +BinaryPackage *BinaryPackage::from_flags(Builder &builder, const std::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;