SUMMARY="A PDF rendering library"
DESCRIPTION="Poppler is a PDF rendering library based on the xpdf-3.0 code \
base."
HOMEPAGE="https://poppler.freedesktop.org/"
COPYRIGHT="2008 Adam Batkin
 	Adobe Systems Inc.
 	2012-2015 Adam Reichold
 	2007-2017 Adrian Johnson
 	2008 Adrian Page
 	2013 Adrian Perez de Castro
 	2014 Aki Koskinen
 	2004-2017 Albert Astals Cid
 	2015 Aleksei Volkov
 	2006-2010 Alexander Neundorf
 	2012 Alexander Saprykin
 	2012 Alexey Pavlov
 	2016 Alok Anand
 	2015 André Esser
 	2015 André Guerreiro
 	2011 Andrea Canciani
 	2011 Andreas Hartmetz
 	2013 Anthony Granger
 	2012 Anthony Wesley
 	2014 Anuj Khare
 	2015-2016 Arseniy Lartsev
 	2012 Arseny Solokha
 	2015 Arthur Stavisky
 	2009, 2011 Axel Strübing
 	2014 Bogdan Cristea
 	2008 Boris Toloknov
 	2005-2008 Brad Hards
 	2010 Brian Cameron
 	2010 Brian Ewins
 	2016-2017 Caolán McNamara
 	2006-2016 Carlos Garcia Campos
 	2008 Carl Worth
 	2010 Christian Feuersänger
 	2009 Christian Persch
 	2008-2009 Chris Wilson
 	2017 Christoph Cullmann
 	2013 Christoph Duelli
 	1998-2003 Daniel Veillard
 	2011 Daiki Ueno
 	2005 Dan Sheridan
 	2011 Daniel Glöckner
 	2013 Daniel Kahn Gillmor
 	2011 Daniel Richard G.
 	2009 Darren Kenny
 	2009-2010 David Benjamin
 	2006 David Faure
 	1997, Derek B. Noonburg
 	2015 Dmytro Morgun
 	2013 Dominik Haumann
 	2006-2007 Dominic Lachowicz
 	2008 Ed Avis
 	2006-2007, 2013 Ed Catmur
 	2014 Ed Porras
 	2011 Edward Jiang
 	2004 Enrico Ros
 	2009 Eric Toombs
 	2012, 2015 Even Rouault
 	2012-2014 Fabio D'Urso
 	2017 Francesco Poli
 	1989, 1991-2016 Free Software Foundation, Inc.
 	2012 Gerald Schmidt
 	2013 German Poo-Caamano
 	2011 Glad Deschrijver
 	1996-2013 Glyph & Cog, LLC.
 	2009 Glenn Ganz
 	1999-2000 Gueorgui Ovtcharov
 	2010, 2012 Guillermo A. Amaral B.
 	2016 Hanno Meyer-Thurow
 	2014-2015 Hans-Peter Deifel
 	2017 Hans-Ulrich Jüttner
 	2010 Harry Roberts
 	2008 Haruyuki Kawabe
 	2008, 2010-2014 Hib Eris
 	2012 Horst Prote
 	2017 Hubert Figuière
 	2008 Hugo Mercier
 	2013-2014 Igalia S.L.
 	2011-2012 Igor Slepchin
 	2012 Ihar Filipau
 	2007 Ilmari Heikkinen
 	2008-2010 Ilya Gorenbein
 	2007-2008 Iñigo Martínez
 	Insight Consortium
 	2016 Jakub Alba
 	2010 Jakob Voss
 	2016 Jakub Kucharski
 	2009-2010, 2015 Jakub Wilk
 	2017 Jan-Erik S
 	2009 Jan Jockusch
 	2010 Jan Kümmel
 	2017 Jason Alan Palmer
 	2012-2016 Jason Crain
 	2006-2007 Jauco Noordzij
 	2005-2008 Jeff Muizelaar
 	2016 Jeffrey Morlan
 	2015 Jeremy Echols
 	Jerry Epplin
 	2011 Jim Meyering
 	2014 Jiri Slaby
 	2013 Johannes Brandstätter
 	2005 Jonathan Blandford
 	2007-2009 Jonathan Kew
 	2010 Jonathan Liu
 	2011, 2013 José Aliste
 	2011 Joshua Richardson
 	2013 Julien Nabet
 	2006-2008 Julien Rebetez
 	2010 Jürg Billeter
 	2016 Khaled Hosny
 	2009 KDAB via Guillermo Amaral
 	2010 Kenneth Berland
 	2008 Kees Cook
 	2011, 2015 Kenji Uno
 	2002 Kitware, Inc.
 	2008 Kjartan Maraas
 	2007-2009, 2012 Koji Otani
 	2006-2007 Kouhei Sutou
 	2009 Kovid Goyal
 	2005-2007 Kristian Høgsberg
 	2006-2007 Krzysztof Kowalczyk
 	2006-2007 Laurent Montel
 	2017 Léonard Michelet
 	2013, 2015 Li Junling
 	2012-2013 Lu Wang
 	2014 Luigi Scarso
 	2012 Luis Parravicini
 	2005 Marco Pesenti Gritti
 	2010, 2012, 2014-2015 Marek Kasik
 	2012 Mark Brand
 	2008 Mark Kaplan
 	2010, 2012 Mark Riedesel
 	2015 Markus Kilås
 	2012 Markus Trippelsdorf
 	2005 Martin Kretzschmar
 	2016 Masamichi Hosoda
 	2009 Matthias Drochner
 	2010 Matthias Fauconneau
 	2009 Matthias Franz
 	2012 Matthias Kramm
 	2009 Michael K. Johnson
 	2008 Michael Vrable
 	2013 Michael Weiser
 	2009 M Joonas Pihlaja
 	2010 Mike Slegeir
 	2009 Mozilla Corporation
 	2005 Net Integration Technologies, Inc.
 	2009 Nick Jones
 	2005-2006 Nickolay V. Shmyrev
 	2010 Nils Höglund
 	2012-2017 Oliver Sander
 	2014 Olly Betts
 	2010 OSSD CDAC Mumbai by Leena Chourey and Onkar Potdar
 	2012 Patrick Pfeifer
 	2010 Patrick Spendrin
 	2006 Paul Walmsley
 	2010 Paweł Wiejacha
 	2012-2014 Peter Breitenlohner
 	2009 Peter Kerzum
 	2009, 2015 Petr Gajdos
 	2010 Philip Lorenz
 	2015 Philipp Reinkemeier
 	2006-2014 Pino Toscano
 	Rainer Dorsch
 	2006 Rainer Keller
 	2006 Raj Kumar
 	2009 Reece Dunn
 	2004-2006 Red Hat, Inc.
 	2008 Richard Airlie
 	2014 Richard PALO
 	2014 Rodrigo Rivas Costa
 	2017 Roland Hieber
 	2009 Ross Moore
 	2009 Ryszard Trojnacki
 	2011 Sam Liao
 	2009 Sanjoy Mahajan
 	2004 Scott James Remnant
 	2006 Scott Turner
 	2014 Scott West
 	2017 Sebastian Rasmussen
 	2009 Shawn Rutledge
 	2009 Shen Liang
 	2011 Simon Kellner
 	2010 Srinivas Adicherla
 	2005-2006 Stefan Kebekus
 	2006 Stefan Schweizer
 	2009 Stefan Thomas
 	2011 Stephen Reichling
 	2008 Steven G. Johnson
 	2014 Steven Lee
 	2011 Steven Murdoch
 	2010, 2012-2013, 2015 Suzuki Toshiya
 	2015 Tamas Szekeres
 	2005-2006 Takashi Iwai
 	2016 Takahiro Hashimoto
 	The GLib Team
 	2005-2010 The Poppler Developers
 	2013 Thomas Fischer
 	2009-2017 Thomas Freitag
 	2011 Thomas Klausner
 	2006 Thorkild Stray
 	2009, 2014 Till Kamppeter
 	2008 Timothy Lee
 	2017 Tobias C. Berner
 	2005, 2012, 2015 Tobias Koening
 	2011 Tom Gleason
 	2008 Tomas Are Haavet
 	2010-2011 Tomas Hoger
 	2016 Tor Lillqvist
 	2008 Vasile Gaburici
 	2016 Vincent Le Garrec
 	2011 Vittal Aithal
 	2012 Yi Yang
 	2013 Yury G. Kudryashov
 	2008-2009 Warren Toomey
 	2006 Wilfried Huss
 	2009-2016 William Bader
 	2007 Will Stephenson
 	1994 X Consortium"
