diff options
author | Kevin Slagle | 2018-03-31 14:49:56 -0400 |
---|---|---|
committer | Kevin Slagle | 2018-03-31 14:49:56 -0400 |
commit | a80b5aad867b62cd149f6a8d0db52c0d3fb2d66d (patch) | |
tree | 13cc8a56cf21dd6ab71a8608ab8497aa273bbd7c | |
download | aur-a80b5aad867b62cd149f6a8d0db52c0d3fb2d66d.tar.gz |
version 0.61.1
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | 0001-Cairo-backend-added-to-Qt5-wrapper.patch | 202 | ||||
-rw-r--r-- | 0002-Setting-default-Qt5-backend-to-Cairo.patch | 25 | ||||
-rw-r--r-- | 0003-Do-not-build-the-main-poppler-library.patch | 41 | ||||
-rw-r--r-- | PKGBUILD | 65 |
5 files changed, 358 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..dcafe07b436e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = poppler-qt5-cairo + pkgdesc = Poppler Qt5 bindings, with patches to use the Cairo backend instead of Splash + pkgver = 0.61.1 + pkgrel = 1 + arch = i686 + arch = x86_64 + license = GPL + makedepends = cmake + makedepends = pkgconfig + depends = qt5-base + depends = cairo + depends = poppler>=0.61.1 + provides = poppler-qt5=0.61.1 + conflicts = poppler-qt5 + source = http://poppler.freedesktop.org/poppler-0.61.1.tar.xz + source = 0001-Cairo-backend-added-to-Qt5-wrapper.patch + source = 0002-Setting-default-Qt5-backend-to-Cairo.patch + source = 0003-Do-not-build-the-main-poppler-library.patch + md5sums = 2d3dcea88d6a814317fac74d2a16c3cd + md5sums = c8516ded842a9dfb828ba30365b5b86c + md5sums = 9b51024391e2dbd06a89881bab1c855b + md5sums = af8a453d358e22cb950be15936f3c86f + +pkgname = poppler-qt5-cairo + diff --git a/0001-Cairo-backend-added-to-Qt5-wrapper.patch b/0001-Cairo-backend-added-to-Qt5-wrapper.patch new file mode 100644 index 000000000000..482c3cfef632 --- /dev/null +++ b/0001-Cairo-backend-added-to-Qt5-wrapper.patch @@ -0,0 +1,202 @@ +From b338ffeaa1cd104dd6c64d2361c3deb981efd0de Mon Sep 17 00:00:00 2001 +From: Kevin Slagle <kjslag@gmail.com> +Date: Sat, 31 Mar 2018 14:13:25 -0400 +Subject: [PATCH 1/3] Cairo backend added to Qt5 wrapper + +--- + qt5/src/CMakeLists.txt | 15 ++++++++++ + qt5/src/poppler-document.cc | 3 ++ + qt5/src/poppler-page.cc | 70 +++++++++++++++++++++++++++++++++++++++++++++ + qt5/src/poppler-qt5.h | 3 +- + qt5/tests/CMakeLists.txt | 5 ++++ + 5 files changed, 95 insertions(+), 1 deletion(-) + +diff --git a/qt5/src/CMakeLists.txt b/qt5/src/CMakeLists.txt +index 7993c33b..80a3c054 100644 +--- a/qt5/src/CMakeLists.txt ++++ b/qt5/src/CMakeLists.txt +@@ -7,6 +7,11 @@ include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ) + ++if (HAVE_CAIRO) ++ include_directories(${CAIRO_INCLUDE_DIRS}) ++ add_definitions(${CAIRO_CFLAGS}) ++endif (HAVE_CAIRO) ++ + set(poppler_qt5_SRCS + poppler-annotation.cc + poppler-document.cc +@@ -29,6 +34,13 @@ set(poppler_qt5_SRCS + poppler-media.cc + ArthurOutputDev.cc + ) ++if (HAVE_CAIRO) ++ set(poppler_qt5_SRCS ${poppler_qt5_SRCS} ++ ${CMAKE_SOURCE_DIR}/poppler/CairoOutputDev.cc ++ ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc ++ ${CMAKE_SOURCE_DIR}/poppler/CairoFontEngine.cc ++ ) ++endif(HAVE_CAIRO) + add_library(poppler-qt5 SHARED ${poppler_qt5_SRCS}) + set_target_properties(poppler-qt5 PROPERTIES VERSION 1.11.0 SOVERSION 1) + if(MINGW) +@@ -36,6 +48,9 @@ if(MINGW) + set_target_properties(poppler-qt5 PROPERTIES SUFFIX "-${POPPLER_QT5_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif() + target_link_libraries(poppler-qt5 poppler ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Xml_LIBRARIES}) ++if (HAVE_CAIRO) ++ target_link_libraries(poppler-qt5 ${CAIRO_LIBRARIES}) ++endif (HAVE_CAIRO) + if(MSVC) + target_link_libraries(poppler-qt5 poppler ${poppler_LIBS}) + endif() +diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc +index 03077f99..8f67ad80 100644 +--- a/qt5/src/poppler-document.cc ++++ b/qt5/src/poppler-document.cc +@@ -675,6 +675,9 @@ namespace Poppler { + ret << Document::SplashBackend; + #endif + ret << Document::ArthurBackend; ++#if defined(HAVE_CAIRO) ++ ret << Document::CairoBackend; ++#endif + return ret; + } + +diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc +index 9dcdaad9..2706e83a 100644 +--- a/qt5/src/poppler-page.cc ++++ b/qt5/src/poppler-page.cc +@@ -44,6 +44,7 @@ + #include <QtGui/QPainter> + + #include <config.h> ++#include <math.h> + #include <PDFDoc.h> + #include <Catalog.h> + #include <Form.h> +@@ -57,6 +58,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" +@@ -440,6 +444,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; +@@ -499,6 +567,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/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h +index fcfe2d31..1da12e9b 100644 +--- a/qt5/src/poppler-qt5.h ++++ b/qt5/src/poppler-qt5.h +@@ -878,7 +878,8 @@ delete it; + */ + enum RenderBackend { + SplashBackend, ///< Splash backend +- ArthurBackend ///< Arthur (Qt) backend ++ ArthurBackend, ///< Arthur (Qt) backend ++ CairoBackend ///< Cairo backend + }; + + /** +diff --git a/qt5/tests/CMakeLists.txt b/qt5/tests/CMakeLists.txt +index 01a1a970..d6d241c6 100644 +--- a/qt5/tests/CMakeLists.txt ++++ b/qt5/tests/CMakeLists.txt +@@ -11,6 +11,11 @@ include_directories( + ${Qt5Widgets_INCLUDE_DIRS} + ) + ++if (HAVE_CAIRO) ++ include_directories(${CAIRO_INCLUDE_DIRS}) ++ add_definitions(${CAIRO_CFLAGS}) ++endif (HAVE_CAIRO) ++ + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS}") +-- +2.16.2 + diff --git a/0002-Setting-default-Qt5-backend-to-Cairo.patch b/0002-Setting-default-Qt5-backend-to-Cairo.patch new file mode 100644 index 000000000000..10a08a5ba096 --- /dev/null +++ b/0002-Setting-default-Qt5-backend-to-Cairo.patch @@ -0,0 +1,25 @@ +From e9918b20d84716799866535c1bf3d6df5db904de Mon Sep 17 00:00:00 2001 +From: Kevin Slagle <kjslag@gmail.com> +Date: Sat, 31 Mar 2018 14:14:18 -0400 +Subject: [PATCH 2/3] Setting default Qt5 backend to Cairo + +--- + qt5/src/poppler-private.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/qt5/src/poppler-private.cc b/qt5/src/poppler-private.cc +index 23fb8466..451c7f7b 100644 +--- a/qt5/src/poppler-private.cc ++++ b/qt5/src/poppler-private.cc +@@ -243,7 +243,7 @@ namespace Debug { + + void DocumentData::init() + { +- m_backend = Document::SplashBackend; ++ m_backend = Document::CairoBackend; + paperColor = Qt::white; + m_hints = 0; + m_optContentModel = 0; +-- +2.16.2 + diff --git a/0003-Do-not-build-the-main-poppler-library.patch b/0003-Do-not-build-the-main-poppler-library.patch new file mode 100644 index 000000000000..a7fdb1c90346 --- /dev/null +++ b/0003-Do-not-build-the-main-poppler-library.patch @@ -0,0 +1,41 @@ +From bb4a8ad27a054694eca6c9735661820cf8d043e0 Mon Sep 17 00:00:00 2001 +From: Kevin Slagle <kjslag@gmail.com> +Date: Sat, 31 Mar 2018 14:15:38 -0400 +Subject: [PATCH 3/3] Do not build the main poppler library + +--- + CMakeLists.txt | 18 ------------------ + 1 file changed, 18 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f181fdec..dff4dc9f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -537,24 +537,6 @@ if(TIFF_FOUND) + set(poppler_LIBS ${poppler_LIBS} ${TIFF_LIBRARIES}) + endif() + +-if(MSVC) +-add_definitions(-D_CRT_SECURE_NO_WARNINGS) +-set(CMAKE_CXX_FLAGS "/Zc:wchar_t- ${CMAKE_CXX_FLAGS}") +-add_library(poppler STATIC ${poppler_SRCS}) +-else() +-add_library(poppler ${poppler_SRCS}) +-endif() +-set_target_properties(poppler PROPERTIES VERSION 72.0.0 SOVERSION 72) +-if(MINGW) +- 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}) +-if(CMAKE_USE_PTHREADS_INIT) +- target_link_libraries(poppler LINK_PRIVATE Threads::Threads) +-endif() +-install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- + if(ENABLE_XPDF_HEADERS) + install(FILES + poppler/Annot.h +-- +2.16.2 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..b5181a222492 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,65 @@ +# Maintainer: Kevin Slagle <kjslag_at_gmail.com> +# Contributor: Paul Gideon Dann <pdgiddie_at_gmail.com> + +# Poppler supports two different backends: Cairo and Splash (a low-level backend inherited from Xpdf). +# Although Cairo renders better and faster than Splash, the Qt bindinds for Poppler currently only supports Splash due to political reasons: +# https://bugs.freedesktop.org/show_bug.cgi?id=25240 + +# This package is based off of Paul Gideon Dann's poppler-qt-lcd package, which uses Cairo as the default backend for the Qt4 bindings and also includes patches for subpixel rendering in Cairo. +# (The subpixel rendering patches are not included in this package.) +# https://aur.archlinux.org/packages/poppler-qt-lcd + +# The included patches add Cairo support to the Qt5 bindings and set Cairo as the default backend. +# The patches are based off of Paul Gideon Dann's patches for the Qt4 bindings: +# https://github.com/giddie/poppler-qt4-cairo-backend + +pkgname=poppler-qt5-cairo +pkgver=0.61.1 +pkgrel=1 +pkgdesc="Poppler Qt5 bindings, with patches to use the Cairo backend instead of Splash" +license=('GPL') +arch=(i686 x86_64) +provides=("poppler-qt5=${pkgver}") +conflicts=('poppler-qt5') +depends=('qt5-base' 'cairo' "poppler>=${pkgver}") +makedepends=('cmake' 'pkgconfig') +#url="https://github.com/giddie/poppler-qt4-cairo-backend" +source=(http://poppler.freedesktop.org/poppler-${pkgver}.tar.xz + 0001-Cairo-backend-added-to-Qt5-wrapper.patch + 0002-Setting-default-Qt5-backend-to-Cairo.patch + 0003-Do-not-build-the-main-poppler-library.patch) +md5sums=('2d3dcea88d6a814317fac74d2a16c3cd' + 'c8516ded842a9dfb828ba30365b5b86c' + '9b51024391e2dbd06a89881bab1c855b' + 'af8a453d358e22cb950be15936f3c86f') + +prepare() { + mkdir build + + cd poppler-$pkgver + for patch in ${srcdir}/*.patch; do + patch -Np1 -i $patch + done +} + +build() { + cd build + cmake ../poppler-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX:PATH=/usr \ + -DCMAKE_INSTALL_LIBDIR=/usr/lib \ + -DENABLE_XPDF_HEADERS=ON \ + -DENABLE_UTILS=OFF \ + -DENABLE_CPP=OFF \ + -DENABLE_GLIB=OFF \ + -DENABLE_QT4=OFF + make poppler-qt5 +} + +package() { + cd build + + make -C qt5 DESTDIR="${pkgdir}" install + install -m755 -d "${pkgdir}/usr/lib/pkgconfig" + install -m644 poppler-qt5.pc "${pkgdir}/usr/lib/pkgconfig/" +} |