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