X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsharedlibrary.cpp;h=606593bda0d88c82d3299e33db6a7a540d1876f4;hb=43bd25ffcb0b4f7882773f4676b209a99cb73c04;hp=25034f3fcd0245bf1a8d848f81d8fba413744c09;hpb=7aeaa4ba965f596edad438c02e345a8843f7469a;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index 25034f3..606593b 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -1,18 +1,33 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include "component.h" -#include "package.h" #include "sharedlibrary.h" +#include "sourcepackage.h" using namespace std; +using namespace Msp; SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list &objs): - Executable(b, c, objs), - libname(c.get_name()) + FileTarget(b, &c.get_package(), generate_target_path(c)), + Binary(b, c, objs), + Library(b, &c.get_package(), path, c.get_name()), + soname(create_soname(c)) { } +string SharedLibrary::create_soname(const Component &c) +{ + const string &ver = c.get_package().get_version(); + if(ver.empty()) + return string(); + + unsigned dots = 0; + unsigned i = 0; + for(; i=2) + break; + } + + return format("%s.%s", name, ver.substr(0, i)); +}