summaryrefslogtreecommitdiff
path: root/app-text/poppler/files
diff options
context:
space:
mode:
Diffstat (limited to 'app-text/poppler/files')
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch199
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch25
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch30
-rw-r--r--app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch45
-rw-r--r--app-text/poppler/files/poppler-0.26.0-qt5-dependencies.patch31
-rw-r--r--app-text/poppler/files/poppler-0.28.1-fix-multilib-configuration.patch23
-rw-r--r--app-text/poppler/files/poppler-0.28.1-respect-cflags.patch48
-rw-r--r--app-text/poppler/files/poppler-0.33.0-openjpeg2.patch15
-rw-r--r--app-text/poppler/files/poppler-0.40-FindQt4.patch31
-rw-r--r--app-text/poppler/files/poppler-0.53.0-respect-cflags.patch52
-rw-r--r--app-text/poppler/files/poppler-0.59.0-qt5-dependencies.patch31
-rw-r--r--app-text/poppler/files/poppler-0.59.0-respect-cflags.patch50
-rw-r--r--app-text/poppler/files/poppler-0.60.1-qt5-dependencies.patch29
-rw-r--r--app-text/poppler/files/poppler-0.60.1-respect-cflags.patch53
14 files changed, 662 insertions, 0 deletions
diff --git a/app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch b/app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch
new file mode 100644
index 000000000000..2246b29b1340
--- /dev/null
+++ b/app-text/poppler/files/cairo-qt-experimental/0001-Cairo-backend-added-to-Qt4-wrapper.patch
@@ -0,0 +1,199 @@
+From e8fcbaca23878f0edd2015440eec55aaba0e8f9f Mon Sep 17 00:00:00 2001
+From: Paul Gideon Dann <pdgiddie@gmail.com>
+Date: Wed, 20 May 2009 11:42:28 +0100
+Subject: [PATCH 1/4] Cairo backend added to Qt4 wrapper
+
+---
+ qt4/src/CMakeLists.txt | 15 ++++++++++
+ qt4/src/poppler-document.cc | 3 ++
+ qt4/src/poppler-page.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++
+ qt4/src/poppler-qt4.h | 3 +-
+ qt4/tests/CMakeLists.txt | 5 ++++
+ 5 files changed, 95 insertions(+), 1 deletion(-)
+
+diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
+index 189eca2..5338b55 100644
+--- a/qt4/src/CMakeLists.txt
++++ b/qt4/src/CMakeLists.txt
+@@ -6,6 +6,11 @@ include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ )
+
++if (HAVE_CAIRO)
++ include_directories(${CAIRO_INCLUDE_DIRS})
++ add_definitions(${CAIRO_CFLAGS})
++endif (HAVE_CAIRO)
++
+ set(poppler_qt4_SRCS
+ poppler-annotation.cc
+ poppler-document.cc
+@@ -28,10 +33,20 @@ set(poppler_qt4_SRCS
+ poppler-media.cc
+ ArthurOutputDev.cc
+ )
++if (HAVE_CAIRO)
++ set(poppler_qt4_SRCS ${poppler_qt4_SRCS}
++ ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc
++ ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc
++ ${CMAKE_SOURCE_DIR}/poppler/CairoFontEngine.cc
++ )
++endif(HAVE_CAIRO)
+ qt4_automoc(${poppler_qt4_SRCS})
+ add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS})
+ set_target_properties(poppler-qt4 PROPERTIES VERSION 4.9.0 SOVERSION 4)
+ target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY})
++if (HAVE_CAIRO)
++ target_link_libraries(poppler-qt4 ${CAIRO_LIBRARIES})
++endif (HAVE_CAIRO)
+ if(MSVC)
+ target_link_libraries(poppler-qt4 poppler ${poppler_LIBS})
+ endif(MSVC)
+diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
+index 94f997d..6decaaf 100644
+--- a/qt4/src/poppler-document.cc
++++ b/qt4/src/poppler-document.cc
+@@ -547,6 +547,9 @@ namespace Poppler {
+ ret << Document::SplashBackend;
+ #endif
+ ret << Document::ArthurBackend;
++#if defined(HAVE_CAIRO)
++ ret << Document::CairoBackend;
++#endif
+ return ret;
+ }
+
+diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
+index 83bcf4a..df1d344 100644
+--- a/qt4/src/poppler-page.cc
++++ b/qt4/src/poppler-page.cc
+@@ -40,6 +40,7 @@
+ #include <QtGui/QPainter>
+
+ #include <config.h>
++#include <math.h>
+ #include <PDFDoc.h>
+ #include <Catalog.h>
+ #include <Form.h>
+@@ -53,6 +54,9 @@
+ #include <SplashOutputDev.h>
+ #include <splash/SplashBitmap.h>
+ #endif
++#if defined(HAVE_CAIRO)
++#include <CairoOutputDev.h>
++#endif
+
+ #include "poppler-private.h"
+ #include "poppler-page-transition-private.h"
+@@ -405,6 +409,70 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h,
+ img = tmpimg;
+ break;
+ }
++ case Poppler::Document::CairoBackend:
++ {
++#if defined(HAVE_CAIRO)
++ CairoOutputDev *output_dev = new CairoOutputDev();
++ output_dev->startDoc(m_page->parentDoc->doc);
++ int buffer_width, buffer_height, rotate;
++ cairo_surface_t *surface;
++ cairo_t *cairo;
++
++ // If w or h are -1, that indicates the whole page, so we need to
++ // calculate how many pixels that corresponds to. Otherwise, we can use w
++ // or h directly for our buffer size.
++ const QSize pageSize = this->pageSize();
++ if (w == -1) {
++ const double xscale = xres / 72.0;
++ const double width = pageSize.width();;
++ buffer_width = (int) ceil(width * xscale);
++ } else {
++ buffer_width = w;
++ }
++ if (h == -1) {
++ const double yscale = yres / 72.0;
++ const double height = pageSize.height();
++ buffer_height = (int) ceil(height * yscale);
++ } else {
++ buffer_height = h;
++ }
++
++ rotate = rotation + m_page->page->getRotate();
++
++ // FIXME: Okular never provides a rotation value, so I don't have any way
++ // of testing this right now. The result is that subpixels are ordered
++ // incorrectly when the page is rotated.
++
++ //if (rotate == 90 || rotate == 270) {
++ // const double temp = height;
++ // height = width;
++ // width = temp;
++ //}
++
++ img = QImage(buffer_width, buffer_height, QImage::Format_ARGB32);
++ img.fill(Qt::white); // Never transparent
++
++ surface = cairo_image_surface_create_for_data(
++ img.bits(),
++ CAIRO_FORMAT_ARGB32,
++ buffer_width, buffer_height,
++ img.bytesPerLine());
++
++ cairo = cairo_create(surface);
++ output_dev->setCairo(cairo);
++
++ m_page->parentDoc->doc->displayPageSlice(
++ output_dev, m_page->index + 1, xres, yres, rotation, false, true,
++ false, x, y, w, h);
++
++ // Clean up
++ output_dev->setCairo(NULL);
++ cairo_destroy(cairo);
++ cairo_surface_destroy(surface);
++ delete output_dev;
++#endif
++ break;
++ }
+ }
+
+ return img;
+@@ -447,6 +515,8 @@ bool Page::renderToPainter(QPainter* painter, double xres, double yres, int x, i
+ painter->restore();
+ return true;
+ }
++ case Poppler::Document::CairoBackend:
++ return false;
+ }
+ return false;
+ }
+diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
+index c0340a4..118f8ba 100644
+--- a/qt4/src/poppler-qt4.h
++++ b/qt4/src/poppler-qt4.h
+@@ -886,7 +886,8 @@ delete it;
+ */
+ enum RenderBackend {
+ SplashBackend, ///< Splash backend
+- ArthurBackend ///< Arthur (Qt4) backend
++ ArthurBackend, ///< Arthur (Qt4) backend
++ CairoBackend ///< Cairo backend
+ };
+
+ /**
+diff --git a/qt4/tests/CMakeLists.txt b/qt4/tests/CMakeLists.txt
+index bba868f..8c40471 100644
+--- a/qt4/tests/CMakeLists.txt
++++ b/qt4/tests/CMakeLists.txt
+@@ -8,6 +8,11 @@ include_directories(
+ ${QT4_INCLUDE_DIR}
+ )
+
++if (HAVE_CAIRO)
++ include_directories(${CAIRO_INCLUDE_DIRS})
++ add_definitions(${CAIRO_CFLAGS})
++endif (HAVE_CAIRO)
++
+ macro(QT4_ADD_SIMPLETEST exe source)
+ string(REPLACE "-" "" test_name ${exe})
+ set(${test_name}_SOURCES
+--
+2.7.3
+
diff --git a/app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch b/app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch
new file mode 100644
index 000000000000..3a360394182e
--- /dev/null
+++ b/app-text/poppler/files/cairo-qt-experimental/0002-Setting-default-Qt4-backend-to-Cairo.patch
@@ -0,0 +1,25 @@
+From 7ddcf7bf4296ed58dc316b0dd6b000057740e118 Mon Sep 17 00:00:00 2001
+From: Paul Gideon Dann <pdgiddie@gmail.com>
+Date: Wed, 20 May 2009 13:17:29 +0100
+Subject: [PATCH 2/4] Setting default Qt4 backend to Cairo
+
+---
+ qt4/src/poppler-private.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
+index cbf21b1..1c7f16c 100644
+--- a/qt4/src/poppler-private.cc
++++ b/qt4/src/poppler-private.cc
+@@ -236,7 +236,7 @@ namespace Debug {
+ void DocumentData::init()
+ {
+ m_fontInfoIterator = 0;
+- m_backend = Document::SplashBackend;
++ m_backend = Document::CairoBackend;
+ paperColor = Qt::white;
+ m_hints = 0;
+ m_optContentModel = 0;
+--
+2.7.3
+
diff --git a/app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch b/app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch
new file mode 100644
index 000000000000..21547b951802
--- /dev/null
+++ b/app-text/poppler/files/cairo-qt-experimental/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch
@@ -0,0 +1,30 @@
+From a9a6a3fcf4f2bf62e83d325a790624241084ad72 Mon Sep 17 00:00:00 2001
+From: Paul Gideon Dann <pdgiddie@gmail.com>
+Date: Wed, 20 May 2009 13:06:48 +0100
+Subject: [PATCH 3/4] Forcing subpixel rendering in Cairo backend
+
+---
+ poppler/CairoOutputDev.cc | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
+index d0d6cb4..50e64f9 100644
+--- a/poppler/CairoOutputDev.cc
++++ b/poppler/CairoOutputDev.cc
+@@ -203,6 +203,13 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
+ }
+ if (cairo != NULL) {
+ this->cairo = cairo_reference (cairo);
++ {
++ cairo_font_options_t *options = cairo_font_options_create ();
++ cairo_get_font_options (cairo, options);
++ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_SUBPIXEL);
++ cairo_set_font_options (cairo, options);
++ cairo_font_options_destroy (options);
++ }
+ /* save the initial matrix so that we can use it for type3 fonts. */
+ //XXX: is this sufficient? could we miss changes to the matrix somehow?
+ cairo_get_matrix(cairo, &orig_matrix);
+--
+2.7.3
+
diff --git a/app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch b/app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch
new file mode 100644
index 000000000000..0f622323a9f0
--- /dev/null
+++ b/app-text/poppler/files/cairo-qt-experimental/0004-Enabling-slight-hinting-in-Cairo-Backend.patch
@@ -0,0 +1,45 @@
+From 1604ec6cb759b6f2b8aa006faa0ec990cd511b36 Mon Sep 17 00:00:00 2001
+From: Paul Gideon Dann <pdgiddie@gmail.com>
+Date: Thu, 21 May 2009 10:55:49 +0100
+Subject: [PATCH 4/4] Enabling slight hinting in Cairo Backend
+
+Originally suggested at:
+http://bugs.freedesktop.org/show_bug.cgi?id=3307#c20
+---
+ poppler/CairoFontEngine.cc | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
+index 3cff917..75a1c50 100644
+--- a/poppler/CairoFontEngine.cc
++++ b/poppler/CairoFontEngine.cc
+@@ -132,7 +132,7 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont)
+ cairo_matrix_t m;
+ cairo_matrix_init_identity(&m);
+ cairo_font_options_t *options = cairo_font_options_create();
+- cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
++ cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_SLIGHT);
+ cairo_font_options_set_hint_metrics(options, CAIRO_HINT_METRICS_OFF);
+ cairo_scaled_font_t *scaled_font = cairo_scaled_font_create(cairo_font_face, &m, &m, options);
+
+@@ -189,7 +189,7 @@ _ft_new_face_uncached (FT_Library lib,
+ }
+
+ font_face = cairo_ft_font_face_create_for_ft_face (face,
+- FT_LOAD_NO_HINTING |
++ FT_LOAD_TARGET_LIGHT |
+ FT_LOAD_NO_BITMAP);
+ if (cairo_font_face_set_user_data (font_face,
+ &_ft_cairo_key,
+@@ -358,7 +358,7 @@ _ft_new_face (FT_Library lib,
+ _ft_open_faces = l;
+
+ l->font_face = cairo_ft_font_face_create_for_ft_face (tmpl.face,
+- FT_LOAD_NO_HINTING |
++ FT_LOAD_TARGET_LIGHT |
+ FT_LOAD_NO_BITMAP);
+ if (cairo_font_face_set_user_data (l->font_face,
+ &_ft_cairo_key,
+--
+2.7.3
+
diff --git a/app-text/poppler/files/poppler-0.26.0-qt5-dependencies.patch b/app-text/poppler/files/poppler-0.26.0-qt5-dependencies.patch
new file mode 100644
index 000000000000..bf1effd4377d
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.26.0-qt5-dependencies.patch
@@ -0,0 +1,31 @@
+From 95f6a96e390830233d953f8afa37817499912b35 Mon Sep 17 00:00:00 2001
+From: Johannes Huber <johu@gentoo.org>
+Date: Sat, 10 May 2014 15:00:48 +0200
+Subject: [PATCH] [Qt5] Drop unused dependencies
+
+---
+ CMakeLists.txt | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index fbafc4e..073f39b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -106,12 +106,10 @@ if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_
+ find_package(Qt5Core)
+ find_package(Qt5Gui)
+ find_package(Qt5Xml)
+- find_package(Qt5Widgets)
+- find_package(Qt5Test)
+- if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
++ if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND)
+ set(QT5_FOUND true)
+ else ()
+- message("-- Package Qt5Core or Qt5Gui or Qt5Xml or Qt5Widgets or Qt5Test not found")
++ message("-- Package Qt5Core or Qt5Gui or Qt5Xml not found")
+ set(QT5_FOUND false)
+ endif()
+ else(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+--
+1.9.2
+
diff --git a/app-text/poppler/files/poppler-0.28.1-fix-multilib-configuration.patch b/app-text/poppler/files/poppler-0.28.1-fix-multilib-configuration.patch
new file mode 100644
index 000000000000..f0a8d3c7eb4a
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.28.1-fix-multilib-configuration.patch
@@ -0,0 +1,23 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7178d25..934f38f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -119,6 +119,18 @@ else(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSIO
+ message("-- CMake >= 2.8.8 is needed to enable Qt5")
+ endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+
++#
++# Ugly workaround: Manually patch library paths for Qt4 and Qt5:
++#
++IF( "${CMAKE_CXX_FLAGS}" MATCHES "-m32")
++ GET_CMAKE_PROPERTY(_res VARIABLES)
++ FOREACH(_var ${_res})
++ IF(_var MATCHES "^QT" AND ${_var} MATCHES "lib64")
++ STRING(REPLACE "lib64" "lib32" ${_var} "${${_var}}")
++ ENDIF()
++ ENDFOREACH()
++ENDIF()
++
+ macro_optional_find_package(Cairo ${CAIRO_VERSION})
+ if(CAIRO_FOUND)
+ set(HAVE_CAIRO ${CAIRO_FOUND})
diff --git a/app-text/poppler/files/poppler-0.28.1-respect-cflags.patch b/app-text/poppler/files/poppler-0.28.1-respect-cflags.patch
new file mode 100644
index 000000000000..0b94042c8af8
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.28.1-respect-cflags.patch
@@ -0,0 +1,48 @@
+diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
+index 6cadf40..7e5e6b2 100644
+--- a/cmake/modules/PopplerMacros.cmake
++++ b/cmake/modules/PopplerMacros.cmake
+@@ -98,41 +98,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE RelWithDebInfo)
+ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+
+-if(CMAKE_COMPILER_IS_GNUCXX)
+- # set the default compile warnings
+ set(DEFAULT_COMPILE_WARNINGS_NO)
+ set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wcast-align -fno-exceptions -fno-check-new -fno-common")
+ set(DEFAULT_COMPILE_WARNINGS_KDE "-Wno-long-long -Wundef -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align -Wconversion -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+
+- set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual ${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
+- set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+- set(CMAKE_C_FLAGS "-std=c99")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
+- set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+-
+- poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
+- if(GCC_HAS_AS_NEEDED)
+- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
+- endif(GCC_HAS_AS_NEEDED)
+-endif (CMAKE_COMPILER_IS_GNUCXX)
+-
+-if(CMAKE_C_COMPILER MATCHES "icc")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
+-endif(CMAKE_C_COMPILER MATCHES "icc")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")
+
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
diff --git a/app-text/poppler/files/poppler-0.33.0-openjpeg2.patch b/app-text/poppler/files/poppler-0.33.0-openjpeg2.patch
new file mode 100644
index 000000000000..af1a72fe9aa8
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.33.0-openjpeg2.patch
@@ -0,0 +1,15 @@
+Sadly the CMake side of openjpeg slotting in Gentoo is broken.
+To reliably find openjpeg:2 we need to use pkg-config.
+
+diff -ruN poppler-0.33.0.orig/CMakeLists.txt poppler-0.33.0/CMakeLists.txt
+--- poppler-0.33.0.orig/CMakeLists.txt 2015-05-14 20:22:31.000000000 +0200
++++ poppler-0.33.0/CMakeLists.txt 2015-05-24 20:39:30.163709257 +0200
+@@ -172,7 +172,7 @@
+ set(USE_OPENJPEG1 ${LIBOPENJPEG_FOUND})
+ set(WITH_OPENJPEG ${LIBOPENJPEG_FOUND})
+ elseif(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2")
+- find_package(LIBOPENJPEG2)
++ pkg_check_modules(LIBOPENJPEG2 libopenjp2)
+ set(USE_OPENJPEG2 ${LIBOPENJPEG2_FOUND})
+ set(WITH_OPENJPEG ${LIBOPENJPEG2_FOUND})
+ endif()
diff --git a/app-text/poppler/files/poppler-0.40-FindQt4.patch b/app-text/poppler/files/poppler-0.40-FindQt4.patch
new file mode 100644
index 000000000000..84c58d5f7c7f
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.40-FindQt4.patch
@@ -0,0 +1,31 @@
+
+Ensure that the correct version of Qt is always used.
+
+With the introduction qt-4.8.6, Qt binaries were moved from /usr/bin to
+/usr/$(get_libdir)/qt4/bin, leaving behind in their place symlinks to qtchooser.
+
+There is no guarantee to which version of Qt these symlinks might point, so it
+is necessary to find the correct version explicitly.
+
+Once qmake is found, it is queried for the correct location of all other items.
+
+Gentoo-bug: 572382
+
+--- a/cmake/modules/FindQt4.cmake
++++ b/cmake/modules/FindQt4.cmake
+@@ -313,11 +313,10 @@
+
+ GET_FILENAME_COMPONENT(qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME)
+ # check for qmake
+-FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake qmake4 qmake-qt4 PATHS
+- "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin"
+- "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\4.0.0;InstallDir]/bin"
+- "[HKEY_CURRENT_USER\\Software\\Trolltech\\Versions\\${qt_install_version};InstallDir]/bin"
+- $ENV{QTDIR}/bin
++FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS
++ /usr/${CMAKE_INSTALL_LIBDIR}/qt4/bin
++ /usr/bin
++ NO_DEFAULT_PATH
+ )
+
+ IF (QT_QMAKE_EXECUTABLE)
diff --git a/app-text/poppler/files/poppler-0.53.0-respect-cflags.patch b/app-text/poppler/files/poppler-0.53.0-respect-cflags.patch
new file mode 100644
index 000000000000..3fdd9c20382b
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.53.0-respect-cflags.patch
@@ -0,0 +1,52 @@
+diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
+index 8e3ef399..5c20bf63 100644
+--- a/cmake/modules/PopplerMacros.cmake
++++ b/cmake/modules/PopplerMacros.cmake
+@@ -98,45 +98,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_BUILD_TYPE RelWithDebInfo)
+ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+
+-if(CMAKE_COMPILER_IS_GNUCXX)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )
+ endif()
+
+- # set the default compile warnings
+ set(DEFAULT_COMPILE_WARNINGS_NO)
+ set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wcast-align -fno-exceptions -fno-check-new -fno-common")
+ set(DEFAULT_COMPILE_WARNINGS_KDE "-Wno-long-long -Wundef -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align -Wconversion -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+
+- set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual ${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
+- set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+- set(CMAKE_C_FLAGS "-std=c99")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
+- set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+-
+- poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
+- if(GCC_HAS_AS_NEEDED)
+- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
+- endif(GCC_HAS_AS_NEEDED)
+-endif (CMAKE_COMPILER_IS_GNUCXX)
+-
+-if(CMAKE_C_COMPILER MATCHES "icc")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
+-endif(CMAKE_C_COMPILER MATCHES "icc")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")
+
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
diff --git a/app-text/poppler/files/poppler-0.59.0-qt5-dependencies.patch b/app-text/poppler/files/poppler-0.59.0-qt5-dependencies.patch
new file mode 100644
index 000000000000..2bef6945716d
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.59.0-qt5-dependencies.patch
@@ -0,0 +1,31 @@
+From 2f7ca474ec49f805257c75cefb364e08ebd9e4d1 Mon Sep 17 00:00:00 2001
+From: Johannes Huber <johu@gentoo.org>
+Date: Tue, 5 Sep 2017 22:58:44 +0200
+Subject: [PATCH] [Qt5] Drop unused dependencies
+
+---
+ CMakeLists.txt | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a5b0a5be..787bd0d6 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -133,12 +133,10 @@ macro_optional_find_package(Qt4)
+ find_package(Qt5Core)
+ find_package(Qt5Gui)
+ find_package(Qt5Xml)
+-find_package(Qt5Widgets)
+-find_package(Qt5Test)
+-if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
++if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND)
+ set(QT5_FOUND true)
+ else ()
+- message("-- Package Qt5Core or Qt5Gui or Qt5Xml or Qt5Widgets or Qt5Test not found")
++ message("-- Package Qt5Core or Qt5Gui or Qt5Xml not found")
+ set(QT5_FOUND false)
+ endif()
+
+--
+2.14.1
+
diff --git a/app-text/poppler/files/poppler-0.59.0-respect-cflags.patch b/app-text/poppler/files/poppler-0.59.0-respect-cflags.patch
new file mode 100644
index 000000000000..ada6ddfc7d75
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.59.0-respect-cflags.patch
@@ -0,0 +1,50 @@
+--- poppler-0.59.0/cmake/modules/PopplerMacros.cmake
++++ poppler-0.59.0/cmake/modules/PopplerMacros.cmake
+@@ -98,45 +98,14 @@
+ set(CMAKE_BUILD_TYPE RelWithDebInfo)
+ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+
+-if(CMAKE_COMPILER_IS_GNUCXX)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )
+ endif()
+
+- # set the default compile warnings
+ set(DEFAULT_COMPILE_WARNINGS_NO)
+ set(DEFAULT_COMPILE_WARNINGS_YES "-Wall -Wcast-align -fno-exceptions -fno-check-new -fno-common")
+ set(DEFAULT_COMPILE_WARNINGS_KDE "-Wno-long-long -Wundef -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -Wcast-align -Wconversion -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common")
+
+- set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual -D_DEFAULT_SOURCE ${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
+- set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+- set(CMAKE_C_FLAGS "-std=c99")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
+- set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
+-
+- poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
+- if(GCC_HAS_AS_NEEDED)
+- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
+- endif(GCC_HAS_AS_NEEDED)
+-endif (CMAKE_COMPILER_IS_GNUCXX)
+-
+-if(CMAKE_C_COMPILER MATCHES "icc")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
+- set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign")
+-endif(CMAKE_C_COMPILER MATCHES "icc")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")
+
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
diff --git a/app-text/poppler/files/poppler-0.60.1-qt5-dependencies.patch b/app-text/poppler/files/poppler-0.60.1-qt5-dependencies.patch
new file mode 100644
index 000000000000..259be15c6631
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.60.1-qt5-dependencies.patch
@@ -0,0 +1,29 @@
+From af70882d85999b1912f9909f506ee7d22cc58ca7 Mon Sep 17 00:00:00 2001
+From: Johannes Huber <johu@gentoo.org>
+Date: Fri, 6 Oct 2017 08:52:10 +0200
+Subject: [PATCH] [Qt5] Drop unused dependencies
+
+---
+ CMakeLists.txt | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7485b2ad..04327568 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -147,10 +147,8 @@ if (ENABLE_QT5)
+ find_package(Qt5Core)
+ find_package(Qt5Gui)
+ find_package(Qt5Xml)
+- find_package(Qt5Widgets)
+- find_package(Qt5Test)
+- if (NOT (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND))
+- message("-- Package Qt5Core or Qt5Gui or Qt5Xml or Qt5Widgets or Qt5Test not found")
++ if (NOT (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND))
++ message("-- Package Qt5Core or Qt5Gui or Qt5Xml not found")
+ set(ENABLE_QT5 OFF)
+ endif()
+ endif()
+--
+2.14.2
+
diff --git a/app-text/poppler/files/poppler-0.60.1-respect-cflags.patch b/app-text/poppler/files/poppler-0.60.1-respect-cflags.patch
new file mode 100644
index 000000000000..4e1df0d62c68
--- /dev/null
+++ b/app-text/poppler/files/poppler-0.60.1-respect-cflags.patch
@@ -0,0 +1,53 @@
+--- poppler-0.60.1/cmake/modules/PopplerMacros.cmake
++++ poppler-0.60.1/cmake/modules/PopplerMacros.cmake
+@@ -98,8 +98,6 @@
+ set(CMAKE_BUILD_TYPE RelWithDebInfo)
+ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+
+-if(CMAKE_COMPILER_IS_GNUCXX)
+- # set the default compile warnings
+ set(_warn "-Wall -Wextra -Wpedantic")
+ set(_warn "${_warn} -Wno-unused-parameter -Wno-missing-field-initializers")
+ set(_warn "${_warn} -Wcast-align")
+@@ -124,39 +122,6 @@
+ set(DEFAULT_COMPILE_WARNINGS "${_warn}")
+ set(DEFAULT_COMPILE_WARNINGS_EXTRA "${_warn} ${_warnx}")
+
+- set(_save_cxxflags "${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS "-fno-exceptions -fno-check-new -fno-common -D_DEFAULT_SOURCE")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs ${_save_cxxflags}")
+- set(_save_cflags "${CMAKE_C_FLAGS}")
+- set(CMAKE_C_FLAGS "-std=c99")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g ${_save_cflags}")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG ${_save_cflags}")
+- set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline ${_save_cflags}")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline ${_save_cflags}")
+- set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs ${_save_cflags}")
+-
+- poppler_check_link_flag("-Wl,--as-needed" GCC_HAS_AS_NEEDED)
+- if(GCC_HAS_AS_NEEDED)
+- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
+- endif(GCC_HAS_AS_NEEDED)
+-endif (CMAKE_COMPILER_IS_GNUCXX)
+-
+-if(CMAKE_C_COMPILER MATCHES "icc")
+- set(_save_cxxflags "${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_DEBUG "-O2 -g -0b0 -noalign ${_save_cxxflags}")
+- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g -Ob0 -noalign ${_save_cxxflags}")
+- set(_save_cflags "${CMAKE_C_FLAGS}")
+- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g ${_save_cflags}")
+- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG ${_save_cflags}")
+- set(CMAKE_C_FLAGS_DEBUG "-O2 -g -Ob0 -noalign ${_save_cflags}")
+- set(CMAKE_C_FLAGS_DEBUGFULL "-g -Ob0 -noalign ${_save_cflags}")
+-endif(CMAKE_C_COMPILER MATCHES "icc")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual")
+
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")