3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include <msp/path/utils.h>
11 #include "component.h"
12 #include "objectfile.h"
13 #include "sourcepackage.h"
14 #include "staticlibrary.h"
19 Archive::Archive(Builder &b, const StaticLibrary &lib):
22 const Component &comp=lib.get_component();
24 work_dir=comp.get_package().get_source();
26 std::string tool="AR";
27 argv.push_back(builder.get_current_arch().get_tool(tool));
30 argv.push_back(relative(lib.get_name(), work_dir).str());
31 const TargetList &deps=lib.get_depends();
32 for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
33 if(dynamic_cast<ObjectFile *>(*i))
34 argv.push_back(relative((*i)->get_name(), work_dir).str());
36 Path lpath=lib.get_name();
37 if(!builder.get_dry_run())
38 mkpath(lpath.subpath(0, lpath.size()-1), 0755);
40 announce(comp.get_package().get_name(), tool, relative(lpath, work_dir).str());