1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, libjpeg
6, perl
7, zlib
8
9# for passthru.tests
10, cups-filters
11, pdfmixtool
12, pdfslicer
13, python3
14, testers
15, versionCheckHook
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "qpdf";
20 version = "11.9.1";
21
22 src = fetchFromGitHub {
23 owner = "qpdf";
24 repo = "qpdf";
25 rev = "v${finalAttrs.version}";
26 hash = "sha256-DhrOKjUPgNo61db8av0OTfM8mCNebQocQWtTWdt002s=";
27 };
28
29 outputs = [
30 "bin"
31 "doc"
32 "lib"
33 "man"
34 "out"
35 ];
36
37 nativeBuildInputs = [ cmake perl ];
38
39 buildInputs = [ zlib libjpeg ];
40
41 nativeInstallCheckInputs = [ versionCheckHook ];
42 doInstallCheck = true;
43
44 preConfigure = ''
45 patchShebangs qtest/bin/qtest-driver
46 patchShebangs run-qtest
47 # qtest needs to know where the source code is
48 substituteInPlace CMakeLists.txt --replace "run-qtest" "run-qtest --top $src --code $src --bin $out"
49 '';
50
51 doCheck = true;
52
53 passthru.tests = {
54 pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };
55 inherit (python3.pkgs) pikepdf;
56 inherit
57 cups-filters
58 pdfmixtool
59 pdfslicer
60 ;
61 };
62
63 meta = {
64 homepage = "https://qpdf.sourceforge.io/";
65 description = "C++ library and set of programs that inspect and manipulate the structure of PDF files";
66 license = lib.licenses.asl20; # as of 7.0.0, people may stay at artistic2
67 maintainers = with lib.maintainers; [ abbradar ];
68 mainProgram = "qpdf";
69 platforms = lib.platforms.all;
70 changelog = "https://github.com/qpdf/qpdf/blob/v${finalAttrs.version}/ChangeLog";
71 pkgConfigModules = [ "libqpdf" ];
72 };
73})