one percent sign (%) to separate the prefix and suffix. */
Pattern(const std::string &);
+ const std::string &get_prefix() const { return prefix; }
+ const std::string &get_suffix() const { return suffix; }
+
/** Applies the pattern to a body string. */
std::string apply(const std::string &) const;
using namespace Msp;
SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p):
- Binary(b, p)
+ Binary(b, p),
+ libname(FS::basepart(FS::basename(p)))
{
- libname = FS::basepart(FS::basename(path));
- if(!libname.compare(0, 3, "lib"))
- libname = libname.substr(3);
+ const string &lib_prefix = builder.get_current_arch().get_patterns<SharedLibrary>().front().get_prefix();
+ if(!libname.compare(0, lib_prefix.size(), lib_prefix))
+ libname = libname.substr(lib_prefix.size());
}
SharedLibrary::SharedLibrary(Builder &b, const Component &c, const vector<ObjectFile *> &objs):
libname(c.get_name()),
import_lib(0)
{
- if(!libname.compare(0, 3, "lib"))
- libname = libname.substr(3);
+ const string &lib_prefix = builder.get_current_arch().get_patterns<SharedLibrary>().front().get_prefix();
+ if(!libname.compare(0, lib_prefix.size(), lib_prefix))
+ libname = libname.substr(lib_prefix.size());
if(builder.get_current_arch().get_system()=="windows")
install_location = "bin";