python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / tools / typesetting / pdf2djvu / default.nix
blob6921c64d85fa5776d12d133a6e79bf0f2f80e5ef
1 { stdenv
2 , lib
3 , fetchFromGitHub
4 , fetchpatch
5 , autoreconfHook
6 , gettext
7 , libtool
8 , pkg-config
9 , djvulibre
10 , exiv2
11 , fontconfig
12 , graphicsmagick
13 , libjpeg
14 , libuuid
15 , poppler
18 stdenv.mkDerivation rec {
19   version = "0.9.18.2";
20   pname = "pdf2djvu";
22   src = fetchFromGitHub {
23     owner = "jwilk";
24     repo = "pdf2djvu";
25     rev = version;
26     sha256 = "s6n7nDO15DZSJ1EOPoNvjdFv/QtOoGiUa2b/k3kzWe8=";
27   };
29   patches = [
30     # Fix build with Poppler 22.03.
31     (fetchpatch {
32       url = "https://github.com/jwilk/pdf2djvu/commit/e170ad557d5f13daeeac047dfaa79347bbe5062f.patch";
33       sha256 = "OPK2UWVs+E2uOEaxPtLWmVL28yCxaeJKscY9ziAbS7E=";
34     })
35     (fetchpatch {
36       url = "https://github.com/jwilk/pdf2djvu/commit/956fedc7e0831126b9006efedad5519c14201c52.patch";
37       sha256 = "JF1xvvL2WyMu6GjdrPLlRC6eC6vGLbVurQcNy3AOOXA=";
38     })
39     (fetchpatch {
40       url = "https://github.com/jwilk/pdf2djvu/commit/dca43e8182174bc04e107eaefcafcfdfdf9bcd61.patch";
41       sha256 = "0JcfDaVZpuv6VfUJ2HuxRqgntZ/t8AzU0RG/E83BWGY=";
42     })
43     (fetchpatch {
44       url = "https://github.com/jwilk/pdf2djvu/commit/81b635e014ebd0240a8719cc39b6a1b759cc6a98.patch";
45       sha256 = "LBmT4eflLd23X7gg7IbqGe3PfTGldEGFLEKImV4nbB0=";
46       postFetch = ''
47         # The file was renamed after the release.
48         sed -i "s/main.cc/pdf2djvu.cc/g" "$out"
49       '';
50     })
51   ];
53   nativeBuildInputs = [ autoreconfHook pkg-config ];
55   buildInputs = [
56     djvulibre
57     exiv2
58     fontconfig
59     graphicsmagick
60     libjpeg
61     libuuid
62     poppler
63   ];
65   postPatch = ''
66     substituteInPlace private/autogen \
67       --replace /usr/share/gettext ${gettext}/share/gettext \
68       --replace /usr/share/libtool ${libtool}/share/libtool
70     substituteInPlace configure.ac \
71       --replace '$djvulibre_bin_path' ${djvulibre.bin}/bin
72   '';
74   preAutoreconf = ''
75     private/autogen
76   '';
78   enableParallelBuilding = true;
80   # Required by Poppler
81   # https://github.com/jwilk/pdf2djvu/commit/373e065faf2f0d868a3700788d20a96e9528bb12
82   CXXFLAGS = "-std=c++17";
84   meta = with lib; {
85     description = "Creates djvu files from PDF files";
86     homepage = "https://jwilk.net/software/pdf2djvu";
87     license = licenses.gpl2;
88     maintainers = with maintainers; [ pSub ];
89   };