]> git.tdb.fi Git - builder.git/blobdiff - source/sharedlibrary.cpp
Get rid of the Library and SystemLibrary classes as unnecessary abstractions
[builder.git] / source / sharedlibrary.cpp
index a3225171836eafb10a67f30e3191ccc660d8901c..d3a8ceb25568e8f4077cc077f3deeb3dea69062a 100644 (file)
@@ -1,11 +1,5 @@
-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include <msp/strings/formatter.h>
+#include <msp/fs/utils.h>
+#include <msp/strings/format.h>
 #include "component.h"
 #include "sharedlibrary.h"
 #include "sourcepackage.h"
@@ -13,12 +7,26 @@ Distributed under the LGPL
 using namespace std;
 using namespace Msp;
 
+SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p):
+       Binary(b, p)
+{
+       libname = FS::basepart(FS::basename(path));
+       if(!libname.compare(0, 3, "lib"))
+               libname = libname.substr(3);
+}
+
 SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
-       FileTarget(b, &c.get_package(), generate_target_path(c)),
        Binary(b, c, objs),
-       Library(b, &c.get_package(), path, c.get_name()),
+       libname(c.get_name()),
        soname(create_soname(c))
-{ }
+{
+       install_location = "lib";
+       if(component->get_type()==Component::MODULE)
+       {
+               install_location += '/';
+               install_location += package->get_name();
+       }
+}
 
 string SharedLibrary::create_soname(const Component &c)
 {
@@ -36,5 +44,5 @@ string SharedLibrary::create_soname(const Component &c)
                                break;
                }
 
-       return format("%s.%s", name, ver.substr(0, i));
+       return format("%s.%s", FS::basename(path), ver.substr(0, i));
 }