#include "binarypackage.h"
#include "builder.h"
#include "copy.h"
+#include "externaltask.h"
#include "gnuarchiver.h"
#include "gnuccompiler.h"
#include "gnucxxcompiler.h"
#include "gnulinker.h"
#include "installedfile.h"
-#include "misc.h"
#include "package.h"
#include "pkgconfigfile.h"
#include "pkgconfiggenerator.h"
cwd = FS::getcwd();
- toolchain.add_tool(new GnuCCompiler(*this));
- toolchain.add_tool(new GnuCxxCompiler(*this));
- toolchain.add_tool(new GnuLinker(*this));
- toolchain.add_tool(new GnuArchiver(*this));
- toolchain.add_tool(new Copy(*this));
- toolchain.add_tool(new Tar(*this));
- toolchain.add_tool(new PkgConfigGenerator(*this));
-
load_build_file((FS::get_sys_data_dir(argv[0], "builder")/"builderrc").str());
load_build_file((FS::get_user_data_dir("builder")/"rc").str());
}
}
+ toolchain.add_tool(new GnuCCompiler(*this));
+ toolchain.add_tool(new GnuCxxCompiler(*this));
+ toolchain.add_tool(new GnuLinker(*this));
+ toolchain.add_tool(new GnuArchiver(*this));
+ toolchain.add_tool(new Copy(*this));
+ toolchain.add_tool(new Tar(*this));
+ toolchain.add_tool(new PkgConfigGenerator(*this));
+
if(prfx.empty())
{
if(current_arch->is_native())
string Builder::run_pkgconfig(const string &pkg, const string &what)
{
- list<string> argv;
+ ExternalTask::Arguments argv;
argv.push_back("pkg-config");
if(what=="cflags" || what=="libs")
argv.push_back("--"+what);
if(verbose>=4)
IO::print("Running %s\n", join(argv.begin(), argv.end()));
- int status;
- string res = run_command(argv, &status);
- if(status)
+ ExternalTask task(argv);
+ task.set_stdout(ExternalTask::CAPTURE);
+ task.set_stderr(ExternalTask::IGNORE);
+ task.start();
+ Task::Status status;
+ while((status=task.check())==Task::RUNNING)
+ Time::sleep(10*Time::msec);
+ if(status==Task::ERROR)
throw runtime_error(format("pkg-config for package %s failed", pkg));
- return res;
+ return task.get_output();
}
Package *Builder::get_package(const string &name)