openbsd-ports/devel/cmake/patches/patch-Source_cmTarget_cxx
dcoppa 8b1b17cff8 Update to cmake 2.8.1 (I also take maintainership).
"This is good, commit." espie@
2010-05-28 20:21:48 +00:00

66 lines
1.9 KiB
Plaintext

$OpenBSD: patch-Source_cmTarget_cxx,v 1.4 2010/05/28 20:21:48 dcoppa Exp $
--- Source/cmTarget.cxx.orig Tue Apr 6 16:45:35 2010
+++ Source/cmTarget.cxx Tue May 11 16:37:04 2010
@@ -3136,6 +3136,34 @@ void cmTarget::GetLibraryNames(std::string& name,
// Check for library version properties.
const char* version = this->GetProperty("VERSION");
const char* soversion = this->GetProperty("SOVERSION");
+
+ /* OpenBSD - LIBxxx_VERSION environment override.
+ * Needed for OpenBSD ports system.
+ */
+ std::string env_name = "LIB" + Name + "_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 {
+ /* all OK, use OpenBSD override */
+ soversion = env_vers_cstr;
+ version = env_vers_cstr;
+ }
+ }
+
if((this->GetType() != cmTarget::SHARED_LIBRARY &&
this->GetType() != cmTarget::MODULE_LIBRARY) ||
!this->Makefile->GetDefinition(sonameFlag.c_str()) ||
@@ -3186,8 +3214,26 @@ void cmTarget::GetLibraryNames(std::string& name,
if(version)
{
realName += ".";
+#if defined(__OpenBSD__)
+ // libname.so.X.X.X -> libname.so.X.X conversion
+ 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 += ".";