X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farchive.cpp;h=6d1d502ebebfcef3538fb293544d3e13b8f85e68;hb=43bd25ffcb0b4f7882773f4676b209a99cb73c04;hp=4dee50899f123ad580b5f3f66997527446442fec;hpb=654de39b62a9a58fd8e1b5a557361d628345788b;p=builder.git diff --git a/source/archive.cpp b/source/archive.cpp index 4dee508..6d1d502 100644 --- a/source/archive.cpp +++ b/source/archive.cpp @@ -1,11 +1,6 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include +#include +#include +#include #include "archive.h" #include "builder.h" #include "component.h" @@ -19,22 +14,29 @@ using namespace Msp; Archive::Archive(Builder &b, const StaticLibrary &lib): ExternalAction(b) { - const Component &comp=lib.get_component(); + const Component &comp = lib.get_component(); + + work_dir = comp.get_package().get_source(); - argv.push_back(builder.get_tool("AR", comp.get_package().get_arch())); + std::string tool = "AR"; + argv.push_back(builder.get_current_arch().get_tool(tool)); argv.push_back("rc"); - argv.push_back(lib.get_name()); - const TargetList &deps=lib.get_depends(); + argv.push_back(relative(lib.get_path(), work_dir).str()); + const TargetList &deps = lib.get_depends(); for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i) - if(dynamic_cast(*i)) - argv.push_back((*i)->get_name()); + if(ObjectFile *obj = dynamic_cast(*i)) + argv.push_back(relative(obj->get_path(), work_dir).str()); - Path::Path lpath=lib.get_name(); + FS::Path lpath = lib.get_path(); if(!builder.get_dry_run()) - Path::mkpath(lpath.subpath(0, lpath.size()-1), 0755); + { + FS::mkpath(FS::dirname(lpath), 0755); + if(FS::exists(lib.get_path())) + FS::unlink(lib.get_path()); + } - announce(comp.get_package().get_name(), "AR ", relative(lpath, comp.get_package().get_source()).str()); + announce(comp.get_package().get_name(), tool, relative(lpath, work_dir).str().substr(2)); launch(); }