#include <msp/fs/dir.h>
#include <msp/fs/stat.h>
#include <msp/fs/utils.h>
+#include <msp/strings/format.h>
#include <stdexcept>
#include "builder.h"
#include "component.h"
using namespace std;
using namespace Msp;
-GnuArchiver::GnuArchiver(Builder &b):
- Tool(b, "AR")
+GnuArchiver::GnuArchiver(Builder &b, const Architecture &a):
+ Tool(b, a, "AR")
{
- executable = builder.get_vfs().find_binary("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");
}
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;