LICENSE="GNU GPL v2"
REVISION="4"
SOURCE_URI="https://poppler.freedesktop.org/poppler-$portVersion.tar.xz"
CHECKSUM_SHA256="e62cd4053f851eecc4a6aa2b81d739fbab1d67b3c60b31ebac7049483cc617b1"
SOURCE_DIR="poppler-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libVersion="87.0.0"
libCppVersion="0.7.0"
libGlibVersion="8.12.0"
libQt5Version="1.19.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
libCppVersionCompat="$libCppVersion compat >= ${libCppVersion%%.*}"
libGlibVersionCompat="$libGlibVersion compat >= ${libGlibVersion%%.*}"
libQt5VersionCompat="$libQt5Version compat >= ${libQt5Version%%.*}"

PROVIDES="
	poppler076$secondaryArchSuffix = $portVersion
	lib:libpoppler$secondaryArchSuffix = $libVersionCompat
	lib:libpoppler_cpp$secondaryArchSuffix = $libCppVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	poppler_data
	lib:libcairo$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:libopenjp2$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

# GLIB
SUMMARY_glib="$SUMMARY (glib bindings)"
DESCRIPTION_glib="$DESCRIPTION (glib bindings)"

PROVIDES_glib="
	poppler076${secondaryArchSuffix}_glib = $portVersion
	lib:libpoppler_glib$secondaryArchSuffix = $libGlibVersionCompat
	"
