about summary refs log tree commit diff
path: root/pkgs/development/libraries/qpdf/default.nix
blob: 4a9e520f2a979fae35a76b5b72891e1e0237f9e7 (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
{ lib
, stdenv
, fetchFromGitHub
, cmake
, libjpeg
, perl
, zlib

# for passthru.tests
, cups-filters
, pdfmixtool
, pdfslicer
, python3
, testers
, versionCheckHook
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "qpdf";
  version = "11.9.1";

  src = fetchFromGitHub {
    owner = "qpdf";
    repo = "qpdf";
    rev = "v${finalAttrs.version}";
    hash = "sha256-DhrOKjUPgNo61db8av0OTfM8mCNebQocQWtTWdt002s=";
  };

  outputs = [
    "bin"
    "doc"
    "lib"
    "man"
    "out"
  ];

  nativeBuildInputs = [ cmake perl ];

  buildInputs = [ zlib libjpeg ];

  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;

  preConfigure = ''
    patchShebangs qtest/bin/qtest-driver
    patchShebangs run-qtest
    # qtest needs to know where the source code is
    substituteInPlace CMakeLists.txt --replace "run-qtest" "run-qtest --top $src --code $src --bin $out"
  '';

  doCheck = true;

  passthru.tests = {
    pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; };
    inherit (python3.pkgs) pikepdf;
    inherit
      cups-filters
      pdfmixtool
      pdfslicer
    ;
  };

  meta = {
    homepage = "https://qpdf.sourceforge.io/";
    description = "C++ library and set of programs that inspect and manipulate the structure of PDF files";
    license = lib.licenses.asl20; # as of 7.0.0, people may stay at artistic2
    maintainers = with lib.maintainers; [ abbradar ];
    mainProgram = "qpdf";
    platforms = lib.platforms.all;
    changelog = "https://github.com/qpdf/qpdf/blob/v${finalAttrs.version}/ChangeLog";
    pkgConfigModules = [ "libqpdf" ];
  };
})