X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finstall.cpp;h=6f6bca3432266ef1d4ee70950dea45f835aab946;hb=43bd25ffcb0b4f7882773f4676b209a99cb73c04;hp=893f021387cbb81e346fb47e8418f8402ee58c49;hpb=04c316da6d5d90e43cba262f54d90ca231f703bf;p=builder.git diff --git a/source/install.cpp b/source/install.cpp index 893f021..6f6bca3 100644 --- a/source/install.cpp +++ b/source/install.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include "builder.h" #include "copy.h" @@ -28,14 +21,19 @@ Install::Install(Builder &b, const SourcePackage &p, FileTarget &s, const std::s add_depend(&source); } +Target *Install::get_real_target() +{ + return source.get_real_target(); +} + void Install::check_rebuild() { if(!mtime) mark_rebuild("Does not exist"); else if(source.get_mtime()>mtime || source.get_size()!=size) - mark_rebuild(FS::basename(source.get_name())+" has changed"); + mark_rebuild(source.get_name()+" has changed"); else if(source.get_rebuild()) - mark_rebuild(FS::basename(source.get_name())+" needs rebuilding"); + mark_rebuild(source.get_name()+" needs rebuilding"); } Action *Install::create_action() @@ -46,7 +44,7 @@ Action *Install::create_action() 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()); @@ -57,7 +55,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)) @@ -66,7 +64,11 @@ FS::Path Install::generate_target_path(const FileTarget &tgt, const std::string { 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(); } @@ -78,7 +80,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(); }