about summary refs log tree commit diff
path: root/pkgs/development/libraries/poppler/default.nix
blob: 89368282f2c9fd96cfe5090957f91d82dc32a46a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, libiconv, libintlOrEmpty
, zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg
, withData ? false, poppler_data
, qt4Support ? false, qt4 ? null
, qt5Support ? false, qtbase ? null
, introspectionSupport ? false, gobjectIntrospection ? null
, utils ? false
, minimal ? false, suffix ? "glib"
}:

let # beware: updates often break cups-filters build
  version = "0.50.0";
  sha256 = "0dmwnh59m75vhii6dw63x8l0qa0ha733pb8bdqzr7lw9nwc37jf9";
in
stdenv.mkDerivation rec {
  name = "poppler-${suffix}-${version}";

  src = fetchurl {
    url = "${meta.homepage}/poppler-${version}.tar.xz";
    inherit sha256;
  };

  outputs = [ "out" "dev" ];

  buildInputs = [ libiconv ] ++ libintlOrEmpty ++ lib.optional withData poppler_data;

  # TODO: reduce propagation to necessary libs
  propagatedBuildInputs = with lib;
    [ zlib freetype fontconfig libjpeg openjpeg ]
    ++ optionals (!minimal) [ cairo lcms curl ]
    ++ optional qt4Support qt4
    ++ optional qt5Support qtbase
    ++ optional introspectionSupport gobjectIntrospection;

  nativeBuildInputs = [ pkgconfig ];

  NIX_CFLAGS_COMPILE = [ "-DQT_NO_DEBUG" ];

  CXXFLAGS = lib.optional qt5Support "-std=c++11";

  configureFlags = with lib;
    [
      "--enable-xpdf-headers"
      "--enable-libcurl"
      "--enable-zlib"
      "--enable-build-type=release"
    ]
    ++ optionals minimal [
      "--disable-poppler-glib" "--disable-poppler-cpp"
      "--disable-libcurl"
    ]
    ++ optional (!utils) "--disable-utils"
    ++ optional introspectionSupport "--enable-introspection";

  enableParallelBuilding = true;

  crossAttrs.postPatch =
    # there are tests using `strXXX_s` functions that are missing apparently
    stdenv.lib.optionalString (stdenv.cross.libc or null == "msvcrt")
      "sed '/^SUBDIRS =/s/ test / /' -i Makefile.in";

  meta = with lib; {
    homepage = http://poppler.freedesktop.org/;
    description = "A PDF rendering library";

    longDescription = ''
      Poppler is a PDF rendering library based on the xpdf-3.0 code base.
    '';

    license = licenses.gpl2;
    platforms = platforms.all;
    maintainers = with maintainers; [ ttuegel ];
  };
}