openbsd-ports/devel/cmake/patches/patch-Source_cmFileCommand_cxx
dcoppa 64ab3526bf Avoid creating .so symlinks for shared libraries, as they break
OpenBSD porting standards.

OK landry@, sthen@
"if it works and other people like it, go ahead" espie@
2010-04-15 20:30:47 +00:00

62 lines
2.3 KiB
Plaintext

$OpenBSD: patch-Source_cmFileCommand_cxx,v 1.3 2010/04/15 20:30:47 dcoppa Exp $
--- Source/cmFileCommand.cxx.orig Mon Jan 21 19:59:52 2008
+++ Source/cmFileCommand.cxx Sun Apr 4 18:54:42 2010
@@ -1279,14 +1279,49 @@ 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());
+#if !defined(__OpenBSD__)
if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(),
libname.c_str()) )
{
@@ -1296,6 +1331,7 @@ bool cmFileCommand::HandleInstallCommand(
return false;
}
installer.ManifestAppend(libname);
+#endif
if ( toFile != soname )
{
if ( !cmSystemTools::CreateSymlink(fromName.c_str(),