X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fsharedlibrary.cpp;h=fac651a8e3518737187f817c0d4d14ee2575e036;hb=16bda19cc87b5064daad9955f0ebb5ac5be7dec7;hp=0431f27f91e44c26ab45475e5dff48deefeb3c4e;hpb=4f78d9f016482ce1ac7d726852e33e07c090df1b;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index 0431f27..fac651a 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -1,11 +1,41 @@ +#include +#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)) +{ + install_location = "lib"; + if(comp.get_type()==Component::MODULE) + { + install_location += '/'; + install_location += package->get_name(); + } +} +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", FS::basename(path), ver.substr(0, i)); +}