X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Finstall.cpp;h=4040d19ed2f3325967331f118afda4ac36cef258;hb=338eefb513953ae55e8e3614c009c242ba8ad74e;hp=2b2a5c94f0bae872039104bbfb638cfa4de2b6f2;hpb=05a2b9dabd01414e9e9a91f9d69babaca4ccb32d;p=builder.git diff --git a/source/install.cpp b/source/install.cpp index 2b2a5c9..4040d19 100644 --- a/source/install.cpp +++ b/source/install.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include "builder.h" #include "copy.h" @@ -26,6 +19,13 @@ Install::Install(Builder &b, const SourcePackage &p, FileTarget &s, const std::s { buildable = true; add_depend(&source); + + if(const SharedLibrary *shlib = dynamic_cast(&source)) + if(!shlib->get_soname().empty()) + link = FS::dirname(path)/FS::basename(shlib->get_path()); + + if(!link.empty()) + builder.register_path(link, this); } Target *Install::get_real_target() @@ -43,15 +43,10 @@ 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()); @@ -62,7 +57,7 @@ FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string else if(const Header *hdr = dynamic_cast(&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(&tgt)) @@ -73,7 +68,8 @@ FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string if(comp.get_type()==Component::LIBRARY) { mid = "lib"; - tgtname = shlib->get_soname(); + if(!shlib->get_soname().empty()) + tgtname = shlib->get_soname(); } else if(comp.get_type()==Component::MODULE) mid = "lib/"+tgt.get_package()->get_name(); @@ -86,7 +82,7 @@ FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string 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; }