1{
2 stdenv,
3 lib,
4 fetchurl,
5 pkg-config,
6 autoreconfHook,
7 perl,
8 freetype,
9 harfbuzz,
10 libsForQt5,
11 enableGUI ? true,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 version = "1.8.4";
16 pname = "ttfautohint";
17
18 src = fetchurl {
19 url = "mirror://savannah/freetype/ttfautohint-${finalAttrs.version}.tar.gz";
20 hash = "sha256-iodhF/puv9L/4bNoKpqYyALA9HGJ9X09tLmXdCBoMuE=";
21 };
22
23 postPatch =
24 lib.optionalString stdenv.hostPlatform.isLinux ''
25 echo "${finalAttrs.version}" > VERSION
26 ''
27 + lib.optionalString stdenv.hostPlatform.isDarwin ''
28 substituteInPlace configure --replace-fail "macx-g++" "macx-clang"
29 '';
30
31 nativeBuildInputs = [
32 pkg-config
33 perl
34 ]
35 ++ lib.optionals stdenv.hostPlatform.isLinux [ autoreconfHook ]
36 ++ lib.optionals enableGUI [ libsForQt5.qt5.wrapQtAppsHook ];
37
38 buildInputs = [
39 freetype
40 harfbuzz
41 ]
42 ++ lib.optionals enableGUI [ libsForQt5.qt5.qtbase ];
43
44 configureFlags = [
45 ''--with-qt=${if enableGUI then "${libsForQt5.qt5.qtbase}/lib" else "no"}''
46 ]
47 ++ lib.optionals (!enableGUI) [ "--without-doc" ];
48
49 enableParallelBuilding = true;
50
51 meta = {
52 description = "Automatic hinter for TrueType fonts";
53 mainProgram = "ttfautohint";
54 longDescription = ''
55 A library and two programs which take a TrueType font as the
56 input, remove its bytecode instructions (if any), and return a
57 new font where all glyphs are bytecode hinted using the
58 information given by FreeType’s auto-hinting module.
59 '';
60 homepage = "https://www.freetype.org/ttfautohint";
61 license = lib.licenses.gpl2Plus; # or the FreeType License (BSD + advertising clause)
62 maintainers = [ ];
63 platforms = lib.platforms.unix;
64 };
65})