3 This file is part of builder
4 Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #include <msp/fs/dir.h>
9 #include <msp/fs/utils.h>
12 #include "component.h"
13 #include "objectfile.h"
14 #include "sourcepackage.h"
15 #include "staticlibrary.h"
20 Archive::Archive(Builder &b, const StaticLibrary &lib):
23 const Component &comp=lib.get_component();
25 work_dir=comp.get_package().get_source();
27 std::string tool="AR";
28 argv.push_back(builder.get_current_arch().get_tool(tool));
31 argv.push_back(relative(lib.get_name(), work_dir).str());
32 const TargetList &deps=lib.get_depends();
33 for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
34 if(dynamic_cast<ObjectFile *>(*i))
35 argv.push_back(relative((*i)->get_name(), work_dir).str());
37 FS::Path lpath=lib.get_name();
38 if(!builder.get_dry_run())
39 FS::mkpath(FS::dirname(lpath), 0755);
41 announce(comp.get_package().get_name(), tool, relative(lpath, work_dir).str());