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