From 2f7fc7543f42fbdc15353b1c61d59171a09e46a1 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 16 Feb 2018 20:04:39 +0000
Subject: poppler: update to 0.62.0

---
 abs/core/poppler/PKGBUILD      | 96 +++++++++++++++++++++---------------------
 abs/core/poppler/gtk-doc.patch | 24 +++++++++++
 2 files changed, 71 insertions(+), 49 deletions(-)
 create mode 100644 abs/core/poppler/gtk-doc.patch

diff --git a/abs/core/poppler/PKGBUILD b/abs/core/poppler/PKGBUILD
index 6048751..3c2f396 100644
--- a/abs/core/poppler/PKGBUILD
+++ b/abs/core/poppler/PKGBUILD
@@ -1,89 +1,87 @@
 # $Id$
+# Maintainer: AndyRTR <andyrtr@archlinux.org>
 # Maintainer: Jan de Groot <jgc@archlinux.org>
 
 pkgbase=poppler
-pkgname=('poppler' 'poppler-glib' 'poppler-qt4' 'poppler-qt5')
-pkgver=0.39.0
+pkgname=('poppler' 'poppler-glib' 'poppler-qt5')
+pkgver=0.62.0
 pkgrel=1
-arch=(i686 x86_64)
+arch=(x86_64)
 license=('GPL')
-makedepends=('libjpeg' 'gcc-libs' 'cairo' 'fontconfig' 'openjpeg' 'gtk2' 'qt4' 'pkgconfig' 'lcms2' 'gobject-introspection' 'icu' 'qt5-base' 'git' 'python2')
+makedepends=('libjpeg' 'gcc-libs' 'cairo' 'fontconfig' 'openjpeg2' 'gtk3' 'pkgconfig' 'lcms2' 
+             'gobject-introspection' 'icu' 'qt5-base' 'git' 'nss' 'gtk-doc' 'curl' 'poppler-data'
+             'cmake' 'python2') # python2 just for make-glib-api-docs/gtkdoc.py
 options=('!emptydirs')
