X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsharedlibrary.cpp;h=6a197bac08c69535ccb53fd98b62d6a04c7c189f;hb=dcaf06c2bba4e02a312cd6af24ddc96410e7be4e;hp=557f7fe9c19ae0429c93592521f88fe8e767f046;hpb=4fcc283a4bb1f695bd124006906bcdaba053193f;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index 557f7fe..6a197ba 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -1,10 +1,34 @@ +#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) + 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", FS::basename(path), ver.substr(0, i)); +}