openbsd_versioning.patch raw
1 [cmake] Fix shared library versioning on OpenBSD.
2
3 This emulates Libtool to make sure Libtool and CMake agree on the ABI
4 version. Specifically, for OpenBSD, `builds/unix/configure` defines
5 `version_type=sunos` and skips defining `soname_spec`.
6
7 See upstream MR: https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/433.
8
9 --- a/CMakeLists.txt
10 +++ b/CMakeLists.txt
11 @@ -458,9 +458,17 @@ if (WIN32)
12 endif ()
13
14 if (BUILD_SHARED_LIBS)
15 - set_target_properties(freetype PROPERTIES
16 - VERSION ${LIBRARY_VERSION}
17 - SOVERSION ${LIBRARY_SOVERSION})
18 + if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
19 + # For OpenBSD, libtool follows `sunos` version type.
20 + set_target_properties(freetype PROPERTIES
21 + # libtool does not define its internal `soname_spec` variable
22 + # for OpenBSD. So skipping the SOVERSION option.
23 + VERSION ${LIBTOOL_CURRENT}.${LIBTOOL_REVISION})
24 + else ()
25 + set_target_properties(freetype PROPERTIES
26 + VERSION ${LIBRARY_VERSION}
27 + SOVERSION ${LIBRARY_SOVERSION})
28 + endif ()
29 endif ()
30
31 # Pick up ftconfig.h and ftoption.h generated above, first.
32