-url="http://poppler.freedesktop.org/"
-source=(http://poppler.freedesktop.org/${pkgbase}-${pkgver}.tar.xz
-        git://anongit.freedesktop.org/poppler/test)
-md5sums=('5100960c61b932430b5d74068d71f530'
-         'SKIP')
+url="https://poppler.freedesktop.org/"
+source=(https://poppler.freedesktop.org/${pkgbase}-${pkgver}.tar.xz
+        test::git+https://anongit.freedesktop.org/git/poppler/test/#commit=0d2bfd4
+        gtk-doc.patch)
+sha256sums=('5b9a73dfd4d6f61d165ada1e4f0abd2d420494bf9d0b1c15d0db3f7b83a729c6'
+            'SKIP'
+            '4032a01456e2372e8f7c805f18634437285ce703fbcfe0fc9a3884ac39edc9ee')
 
-build() {
+prepare() {
+  mkdir build
   cd ${pkgbase}-${pkgver}
-  ./configure --prefix=/usr --sysconfdir=/etc \
-      --localstatedir=/var --disable-static \
-      --enable-cairo-output \
-      --enable-xpdf-headers \
-      --enable-libjpeg --enable-zlib \
-      --enable-poppler-qt4 \
-      --enable-poppler-qt5 \
-      --enable-poppler-glib
+  sed -i -e "s:python:python2:" make-glib-api-docs
+
+  # https://bugzilla.gnome.org/show_bug.cgi?id=789800#c10
+  patch -Np1 -i ../gtk-doc.patch
+}
+
+build() {
+  cd build
+  cmake ../${pkgbase}-${pkgver} \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DCMAKE_INSTALL_PREFIX:PATH=/usr \
+    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
+    -DENABLE_XPDF_HEADERS=ON \
+    -DENABLE_GTK_DOC=ON
   make
 }
 
 check() {
-  cd "${srcdir}/${pkgbase}-${pkgver}"
-  LANG=en_US.UTF8 make check
+  cd build
+  LANG=en_US.UTF8 make test
 }
 
 package_poppler() {
   pkgdesc="PDF rendering library based on xpdf 3.0"
-  depends=('libjpeg' 'gcc-libs' 'cairo' 'fontconfig' 'openjpeg' 'lcms2')
+  depends=('libjpeg' 'gcc-libs' 'cairo' 'fontconfig' 'openjpeg2' 'lcms2' 'nss' 'curl')
   optdepends=('poppler-data: encoding data to display PDF documents containing CJK characters')
-  conflicts=("poppler-qt3<${pkgver}")
+  conflicts=("poppler-qt3<${pkgver}" "poppler-qt4<${pkgver}")
 
-  cd "${srcdir}/${pkgbase}-${pkgver}"
-  sed -e 's/^glib_subdir =.*/glib_subdir =/' \
-      -e 's/^qt4_subdir =.*/qt4_subdir =/' \
-      -e 's/^qt5_subdir =.*/qt5_subdir =/' -i Makefile
+  cd build
   make DESTDIR="${pkgdir}" install
 
-  rm -f "${pkgdir}"/usr/lib/pkgconfig/poppler-{glib,qt4,qt5}.pc
+  # cleanup for splitted build
+  rm -vrf "${pkgdir}"/usr/include/poppler/{glib,qt5}
+  rm -vf "${pkgdir}"//usr/lib/libpoppler-{glib,qt5}.*
+  rm -vf "${pkgdir}"/usr/lib/pkgconfig/poppler-{glib,qt5}.pc
+  rm -vrf "${pkgdir}"/usr/{lib,share}/gir*
+  rm -vrf "${pkgdir}"/usr/share/gtk-doc
 }
 
 package_poppler-glib() {
   pkgdesc="Poppler glib bindings"
   depends=("poppler=${pkgver}" 'glib2')
 
-  cd "${pkgbase}-${pkgver}"
-  make -C poppler DESTDIR="${pkgdir}" install-libLTLIBRARIES
+  cd build
+
   make -C glib DESTDIR="${pkgdir}" install
   install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
   install -m644 poppler-glib.pc "${pkgdir}/usr/lib/pkgconfig/"
-  rm -f "${pkgdir}"/usr/lib/libpoppler.*
-  rm -f "${pkgdir}/usr/bin/poppler-glib-demo"
-}
-
-package_poppler-qt4() {
-  pkgdesc="Poppler Qt4 bindings"
-  provides=("poppler-qt=${pkgver}")
-  replaces=('poppler-qt')
-  conflicts=('poppler-qt')
-  depends=("poppler=${pkgver}" 'qt4')
-
-  cd "${pkgbase}-${pkgver}"
-  make -C poppler DESTDIR="${pkgdir}" install-libLTLIBRARIES
-  make -C qt4 DESTDIR="${pkgdir}" install
-  install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
-  install -m644 poppler-qt4.pc "${pkgdir}/usr/lib/pkgconfig/"
-  rm -f "${pkgdir}"/usr/lib/libpoppler.*
+  rm -vf "${pkgdir}"/usr/lib/libpoppler.*
+  rm -vf "${pkgdir}/usr/bin/poppler-glib-demo"
 }
 
 package_poppler-qt5() {
   pkgdesc="Poppler Qt5 bindings"
   depends=("poppler=${pkgver}" 'qt5-base')
 
-  cd "${pkgbase}-${pkgver}"
-  make -C poppler DESTDIR="${pkgdir}" install-libLTLIBRARIES
+  cd build
   make -C qt5 DESTDIR="${pkgdir}" install
   install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
   install -m644 poppler-qt5.pc "${pkgdir}/usr/lib/pkgconfig/"
-  rm -f "${pkgdir}"/usr/lib/libpoppler.*
 }
+
diff --git a/abs/core/poppler/gtk-doc.patch b/abs/core/poppler/gtk-doc.patch
new file mode 100644
index 0000000..1b37bc5
--- /dev/null
+++ b/abs/core/poppler/gtk-doc.patch
@@ -0,0 +1,24 @@
+--- a/gtkdoc.py
++++ b/gtkdoc.py
+@@ -319,9 +319,9 @@ class GTKDoc(object):
+             ldflags = ' "-L%s" %s ' % (self.library_path, additional_ldflags) +
+ ldflags
+             current_ld_library_path = env.get('LD_LIBRARY_PATH')
+             if current_ld_library_path:
+-                env['RUN'] = 'LD_LIBRARY_PATH="%s:%s" ' % (self.library_path, current_ld_library_path)
++                env['LD_LIBRARY_PATH'] = '%s:%s' % (self.library_path, current_ld_library_path)
+             else:
+-                env['RUN'] = 'LD_LIBRARY_PATH="%s" ' % self.library_path
++                env['LD_LIBRARY_PATH'] = self.library_path
+ 
+         if ldflags:
+             env['LDFLAGS'] = '%s %s' % (ldflags, env.get('LDFLAGS', ''))
+@@ -332,8 +332,6 @@ class GTKDoc(object):
+             self.logger.debug('CFLAGS=%s', env['CFLAGS'])
+         if 'LDFLAGS' in env:
+             self.logger.debug('LDFLAGS %s', env['LDFLAGS'])
+-        if 'RUN' in env:
+-            self.logger.debug('RUN=%s', env['RUN'])
+         self._run_command(['gtkdoc-scangobj', '--module=%s' % self.module_name],
+                           env=env, cwd=self.output_dir)
+
-- 
cgit v0.12

