X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsharedlibrary.cpp;h=868e822159847deebf24a76ff23867442485c142;hb=0458300fda4f345f865a7f3ee4fc0f2020a91983;hp=5c2d26fea27f799521c6697fc3803db959ea23f4;hpb=66d1078c04849ec17a7343d0494d6ed087e04318;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index 5c2d26f..868e822 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -5,14 +5,36 @@ Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include "component.h" #include "sharedlibrary.h" #include "sourcepackage.h" using namespace std; +using namespace Msp; SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list &objs): FileTarget(b, &c.get_package(), generate_target_path(c)), Binary(b, c, objs), - Library(b, &c.get_package(), path, c.get_name()) + 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)); +}