2013-06-18 23:42:25 +02:00
|
|
|
{ stdenv, fetchurl, fetchgit, pkgconfig, cmake, libiconvOrEmpty, libintlOrEmpty
|
2013-06-29 16:07:15 +02:00
|
|
|
, zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg
|
2011-07-11 15:04:38 +02:00
|
|
|
, qt4Support ? false, qt4 ? null
|
|
|
|
}:
|
2008-07-17 17:02:57 +02:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
let
|
2014-07-13 21:55:19 +02:00
|
|
|
version = "0.26.2"; # even major numbers are stable
|
|
|
|
sha256 = "09lm1mfpf0p6vzayl2nbwvsj5gl7sz8sfmwziix0p87bh8x9dn8x";
|
2007-11-11 17:00:51 +01:00
|
|
|
|
2013-04-18 20:54:47 +02:00
|
|
|
qtcairo_patches =
|
2014-01-18 10:44:41 +01:00
|
|
|
let qtcairo = fetchgit { # the version for poppler-0.24
|
2013-04-18 20:54:47 +02:00
|
|
|
url = "git://github.com/giddie/poppler-qt4-cairo-backend.git";
|
2014-07-13 21:55:19 +02:00
|
|
|
rev = "7b9e1ea763b579e635ee7614b10970b9635841cf";
|
|
|
|
sha256 = "0cdq0qw1sm6mxnrhmah4lfsd9wjlcdx86iyikwmjpwdmrkjk85r2";
|
2013-04-18 20:54:47 +02:00
|
|
|
}; in
|
|
|
|
[ "${qtcairo}/0001-Cairo-backend-added-to-Qt4-wrapper.patch"
|
|
|
|
"${qtcairo}/0002-Setting-default-Qt4-backend-to-Cairo.patch"
|
|
|
|
"${qtcairo}/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch" ];
|
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
poppler_drv = nameSuff: merge: stdenv.mkDerivation (stdenv.lib.mergeAttrsByFuncDefaultsClean [
|
|
|
|
rec {
|
|
|
|
name = "poppler-${nameSuff}-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2013-08-25 19:54:02 +02:00
|
|
|
url = "${meta.homepage}/poppler-${version}.tar.xz";
|
2013-04-21 22:15:38 +02:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2013-06-29 16:07:15 +02:00
|
|
|
propagatedBuildInputs = [ zlib cairo freetype fontconfig libjpeg lcms curl openjpeg ];
|
2013-04-21 22:15:38 +02:00
|
|
|
|
2013-06-18 23:42:25 +02:00
|
|
|
nativeBuildInputs = [ pkgconfig cmake ] ++ libiconvOrEmpty ++ libintlOrEmpty;
|
2013-04-18 20:54:47 +02:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
cmakeFlags = "-DENABLE_XPDF_HEADERS=ON -DENABLE_LIBCURL=ON -DENABLE_ZLIB=ON";
|
2007-11-11 17:00:51 +01:00
|
|
|
|
2014-01-01 09:35:31 +01:00
|
|
|
patches = [ ./datadir_env.patch ./poppler-glib.patch ];
|
2007-11-11 17:00:51 +01:00
|
|
|
|
2013-04-21 22:15:38 +02: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 17:02:57 +02:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
enableParallelBuilding = true;
|
2011-09-19 10:35:30 +02:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
meta = {
|
|
|
|
homepage = http://poppler.freedesktop.org/;
|
|
|
|
description = "A PDF rendering library";
|
2008-07-17 17:02:57 +02:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
longDescription = ''
|
|
|
|
Poppler is a PDF rendering library based on the xpdf-3.0 code base.
|
|
|
|
'';
|
2011-07-11 15:04:38 +02:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
license = "GPLv2";
|
2013-06-18 22:02:52 +02:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2013-04-21 22:15:38 +02:00
|
|
|
};
|
|
|
|
} merge ]); # poppler_drv
|
2009-02-21 00:43:29 +01:00
|
|
|
|
2013-04-21 22:15:38 +02: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-21 00:43:29 +01:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
poppler_glib = poppler_drv "glib" { };
|
2010-12-14 14:30:06 +01:00
|
|
|
|
2013-04-21 22:15:38 +02:00
|
|
|
poppler_qt4 = poppler_drv "qt4" {
|
|
|
|
propagatedBuildInputs = [ qt4 poppler_glib ];
|
|
|
|
patches = qtcairo_patches;
|
2013-05-26 15:12:21 +02:00
|
|
|
NIX_LDFLAGS = "-lpoppler";
|
2014-04-24 10:52:42 +02:00
|
|
|
postConfigure = ''
|
|
|
|
mkdir -p "$out/lib/pkgconfig"
|
|
|
|
install -c -m 644 poppler-qt4.pc "$out/lib/pkgconfig"
|
|
|
|
cd qt4
|
|
|
|
'';
|
2008-07-17 17:02:57 +02:00
|
|
|
};
|
2013-10-24 18:08:48 +02:00
|
|
|
|
|
|
|
in { inherit poppler_glib poppler_qt4; } // poppler_glib
|