4cd9f900fc
Tested in a bulk build by landry@. Lot of feedback from various people on ports@: thanks! OK landry@, sthen@
69 lines
2.0 KiB
Plaintext
69 lines
2.0 KiB
Plaintext
$OpenBSD: patch-Source_cmTarget_cxx,v 1.8 2011/03/13 18:23:02 dcoppa Exp $
|
|
--- Source/cmTarget.cxx.orig Tue Feb 15 18:47:31 2011
|
|
+++ Source/cmTarget.cxx Mon Mar 7 10:10:46 2011
|
|
@@ -3237,6 +3237,36 @@ void cmTarget::GetLibraryNames(std::string& name,
|
|
std::string suffix;
|
|
this->GetFullNameInternal(config, false, prefix, base, suffix);
|
|
|
|
+#if defined(__OpenBSD__)
|
|
+ // Override shared library version using LIBxxx_VERSION
|
|
+ // environment variable. Needed for OpenBSD ports system.
|
|
+ if(this->GetType() == cmTarget::SHARED_LIBRARY ||
|
|
+ this->GetType() == cmTarget::MODULE_LIBRARY)
|
|
+ {
|
|
+ std::string env_name = "LIB" + base + "_VERSION";
|
|
+ char *env_vers_cstr = getenv(env_name.c_str());
|
|
+
|
|
+ if (env_vers_cstr != NULL) {
|
|
+ // This means an override is present.
|
|
+ std::string env_vers = std::string(env_vers_cstr);
|
|
+
|
|
+ size_t first = env_vers.find_first_of(".");
|
|
+ size_t last = env_vers.find_first_of(".");
|
|
+
|
|
+ if ((first != last) || (first == std::string::npos)) {
|
|
+ std::string msg = "Bad ";
|
|
+ msg += env_name;
|
|
+ msg += " specification: ";
|
|
+ msg += env_vers;
|
|
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
|
|
+ msg.c_str());
|
|
+ } else {
|
|
+ soversion = version = env_vers_cstr;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
+
|
|
// The library name.
|
|
name = prefix+base+suffix;
|
|
|
|
@@ -3271,8 +3301,27 @@ void cmTarget::GetLibraryNames(std::string& name,
|
|
if(version)
|
|
{
|
|
realName += ".";
|
|
+#if defined(__OpenBSD__)
|
|
+ // OpenBSD-style versioning scheme for shared libraries.
|
|
+ // Convert libname.so.X.X.X to libname.so.X.X
|
|
+ int j = 0;
|
|
+ for (int i = 0; i < (int)strlen(version); i++)
|
|
+ {
|
|
+ if (version[i] == '.')
|
|
+ {
|
|
+ j++;
|
|
+ if (j == 2)
|
|
+ {
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ realName += version[i];
|
|
+ }
|
|
+ }
|
|
+#else
|
|
realName += version;
|
|
}
|
|
+#endif
|
|
else if(soversion)
|
|
{
|
|
realName += ".";
|