openbsd-ports/devel/cmake/patches/patch-Source_cmTarget_cxx

51 lines
1.5 KiB
Plaintext

$OpenBSD: patch-Source_cmTarget_cxx,v 1.3 2008/01/26 21:26:32 espie Exp $
--- Source/cmTarget.cxx.orig Mon Jan 21 19:59:53 2008
+++ Source/cmTarget.cxx Sat Jan 26 20:47:17 2008
@@ -1480,6 +1480,46 @@ void cmTarget::GetLibraryNamesInternal(std::string& na
realName += suffix;
#endif
+#if defined(__OpenBSD__)
+ // need to tweak version for our shared libraries
+ if (type == cmTarget::SHARED_LIBRARY) {
+ if (version) {
+ // namely, transform version from 5.0.0 -> 5.0
+ std::string myversion = version;
+
+ int j = 0;
+
+ for (int i = 0; i < myversion.size(); i++) {
+ if (myversion[i] == '.') {
+ j++;
+ if (j == 2) {
+ myversion.erase(i);
+ break;
+ }
+ }
+ }
+ // if the env says so, produce a tweaked version number instead
+ std::string v = "LIB" +base + "_VERSION";
+ char *tweaked = ::getenv(v.c_str());
+#if 0
+ char *logname = ::getenv("SHARED_LIBS_LOG");
+ if (logname) {
+ std::ofstream logfile(logname, std::ios_base::out | std::ios_base::app);
+ if (logfile)
+ logfile << "SHARED_LIBS += " << base << " "
+ << tweaked << " # " << myversion << "\n";
+ }
+#endif
+ if (tweaked)
+ myversion = tweaked;
+ else
+ tweaked = "";
+ // all our shared libs have major.number, no links
+ realName = prefix+base+".so."+myversion;
+ soName = realName;
+ }
+ }
+#endif
// The import library name.
if(type == cmTarget::SHARED_LIBRARY)
{