-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#include <msp/fs/utils.h>
#include "builder.h"
#include "copy.h"
{
buildable = true;
add_depend(&source);
+
+ if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&source))
+ if(!shlib->get_soname().empty())
+ link = FS::dirname(path)/FS::basename(shlib->get_path());
+
+ if(!link.empty())
+ builder.get_vfs().register_path(link, this);
+}
+
+Target *Install::get_real_target()
+{
+ return source.get_real_target();
}
void Install::check_rebuild()
mark_rebuild(source.get_name()+" needs rebuilding");
}
-Action *Install::create_action()
-{
- return new Copy(builder, *package, source.get_path(), path);
-}
-
FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string &loc)
{
if(!tgt.get_package())
- throw InvalidParameterValue("Can't install package-less targets");
+ throw invalid_argument("Can't install package-less targets");
FS::Path base = tgt.get_package()->get_builder().get_prefix();
string tgtname = FS::basename(tgt.get_path());
else if(const Header *hdr = dynamic_cast<const Header *>(&tgt))
{
if(hdr->get_component()->get_type()!=Component::HEADERS)
- throw Exception("Header install from non-header component?");
+ throw logic_error("Header install from non-header component?");
mid = "include/"+hdr->get_component()->get_name();
}
else if(dynamic_cast<const Executable *>(&tgt))
{
const Component &comp = shlib->get_component();
if(comp.get_type()==Component::LIBRARY)
+ {
mid = "lib";
+ if(!shlib->get_soname().empty())
+ tgtname = shlib->get_soname();
+ }
else if(comp.get_type()==Component::MODULE)
mid = "lib/"+tgt.get_package()->get_name();
}
mid = "share/"+tgt.get_package()->get_name();
if(mid.empty())
- throw InvalidParameterValue("Don't know where to install "+tgtname);
+ throw invalid_argument("Don't know where to install "+tgtname);
- return (base/mid/tgtname).str();
+ return base/mid/tgtname;
}