@@ -1,5 +1,20 @@
1−{ stdenv, lib, fetchurl, cmake, ninja, pkg-config, libiconv, libintl
2−, zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg, fetchpatch
1+{ stdenv
2+, lib
3+, fetchurl
4+, fetchpatch
5+, cairo
6+, cmake
7+, curl
8+, fontconfig
9+, freetype
10+, lcms
11+, libiconv
12+, libintl
13+, libjpeg
14+, ninja
15+, openjpeg
16+, pkg-config
17+, zlib
318, withData ? true, poppler_data
419, qt5Support ? false, qtbase ? null
520, introspectionSupport ? false, gobject-introspection ? null
@@ -12,25 +27,38 @@ let
1227 mkFlag = optset: flag: "-DENABLE_${flag}=${if optset then "on" else "off"}";
1328in
1429stdenv.mkDerivation rec {
15− name = "poppler-${suffix}-${version}";
30+ pname = "poppler-${suffix}";
31+ inherit version;
1632
1733 src = fetchurl {
18− url = "${meta.homepage}/poppler-${version}.tar.xz";
34+ url = "https://poppler.freedesktop.org/poppler-${version}.tar.xz";
1935 sha256 = "1afdrxxkaivvviazxkg5blsf2x24sjkfj92ib0d3q5pm8dihjrhj";
2036 };
2137
2238 outputs = [ "out" "dev" ];
2339
2440 patches = [
41+ # Fix internal crash: a negative number that should not be
2542 (fetchpatch {
2643 name = "CVE-2018-13988";
2744 url = "https://cgit.freedesktop.org/poppler/poppler/patch/?id=004e3c10df0abda214f0c293f9e269fdd979c5ee";
2845 sha256 = "1l8713s57xc6g81bldw934rsfm140fqc7ggd50ha5mxdl1b3app2";
2946 })
47+ # Fix internal crash: a negative number that should not be (not the above!)
3048 ./0.61-CVE-2019-9959.patch
3149 ];
3250
33− buildInputs = [ libiconv libintl ] ++ lib.optional withData poppler_data;
51+ nativeBuildInputs = [
52+ cmake
53+ ninja
54+ pkg-config
55+ ];
56+
57+ buildInputs = [
58+ libiconv
59+ libintl
60+ ]
61+ ++ lib.optional withData poppler_data;
3462
3563 # TODO: reduce propagation to necessary libs
3664 propagatedBuildInputs = with lib;
@@ -39,8 +67,6 @@ stdenv.mkDerivation rec {
3967 ++ optional qt5Support qtbase
4068 ++ optional introspectionSupport gobject-introspection;
4169
42− nativeBuildInputs = [ cmake ninja pkg-config ];
43−
4470 # Not sure when and how to pass it. It seems an upstream bug anyway.
4571 CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
4672
@@ -58,12 +84,10 @@ stdenv.mkDerivation rec {
5884 meta = with lib; {
5985 homepage = "https://poppler.freedesktop.org/";
6086 description = "A PDF rendering library";
61−
6287 longDescription = ''
6388 Poppler is a PDF rendering library based on the xpdf-3.0 code base.
6489 '';
65−
66− license = licenses.gpl2;
90+ license = licenses.gpl2Plus;
6791 platforms = platforms.all;
6892 maintainers = with maintainers; [ ttuegel ];
6993 };