Stuart Henderson writes:

> On 2023/04/30 11:41, Thomas Frohwein wrote:
>> We have other ports that have shared libraries without version suffix;
>> games/lwjgl comes to mind for me. There are probably others, too.
>
> They aren't usually in /usr/local/lib though.
>
> If they're linked against by other ports, they should have versions.
>
> If they're just modules which are dlopen()d by the port then usually no
> versions.
>
>> > +REVISION =        1
>> > +
>> > +SHARED_LIBS +=    glslang 0.0 # 12.0
>> >  
>
> Does it add version numbers if you add the other libs to SHARED_LIBS and
> rebuild?

Adding to SHARED_LIBS is not sufficient. I also have to substitute
LIBSPIRV_VERSION into SOVERSION for plist to pick up the versioning.

In cmake, VERSION is the "build version" and SOVERSION is the "API
version."

see:
https://cmake.org/cmake/help/latest/prop_tgt/SOVERSION.html

I see the new helpful sections regarding cmake:
https://www.openbsd.org/faq/ports/specialtopics.html#SharedLibs

Since flycast only uses glslang and SPIRV shared objects, would this be
OK? Then, the other shared objects can remain unversioned until they are
linked against in the future.

I tested all consumers.

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/glslang/Makefile,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 Makefile
--- Makefile    30 Apr 2023 19:11:57 -0000      1.17
+++ Makefile    1 May 2023 21:53:44 -0000
@@ -5,9 +5,10 @@ COMMENT =      reference front-end for GLSL a
 GH_TAGNAME =   12.0.0
 GH_ACCOUNT =   KhronosGroup
 GH_PROJECT =   glslang
-REVISION =     1
+REVISION =     2
 
 SHARED_LIBS += glslang 0.0 # 12.0
+SHARED_LIBS += SPIRV   0.0 # 12.0
 
 CATEGORIES =   devel graphics
 
@@ -28,6 +29,9 @@ TEST_DEPENDS =        graphics/spirv-tools \
                shells/bash
 
 CONFIGURE_ARGS +=      -DBUILD_SHARED_LIBS=ON
+
+pre-configure:
+       ${SUBST_CMD} ${WRKSRC}/SPIRV/CMakeLists.txt
 
 do-test:
        cd ${WRKSRC}/Test; exec ./runtests localResults \
Index: patches/patch-SPIRV_CMakeLists_txt
===================================================================
RCS file: patches/patch-SPIRV_CMakeLists_txt
diff -N patches/patch-SPIRV_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-SPIRV_CMakeLists_txt  1 May 2023 21:53:44 -0000
@@ -0,0 +1,21 @@
+define SOVERSION for SPIRV to provide shared library version number
+
+see:
+https://github.com/KhronosGroup/glslang/commit/fbe9a23baf2cb020fe3f80d68d972e2a97d9b954#diff-c275da269cb9eab1ad823f3e969a1070057413af288a2318397b1c9415289fa1
+Index: SPIRV/CMakeLists.txt
+--- SPIRV/CMakeLists.txt.orig
++++ SPIRV/CMakeLists.txt
+@@ -71,8 +71,11 @@ set(SPVREMAP_HEADERS
+     doc.h)
+ 
+ add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
+-set_property(TARGET SPIRV PROPERTY FOLDER glslang)
+-set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
++set_target_properties(SPIRV PROPERTIES
++    FOLDER glslang
++    POSITION_INDEPENDENT_CODE ON
++    VERSION   "${GLSLANG_VERSION}"
++    SOVERSION "${LIBSPIRV_VERSION}")
+ target_include_directories(SPIRV PUBLIC
+     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+     $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/glslang/pkg/PLIST,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 PLIST
--- pkg/PLIST   30 Apr 2023 19:11:57 -0000      1.7
+++ pkg/PLIST   1 May 2023 21:53:44 -0000
@@ -83,7 +83,7 @@ lib/cmake/glslang/glslang-targets.cmake
 lib/cmake/glslangValidatorTargets.cmake
 lib/cmake/spirv-remapTargets.cmake
 @so lib/libHLSL.so
-@so lib/libSPIRV.so
+@lib lib/libSPIRV.so.${LIBSPIRV_VERSION}
 @so lib/libSPVRemapper.so
 @so lib/libglslang-default-resource-limits.so
 @lib lib/libglslang.so.${LIBglslang_VERSION}

Reply via email to