X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsharedlibrary.cpp;h=24e0e205682acec12951035b32d84bc26a9a0ece;hb=903a5727ef1f8a7f540e162139396163c736d484;hp=d3a8ceb25568e8f4077cc077f3deeb3dea69062a;hpb=dc4b917034c9d3718f07139e2f0f3631a080c6f3;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index d3a8ceb..24e0e20 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -1,5 +1,6 @@ #include #include +#include "builder.h" #include "component.h" #include "sharedlibrary.h" #include "sourcepackage.h" @@ -16,9 +17,8 @@ SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p): } SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list &objs): - Binary(b, c, objs), - libname(c.get_name()), - soname(create_soname(c)) + Binary(b, c, generate_filename(c), objs), + libname(c.get_name()) { install_location = "lib"; if(component->get_type()==Component::MODULE) @@ -26,23 +26,26 @@ SharedLibrary::SharedLibrary(Builder &b, const Component &c, const listget_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) + const string &version = component->get_package().get_version(); + if(!version.empty()) + { + string::size_type i = 0; + for(unsigned dots=0; i=2) break; - } - return format("%s.%s", FS::basename(path), ver.substr(0, i)); + soname = format("%s.%s", FS::basename(path), version.substr(0, i)); + } +} + +string SharedLibrary::generate_filename(const Component &comp) +{ + if(comp.get_type()==Component::MODULE) + return comp.get_name()+".m"; + else + { + const Architecture &arch = comp.get_package().get_builder().get_current_arch(); + return arch.get_shared_library_patterns().front().apply(comp.get_name()); + } }