REQUIRES_glib="
	haiku$secondaryArchSuffix
	poppler076$secondaryArchSuffix == $portVersion base
	lib:libcairo$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:libopenjp2$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

# QT5
SUMMARY_qt5="$SUMMARY (Qt5 bindings)"
DESCRIPTION_qt5="$DESCRIPTION (Qt5 bindings)"

PROVIDES_qt5="
	poppler076${secondaryArchSuffix}_qt5 = $portVersion
	lib:libpoppler_qt5$secondaryArchSuffix = $libQt5VersionCompat
	"
REQUIRES_qt5="
	haiku$secondaryArchSuffix
	poppler076$secondaryArchSuffix == $portVersion base
	lib:libcurl$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:libopenjp2$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcairo$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libgio_2.0$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libgobject_2.0$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:liblcms2$secondaryArchSuffix
	#devel:libnss3$secondaryArchSuffix
	devel:libopenjp2$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gawk
	cmd:grep
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	cmd:python2
	"

defineDebugInfoPackage poppler076$secondaryArchSuffix \
	"$libDir"/libpoppler.so.$libVersion \
	"$libDir"/libpoppler-cpp.so.$libCppVersion \
	"$(getPackagePrefix glib)/$relativeLibDir"/libpoppler-glib.so.$libGlibVersion \
	"$(getPackagePrefix qt5)/$relativeLibDir"/libpoppler-qt5.so.$libQt5Version

BUILD()
{
	cmake . $cmakeDirArgs \
		-DCMAKE_CXX_FLAGS="-D_BSD_SOURCE" \
		-DCMAKE_BUILD_TYPE=Release \
		-DENABLE_UNSTABLE_API_ABI_HEADERS=ON
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libpoppler \
		libpoppler-cpp \
		libpoppler-glib \
		libpoppler-qt5

	mkdir -p $manDir
	rm -rf $prefix/include $developDir $prefix/share $libDir/pkgconfig $binDir $manDir

	# GLIB
	packageEntries "glib" \
		$libDir/*glib*

	# QT5
	packageEntries "qt5" \
		$libDir/*qt5*
}
