X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsharedlibrary.cpp;h=a6e8239524c91fb9775620ac41445d2e08395e8b;hb=c3968651eb8a2ba66a95398f0571dd5afd37225c;hp=6600b740332a23dff7a882a0a63e6c99afcbd8ec;hpb=ec0d6014aa2db4a02588c9027e7dba17507df364;p=builder.git diff --git a/source/sharedlibrary.cpp b/source/sharedlibrary.cpp index 6600b74..a6e8239 100644 --- a/source/sharedlibrary.cpp +++ b/source/sharedlibrary.cpp @@ -1,7 +1,7 @@ #include #include +#include "binarycomponent.h" #include "builder.h" -#include "component.h" #include "objectfile.h" #include "sharedlibrary.h" #include "sourcepackage.h" @@ -28,7 +28,8 @@ SharedLibrary::SharedLibrary(Builder &b, const Component &c, const listget_type()==Component::MODULE) + const BinaryComponent &bcomp = dynamic_cast(*component); + if(bcomp.get_type()==BinaryComponent::MODULE) install_location /= package->get_name(); else { @@ -36,35 +37,30 @@ SharedLibrary::SharedLibrary(Builder &b, const Component &c, const listget_name(), version)); + soname = arch.create_filename(format("%s-%s", libname, version)); else if(arch.get_system()=="darwin") - { - string filename = pattern.apply(component->get_name()); - string base = FS::basepart(filename); - string ext = FS::extpart(filename); - soname = format("%s.%s%s", base, version, ext); - } + soname = arch.create_filename(format("%s.%s", libname, version)); else - soname = format("%s.%s", pattern.apply(component->get_name()), version); + soname = format("%s.%s", arch.create_filename(libname), version); install_filename = soname; } } - for(list::const_iterator i=objects.begin(); i!=objects.end(); ++i) - (*i)->set_used_in_shared_library(true); + for(ObjectFile *o: objects) + o->set_used_in_shared_library(true); } string SharedLibrary::generate_filename(const Component &comp) { - if(comp.get_type()==Component::MODULE) - return comp.get_name()+".m"; + const BinaryComponent &bcomp = dynamic_cast(comp); + if(bcomp.get_type()==BinaryComponent::MODULE) + return comp.get_name()+".dlm"; else { const Architecture &arch = comp.get_package().get_builder().get_current_arch(); - return arch.get_shared_library_patterns().front().apply(comp.get_name()); + return arch.create_filename(comp.get_name()); } }