about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/fntsample/default.nix
blob: 6600b7fab72b33f8945a78c2f49a3758b87ba7b8 (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
74
75
76
77
78
79
80
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, cmake
, pkg-config
, cairo
, fontconfig
, freetype
, glib
, libXdmcp
, makeWrapper
, pango
, pcre
, perlPackages
}:

let
  ucd-blocks = fetchurl {
    url = "https://www.unicode.org/Public/15.0.0/ucd/Blocks.txt";
    hash = "sha256-Up3F0PY4bVLy9W4AS7+rSM4tWH7qnTi6VGxAUkkb2CA=";
  };
in
stdenv.mkDerivation rec {
  pname = "fntsample";
  version = "5.4";

  src = fetchFromGitHub {
    owner = "eugmes";
    repo = pname;
    rev = "release/${version}";
    hash = "sha256-O5RT68wPWwzCb51JZWWNcIubWoM7NZw/MRiaHXPDmF0=";
  };

  cmakeFlags = [
    "-DUNICODE_BLOCKS=${ucd-blocks.outPath}"
  ];

  outputs = [ "out" "man" ];

  nativeBuildInputs = [
    cmake
    makeWrapper
    pkg-config
  ];

  buildInputs = [
    cairo
    fontconfig
    freetype
    glib
    libXdmcp
    pango
    perlPackages.perl
    pcre
  ];

  postFixup =
    let
      perlPath = with perlPackages; makePerlPath [
        ExporterTiny
        ListMoreUtils
        PDFAPI2
        libintl-perl
      ];
    in ''
    for cmd in pdfoutline pdf-extract-outline; do
      wrapProgram "$out/bin/$cmd" --prefix PERL5LIB : "${perlPath}"
    done
  '';

  meta = with lib; {
    homepage = "https://github.com/eugmes/fntsample";
    description = "PDF and PostScript font samples generator";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ ];
    platforms = platforms.unix;
  };
}
# TODO: factor/package ucd-blocks