11 , gobject-introspection
14 , harfbuzz # The icu variant uses and propagates the non-icu one.
17 , withCoreText ? false
18 , withIcu ? false # recommended by upstream as default, but most don't needed and it's big
19 , withGraphite2 ? true # it is small and major distros do include it
34 inherit (lib) optional optionals optionalString;
35 mesonFeatureFlag = opt: b:
36 "-D${opt}=${if b then "enabled" else "disabled"}";
40 pname = "harfbuzz${optionalString withIcu "-icu"}";
44 url = "https://github.com/harfbuzz/harfbuzz/releases/download/${version}/harfbuzz-${version}.tar.xz";
45 sha256 = "0b4lpkidwx0lf8slczjji652yll6g5zgmm5lmisnb4s7gf8r8nkk";
49 patchShebangs src/*.py test
50 '' + lib.optionalString stdenv.isDarwin ''
51 # ApplicationServices.framework headers have cast-align warnings.
52 substituteInPlace src/hb.hh \
53 --replace '#pragma GCC diagnostic error "-Wcast-align"' ""
56 outputs = [ "out" "dev" "devdoc" ];
60 # upstream recommends cairo, but it is only used for development purposes
61 # and is not part of the library.
62 # Cairo causes transitive (build) dependencies on various X11 or other
63 # GUI-related libraries, so it shouldn't be re-added lightly.
64 (mesonFeatureFlag "cairo" false)
65 # chafa is only used in a development utility, not in the library
66 (mesonFeatureFlag "chafa" false)
67 (mesonFeatureFlag "coretext" withCoreText)
68 (mesonFeatureFlag "graphite" withGraphite2)
69 (mesonFeatureFlag "icu" withIcu)
88 buildInputs = [ glib freetype gobject-introspection ]
89 ++ lib.optionals withCoreText [ ApplicationServices CoreText ];
91 propagatedBuildInputs = optional withGraphite2 graphite2
92 ++ optionals withIcu [ icu harfbuzz ];
96 # Slightly hacky; some pkgs expect them in a single directory.
97 postFixup = optionalString withIcu ''
98 rm "$out"/lib/libharfbuzz.* "$dev/lib/pkgconfig/harfbuzz.pc"
99 ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.la
100 ln -s {'${harfbuzz.dev}',"$dev"}/lib/pkgconfig/harfbuzz.pc
101 ${optionalString stdenv.isDarwin ''
102 ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.dylib
103 ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.0.dylib
108 inherit gimp gtk3 gtk4 mapnik;
109 inherit (qt5) qtbase;
113 description = "An OpenType text shaping engine";
114 homepage = "https://harfbuzz.github.io/";
115 maintainers = [ maintainers.eelco ];
116 license = licenses.mit;
117 platforms = with platforms; linux ++ darwin;