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