X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgnuarchiver.cpp;h=71edc42d57d26d09560c9ddc1b389e0febcedae9;hb=a116ad9af4a6a75093f6e1c3603d16b397833154;hp=4916408e312607e840cfc9314bc3ee8061b6e760;hpb=668eb3ab45834e27ad332f07ce4ddb45e2d55418;p=builder.git diff --git a/source/gnuarchiver.cpp b/source/gnuarchiver.cpp index 4916408..71edc42 100644 --- a/source/gnuarchiver.cpp +++ b/source/gnuarchiver.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "builder.h" #include "component.h" @@ -13,9 +14,14 @@ using namespace std; using namespace Msp; -GnuArchiver::GnuArchiver(Builder &b): - Tool(b, "AR") +GnuArchiver::GnuArchiver(Builder &b, const Architecture &a): + Tool(b, a, "AR") { + string command = "ar"; + if(architecture->is_cross()) + command = format("%s-%s", architecture->get_cross_prefix(), command); + executable = builder.get_vfs().find_binary(command); + input_suffixes.push_back(".o"); } @@ -33,7 +39,7 @@ Target *GnuArchiver::create_target(const list &sources, const string & throw invalid_argument("GnuArchiver::create_target"); } - const Component &comp = objs.front()->get_component(); + const Component &comp = *objs.front()->get_component(); StaticLibrary *lib = new StaticLibrary(builder, comp, objs); lib->set_tool(*this); return lib; @@ -45,7 +51,7 @@ Task *GnuArchiver::run(const Target &target) const const Component &comp = *lib.get_component(); vector argv; - argv.push_back("ar"); + argv.push_back(executable->get_path().str()); argv.push_back("rc"); FS::Path work_dir = comp.get_package().get_source();