]> git.tdb.fi Git - builder.git/blobdiff - source/binarypackage.cpp
Refactor transitive dependencies to work on all targets
[builder.git] / source / binarypackage.cpp
diff --git a/source/binarypackage.cpp b/source/binarypackage.cpp
deleted file mode 100644 (file)
index aaeb3e5..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $Id$
-
-This file is part of builder
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include <iostream>
-#include <msp/strings/utils.h>
-#include "binarypackage.h"
-#include "builder.h"
-
-using namespace std;
-using namespace Msp;
-
-BinaryPackage::BinaryPackage(Builder &b, const string &n):
-       Package(b, n),
-       need_path(false)
-{
-       use_pkgconfig=false;
-}
-
-/**
-Sets the path where the package files were installed.  This is only useful if
-the package doesn't use pkg-config.
-*/
-void BinaryPackage::set_path(const Msp::Path &p)
-{
-       path=builder.get_cwd()/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(StringList::iterator i=export_binfo.libpath.begin(); i!=export_binfo.libpath.end(); ++i)
-               if((*i)[0]=='@')
-                       *i=(path/i->substr(1)).str();
-}
-
-BinaryPackage *BinaryPackage::from_pkgconfig(Builder &builder, const string &name)
-{
-       list<string> argv;
-       argv.push_back("pkg-config");
-       argv.push_back("--silence-errors");
-       argv.push_back("--cflags");
-       argv.push_back("--libs");
-       argv.push_back(name);
-       if(builder.get_verbose()>=4)
-               cout<<"Running "<<join(argv.begin(), argv.end())<<'\n';
-       string info=run_command(argv);
-
-       if(info.empty())
-               return 0;
-
-
-       BinaryPackage *pkg=new BinaryPackage(builder, name);
-       pkg->use_pkgconfig=true;
-       BuildInfo &binfo=pkg->export_binfo;
-
-       vector<string> flags=split(info);
-       for(vector<string>::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));
-               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));
-       }
-
-       return pkg;
-}
-
-
-BinaryPackage::Loader::Loader(BinaryPackage &p):
-       Package::Loader(p)
-{
-       add("need_path", &BinaryPackage::need_path);
-       add("build_info", &Loader::build_info);
-}
-
-void BinaryPackage::Loader::build_info()
-{
-       load_sub(static_cast<BinaryPackage &>(pkg).export_binfo);
-}