nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.09 87 lines 2.6 kB view raw
1{ stdenv, fetchFromGitHub, pkgconfig, glib, freetype, cairo, libintl 2, meson, ninja 3, gobject-introspection 4, icu, graphite2, harfbuzz # The icu variant uses and propagates the non-icu one. 5, ApplicationServices, CoreText 6, withCoreText ? false 7, withIcu ? false # recommended by upstream as default, but most don't needed and it's big 8, withGraphite2 ? true # it is small and major distros do include it 9, python3 10, gtk-doc, docbook-xsl-nons, docbook_xml_dtd_43 11}: 12 13let 14 version = "2.7.1"; 15 inherit (stdenv.lib) optional optionals optionalString; 16 mesonFeatureFlag = opt: b: 17 "-D${opt}=${if b then "enabled" else "disabled"}"; 18in 19 20stdenv.mkDerivation { 21 name = "harfbuzz${optionalString withIcu "-icu"}-${version}"; 22 23 src = fetchFromGitHub { 24 owner = "harfbuzz"; 25 repo = "harfbuzz"; 26 rev = version; 27 sha256 = "172jmwp666xbs6yy1pc2495gnkz8xw11b8zkz3j19jxlvvp4mxcs"; 28 }; 29 30 postPatch = '' 31 patchShebangs src/*.py 32 patchShebangs test 33 '' + stdenv.lib.optionalString stdenv.isDarwin '' 34 # ApplicationServices.framework headers have cast-align warnings. 35 substituteInPlace src/hb.hh \ 36 --replace '#pragma GCC diagnostic error "-Wcast-align"' "" 37 ''; 38 39 outputs = [ "out" "dev" "devdoc" ]; 40 outputBin = "dev"; 41 42 mesonFlags = [ 43 (mesonFeatureFlag "graphite" withGraphite2) 44 (mesonFeatureFlag "icu" withIcu) 45 (mesonFeatureFlag "coretext" withCoreText) 46 ]; 47 48 nativeBuildInputs = [ 49 meson 50 ninja 51 gobject-introspection 52 libintl 53 pkgconfig 54 python3 55 gtk-doc 56 docbook-xsl-nons 57 docbook_xml_dtd_43 58 ]; 59 60 buildInputs = [ glib freetype cairo ] # recommended by upstream 61 ++ stdenv.lib.optionals withCoreText [ ApplicationServices CoreText ]; 62 63 propagatedBuildInputs = [] 64 ++ optional withGraphite2 graphite2 65 ++ optionals withIcu [ icu harfbuzz ]; 66 67 doCheck = true; 68 69 # Slightly hacky; some pkgs expect them in a single directory. 70 postFixup = optionalString withIcu '' 71 rm "$out"/lib/libharfbuzz.* "$dev/lib/pkgconfig/harfbuzz.pc" 72 ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.la 73 ln -s {'${harfbuzz.dev}',"$dev"}/lib/pkgconfig/harfbuzz.pc 74 ${optionalString stdenv.isDarwin '' 75 ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.dylib 76 ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.0.dylib 77 ''} 78 ''; 79 80 meta = with stdenv.lib; { 81 description = "An OpenType text shaping engine"; 82 homepage = "https://harfbuzz.github.io/"; 83 maintainers = [ maintainers.eelco ]; 84 license = licenses.mit; 85 platforms = with platforms; linux ++ darwin; 86 }; 87}