1{ lib
2, stdenv
3, fetchurl
4, fetchFromGitHub
5, cmake
6, pkg-config
7, cairo
8, fontconfig
9, freetype
10, glib
11, libXdmcp
12, makeWrapper
13, pango
14, pcre
15, perlPackages
16}:
17
18let
19 ucd-blocks = fetchurl {
20 url = "https://www.unicode.org/Public/15.0.0/ucd/Blocks.txt";
21 hash = "sha256-Up3F0PY4bVLy9W4AS7+rSM4tWH7qnTi6VGxAUkkb2CA=";
22 };
23in
24stdenv.mkDerivation rec {
25 pname = "fntsample";
26 version = "5.4";
27
28 src = fetchFromGitHub {
29 owner = "eugmes";
30 repo = pname;
31 rev = "release/${version}";
32 hash = "sha256-O5RT68wPWwzCb51JZWWNcIubWoM7NZw/MRiaHXPDmF0=";
33 };
34
35 cmakeFlags = [
36 "-DUNICODE_BLOCKS=${ucd-blocks.outPath}"
37 ];
38
39 outputs = [ "out" "man" ];
40
41 nativeBuildInputs = [
42 cmake
43 makeWrapper
44 pkg-config
45 ];
46
47 buildInputs = [
48 cairo
49 fontconfig
50 freetype
51 glib
52 libXdmcp
53 pango
54 perlPackages.perl
55 pcre
56 ];
57
58 postFixup =
59 let
60 perlPath = with perlPackages; makePerlPath [
61 ExporterTiny
62 ListMoreUtils
63 PDFAPI2
64 libintl-perl
65 ];
66 in ''
67 for cmd in pdfoutline pdf-extract-outline; do
68 wrapProgram "$out/bin/$cmd" --prefix PERL5LIB : "${perlPath}"
69 done
70 '';
71
72 meta = with lib; {
73 homepage = "https://github.com/eugmes/fntsample";
74 description = "PDF and PostScript font samples generator";
75 license = licenses.gpl3Plus;
76 maintainers = with maintainers; [ ];
77 platforms = platforms.unix;
78 };
79}
80# TODO: factor/package ucd-blocks