Source: gdcm
Version: 2.4.2-1
Severity: normal
Tags: patch fixed-upstream
Control: forwarded -1 http://sourceforge.net/p/gdcm/bugs/312/

Hi,

gdcm 2.4.2-1 fails to build with Poppler 0.26.x (currently in
experimental).

The issue has been reported [1] and fixed upstream (for gdcm 2.4.3);
in the meanwhile, would it be possible to backport the two upstream
patches (which apply cleanly) for compatibility with Poppler 0.26.x?

[1] http://sourceforge.net/p/gdcm/bugs/312/

Thanks,
-- 
Pino
>From 096e5b84d9e241b6e5203904846454f7d7058e01 Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.p...@tiscali.it>
Date: Sun, 6 Apr 2014 06:20:43 +0000
Subject: [PATCH] cmake: proper handle the extra poppler CFLAGS

Make sure to join the extra CFLAGS with a space, otherwise they are
passed as list to set_source_files_properties; also make sure to quote
the string.
---
 Applications/Cxx/CMakeLists.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Applications/Cxx/CMakeLists.txt b/Applications/Cxx/CMakeLists.txt
index 1c83bc3..714f5bc 100644
--- a/Applications/Cxx/CMakeLists.txt
+++ b/Applications/Cxx/CMakeLists.txt
@@ -79,12 +79,13 @@ if(GDCM_USE_SYSTEM_POPPLER)
     list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_PDFVERSION)
   endif()
   if(libpoppler_flags)
+    string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}")
     set_source_files_properties(
       ${CMAKE_CURRENT_SOURCE_DIR}/gdcminfo.cxx
-      PROPERTIES COMPILE_FLAGS ${libpoppler_flags})
+      PROPERTIES COMPILE_FLAGS "${libpoppler_flags_string}")
     set_source_files_properties(
       ${CMAKE_CURRENT_SOURCE_DIR}/gdcmpdf.cxx
-      PROPERTIES COMPILE_FLAGS ${libpoppler_flags})
+      PROPERTIES COMPILE_FLAGS "${libpoppler_flags_string}")
   endif()
   include_directories(${POPPLER_INCLUDE_DIRS})
   set(GDCM_EXECUTABLE_NAME
-- 
2.0.0

>From 1da0cab121782f1a63a84a9bcc90da6c337dc2e3 Mon Sep 17 00:00:00 2001
From: Pino Toscano <toscano.p...@tiscali.it>
Date: Sun, 6 Apr 2014 06:23:46 +0000
Subject: [PATCH] gdcminfo: support poppler 0.25.1

Check for the new API of StructTreeRoot, adapting the check for a
tagged PDF accordingly. Now Catalog::getStructTreeRoot() returns NULL
if StructTreeRoot is not a dictionary.
---
 Applications/Cxx/CMakeLists.txt | 6 ++++++
 Applications/Cxx/gdcminfo.cxx   | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/Applications/Cxx/CMakeLists.txt b/Applications/Cxx/CMakeLists.txt
index 714f5bc..9b4dd0e 100644
--- a/Applications/Cxx/CMakeLists.txt
+++ b/Applications/Cxx/CMakeLists.txt
@@ -78,6 +78,12 @@ if(GDCM_USE_SYSTEM_POPPLER)
   if(LIBPOPPLER_PDFDOC_HAS_PDFVERSION)
     list(APPEND libpoppler_flags -DLIBPOPPLER_PDFDOC_HAS_PDFVERSION)
   endif()
+  CHECK_CXX_SOURCE_COMPILES(
+    "\#include <poppler/PDFDoc.h>\n#include <poppler/StructTreeRoot.h>\nint main() { Catalog c(NULL); c.getStructTreeRoot()->getDoc(); return 0;}"
+    LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT)
+  if(LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT)
+    list(APPEND libpoppler_flags -DLIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT)
+  endif()
   if(libpoppler_flags)
     string(REPLACE ";" " " libpoppler_flags_string "${libpoppler_flags}")
     set_source_files_properties(
diff --git a/Applications/Cxx/gdcminfo.cxx b/Applications/Cxx/gdcminfo.cxx
index 6f52cd9..9288ea6 100644
--- a/Applications/Cxx/gdcminfo.cxx
+++ b/Applications/Cxx/gdcminfo.cxx
@@ -471,7 +471,11 @@ static int ProcessOneFile( std::string const & filename, gdcm::Defs const & defs
         moddate      = getInfoDate(  info.getDict(), "ModDate"       );
         info.free();
         }
+#ifdef LIBPOPPLER_CATALOG_HAS_STRUCTTREEROOT
+      const char *tagged = doc->getStructTreeRoot() ? "yes" : "no";
+#else
       const char *tagged = doc->getStructTreeRoot()->isDict() ? "yes" : "no";
+#endif
       int pages = doc->getNumPages();
       const char *encrypted = doc->isEncrypted() ? "yes" : "no";
       //  printf("yes (print:%s copy:%s change:%s addNotes:%s)\n",
-- 
2.0.0

Reply via email to