2014-12-03 12:49:33 +00:00
|
|
|
{ stdenv, fetchurl, fetchpatch, pkgconfig, cmake, libiconvOrEmpty, libintlOrEmpty
|
2013-06-29 14:07:15 +00:00
|
|
|
, zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg
|
2015-01-19 17:12:04 +00:00
|
|
|
, qt4Support ? false, qt4 ? null, qt5
|
2011-07-11 13:04:38 +00:00
|
|
|
}:
|
2008-07-17 15:02:57 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
let
|
2014-11-08 14:44:22 +00:00
|
|
|
version = "0.28.1"; # even major numbers are stable
|
|
|
|
sha256 = "01pxjdbhvpxf00ncf8d9wxc8gkcqcxz59lwrpa151ah988inxkrc";
|
2013-04-18 18:54:47 +00:00
|
|
|
|
2014-12-03 12:49:33 +00:00
|
|
|
# This is for Okular (and similar) to support subpixel rendering.
|
|
|
|
# It's kept from upstream because of political reasons.
|
|
|
|
qtcairo_patch = fetchpatch {
|
|
|
|
url = "https://github.com/giddie/poppler-qt4-cairo-backend/compare/"
|
|
|
|
+ "fa1d636...b30f96c.diff"; # update to current maint...qt4-lcd
|
|
|
|
sha256 = "0g18y247k2vcz1n56rnfpy226f22v4r9c7pk8cf2h9l12vz2qxkm";
|
|
|
|
};
|
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
poppler_drv = nameSuff: merge: stdenv.mkDerivation (stdenv.lib.mergeAttrsByFuncDefaultsClean [
|
|
|
|
rec {
|
|
|
|
name = "poppler-${nameSuff}-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2013-08-25 17:54:02 +00:00
|
|
|
url = "${meta.homepage}/poppler-${version}.tar.xz";
|
2013-04-21 20:15:38 +00:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2013-06-29 14:07:15 +00:00
|
|
|
propagatedBuildInputs = [ zlib cairo freetype fontconfig libjpeg lcms curl openjpeg ];
|
2013-04-21 20:15:38 +00:00
|
|
|
|
2013-06-18 21:42:25 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig cmake ] ++ libiconvOrEmpty ++ libintlOrEmpty;
|
2013-04-18 18:54:47 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
cmakeFlags = "-DENABLE_XPDF_HEADERS=ON -DENABLE_LIBCURL=ON -DENABLE_ZLIB=ON";
|
2007-11-11 16:00:51 +00:00
|
|
|
|
2014-01-01 08:35:31 +00:00
|
|
|
patches = [ ./datadir_env.patch ./poppler-glib.patch ];
|
2007-11-11 16:00:51 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
# XXX: The Poppler/Qt4 test suite refers to non-existent PDF files
|
|
|
|
# such as `../../../test/unittestcases/UseNone.pdf'.
|
|
|
|
#doCheck = !qt4Support;
|
|
|
|
checkTarget = "test";
|
2008-07-17 15:02:57 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
enableParallelBuilding = true;
|
2011-09-19 08:35:30 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
meta = {
|
|
|
|
homepage = http://poppler.freedesktop.org/;
|
|
|
|
description = "A PDF rendering library";
|
2008-07-17 15:02:57 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
longDescription = ''
|
|
|
|
Poppler is a PDF rendering library based on the xpdf-3.0 code base.
|
|
|
|
'';
|
2011-07-11 13:04:38 +00:00
|
|
|
|
2014-06-19 04:19:00 +00:00
|
|
|
license = stdenv.lib.licenses.gpl2;
|
2013-06-18 20:02:52 +00:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2013-04-21 20:15:38 +00:00
|
|
|
};
|
|
|
|
} merge ]); # poppler_drv
|
2009-02-20 23:43:29 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
/* We always use cairo in poppler, so we always depend on glib,
|
|
|
|
so we always build the glib wrapper (~350kB).
|
|
|
|
We also always build the cpp wrapper (<100kB).
|
|
|
|
ToDo: around half the size could be saved by splitting out headers and tools (1.5 + 0.5 MB).
|
|
|
|
*/
|
2009-02-20 23:43:29 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
poppler_glib = poppler_drv "glib" { };
|
2010-12-14 13:30:06 +00:00
|
|
|
|
2013-04-21 20:15:38 +00:00
|
|
|
poppler_qt4 = poppler_drv "qt4" {
|
2014-12-03 12:49:33 +00:00
|
|
|
patches = [ qtcairo_patch ];
|
2013-04-21 20:15:38 +00:00
|
|
|
propagatedBuildInputs = [ qt4 poppler_glib ];
|
2013-05-26 13:12:21 +00:00
|
|
|
NIX_LDFLAGS = "-lpoppler";
|
2014-04-24 08:52:42 +00:00
|
|
|
postConfigure = ''
|
|
|
|
mkdir -p "$out/lib/pkgconfig"
|
|
|
|
install -c -m 644 poppler-qt4.pc "$out/lib/pkgconfig"
|
|
|
|
cd qt4
|
|
|
|
'';
|
2008-07-17 15:02:57 +00:00
|
|
|
};
|
2013-10-24 16:08:48 +00:00
|
|
|
|
2015-01-19 17:12:04 +00:00
|
|
|
poppler_qt5 = poppler_drv "qt5" {
|
|
|
|
propagatedBuildInputs = [ qt5 poppler_glib ];
|
|
|
|
postConfigure = ''
|
|
|
|
mkdir -p "$out/lib/pkgconfig"
|
|
|
|
install -c -m 644 poppler-qt5.pc "$out/lib/pkgconfig"
|
|
|
|
cd qt5
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in { inherit poppler_glib poppler_qt4 poppler_qt5; } // poppler_glib
|