openbsd-ports/devel/cmake/patches/patch-Source_cmFileCommand_cxx
2007-08-25 08:35:20 +00:00

49 lines
1.8 KiB
Plaintext

$OpenBSD: patch-Source_cmFileCommand_cxx,v 1.2 2007/08/25 08:35:20 espie Exp $
--- Source/cmFileCommand.cxx.orig Mon Jul 16 23:12:30 2007
+++ Source/cmFileCommand.cxx Mon Aug 13 02:50:05 2007
@@ -1279,10 +1279,44 @@ bool cmFileCommand::HandleInstallCommand(
std::string libname = toFile;
std::string soname = toFile;
std::string soname_nopath = fromName;
+#if defined(__OpenBSD__)
+ // need to tweak version for our shared libraries
+ std::string myversion = lib_version;
+ if (itype == cmTarget::SHARED_LIBRARY) {
+ // namely, transform version from 5.0.0 -> 5.0
+
+ int j = 0;
+
+ for (int i = 0; i < myversion.size(); i++) {
+ if (myversion[i] == '.') {
+ j++;
+ if (j == 2) {
+ myversion.erase(i);
+ break;
+ }
+ }
+ }
+ int n = fromName.length();
+ if (fromName.compare(0, 3, "lib") == 0 &&
+ fromName.compare(n-3, n, ".so") == 0) {
+ std::string base = fromName.substr(3, n-6);
+ // if the env says so, produce a tweaked version number instead
+ std::string v = "LIB" +base + "_VERSION";
+ char *tweaked = ::getenv(v.c_str());
+ if (tweaked)
+ myversion = tweaked;
+ }
+ }
+ this->ComputeVersionedLibName(soname, myversion.c_str());
+ this->ComputeVersionedLibName(soname_nopath, myversion.c_str());
+ this->ComputeVersionedLibName(fromName, myversion.c_str());
+ this->ComputeVersionedLibName(toFile, myversion.c_str());
+#else
this->ComputeVersionedLibName(soname, lib_soversion);
this->ComputeVersionedLibName(soname_nopath, lib_soversion);
this->ComputeVersionedLibName(fromName, lib_version);
this->ComputeVersionedLibName(toFile, lib_version);
+#endif
cmSystemTools::RemoveFile(soname.c_str());
cmSystemTools::RemoveFile(libname.c_str());