Yet another cmake patch, which needs a full bulk test. Many of you will certainly know it, our cmake's SHARED_LIBS handling is broken for new shared libs.
The default "0.0" version has been broken for several months/years. Here is a attempt to fix this. With the following patch you get back the following lines, if (a) LIBxxx_VERSION is not set and (b) SOVERSION for the shared lib is set by cmake. (a) is clear but (b) helps us to handle shared libs and not plugins (dlopen) aka shared libs without version. ... Warning: unregistered shared lib(s) SHARED_LIBS += fmt 0.0 # 0.0 /usr/ports/devel/fmt/pkg/PLIST is new Patch changes: - Remove MODULE_LIBRARY processing. "MODULE libraries are plugins that are not linked into other targets but may be loaded dynamically at runtime using dlopen-like functionality." -- https://cmake.org/cmake/help/latest/command/add_library.html - Add default "0.0" version: if type SHARED_LIBRARY AND empty LIBxxx_VERSION BUT SOVERSION is set. I would appreciate a bulk test, unfortunately I can't do one. Rafael Index: Makefile =================================================================== RCS file: /cvs/ports/devel/cmake/Makefile,v retrieving revision 1.204 diff -u -p -u -p -r1.204 Makefile --- Makefile 26 Feb 2022 19:42:28 -0000 1.204 +++ Makefile 26 Feb 2022 21:18:17 -0000 @@ -8,7 +8,7 @@ VER = 3.20.3 EPOCH = 0 DISTNAME = cmake-${VER} CATEGORIES = devel -REVISION = 4 +REVISION = 5 HOMEPAGE = https://www.cmake.org/ Index: patches/patch-Source_cmGeneratorTarget_cxx =================================================================== RCS file: /cvs/ports/devel/cmake/patches/patch-Source_cmGeneratorTarget_cxx,v retrieving revision 1.16 diff -u -p -u -p -r1.16 patch-Source_cmGeneratorTarget_cxx --- patches/patch-Source_cmGeneratorTarget_cxx 9 May 2021 14:46:15 -0000 1.16 +++ patches/patch-Source_cmGeneratorTarget_cxx 26 Feb 2022 21:18:17 -0000 @@ -3,31 +3,14 @@ $OpenBSD: patch-Source_cmGeneratorTarget Index: Source/cmGeneratorTarget.cxx --- Source/cmGeneratorTarget.cxx.orig +++ Source/cmGeneratorTarget.cxx -@@ -4810,9 +4810,14 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibrary - // Check for library version properties. - cmProp version = this->GetProperty("VERSION"); - cmProp soversion = this->GetProperty("SOVERSION"); -+#if defined(__OpenBSD__) -+ if (this->GetType() != cmStateEnums::SHARED_LIBRARY && -+ this->GetType() != cmStateEnums::MODULE_LIBRARY) { -+#else - if (!this->HasSOName(config) || - this->Makefile->IsOn("CMAKE_PLATFORM_NO_VERSIONED_SONAME") || - this->IsFrameworkOnApple()) { -+#endif - // Versioning is supported only for shared libraries and modules, - // and then only when the platform supports an soname flag. - version = nullptr; -@@ -4836,6 +4841,36 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibrary - +@@ -4837,6 +4837,41 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibrary // The library name. targetNames.Output = prefix + targetNames.Base + suffix; -+ + +#if defined(__OpenBSD__) + // Override shared library version using LIBxxx_VERSION + // environment variable. Needed for OpenBSD ports system. -+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY || -+ this->GetType() == cmStateEnums::MODULE_LIBRARY) { ++ if (this->GetType() == cmStateEnums::SHARED_LIBRARY) { + + std::string env_vers; + const std::string env_name("LIB" + targetNames.Base + "_VERSION"); @@ -44,14 +27,21 @@ Index: Source/cmGeneratorTarget.cxx + msg += " specification: "; + msg += env_vers; + this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg); -+ } else { ++ } ++ else { + version = new std::string(env_vers); + soversion = new std::string(env_vers); + } + } ++ else { ++ if (soversion) { ++ version = new std::string("0.0"); ++ soversion = new std::string("0.0"); ++ } ++ } + } +#endif + - if (this->IsFrameworkOnApple()) { targetNames.Real = prefix; + if (!this->Makefile->PlatformIsAppleEmbedded()) {