On 2023-05-07 Andreas Metzler <ametz...@bebt.de> wrote:
[...]
> The only proper fix would be to use versioned symbols for libpoppler
> (and libpoppler-glib while we are at it). This should not be rocket
> science, just tie it to the soname.

> But that needs to happen upstream.

Something like attached patch.
cu Andreas
Description: Use symbol versioning for libpoppler
 .
 This needs to be applied upstream when the soname is bumped.
Author: Andreas Metzler <ametz...@debian.org>
Origin: vendor
Bug-Debian: https://bugs.debian.org/969907
Forwarded: no
Last-Update: 2023-05-14

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -572,16 +572,31 @@ ADD_GPERF_FILE(TimesBoldWidths)
 ADD_GPERF_FILE(TimesBoldItalicWidths)
 ADD_GPERF_FILE(TimesItalicWidths)
 ADD_GPERF_FILE(TimesRomanWidths)
 ADD_GPERF_FILE(ZapfDingbatsWidths)
 
+set(POPPLER_SOVERSION_NUMBER "126")
+
+set(LINKER_SCRIPT "${CMAKE_BINARY_DIR}/libpoppler.map")
+configure_file(
+    "${CMAKE_SOURCE_DIR}/poppler/libpoppler.map.in"
+    ${LINKER_SCRIPT})
+
 if(MSVC)
 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
-add_library(poppler ${poppler_SRCS})
+add_library(poppler ${poppler_SRCS} ${LINKER_SCRIPT})
 generate_export_header(poppler BASE_NAME poppler-private EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler_private_export.h")
-set_target_properties(poppler PROPERTIES VERSION 126.0.0 SOVERSION 126)
+set_target_properties(poppler PROPERTIES
+	VERSION ${POPPLER_SOVERSION_NUMBER}.0.0
+	SOVERSION ${POPPLER_SOVERSION_NUMBER})
+
+if(UNIX AND (NOT APPLE))
+	set_target_properties(poppler PROPERTIES
+		LINK_OPTIONS LINKER:--version-script=${LINKER_SCRIPT})
+endif()
+
 if(MINGW AND BUILD_SHARED_LIBS)
     get_target_property(POPPLER_SOVERSION poppler SOVERSION)
     set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
 endif()
 target_link_libraries(poppler LINK_PRIVATE ${poppler_LIBS})
--- /dev/null
+++ b/poppler/libpoppler.map.in
@@ -0,0 +1,4 @@
+POPPLER_@POPPLER_SOVERSION_NUMBER@ {
+  global:
+    *;
+};

Reply via email to