2018-03-14 20:15:06 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, glib, freetype, cairo, libintl
|
2015-10-05 19:26:54 +02:00
|
|
|
, icu, graphite2, harfbuzz # The icu variant uses and propagates the non-icu one.
|
2018-04-25 20:30:22 +02:00
|
|
|
, ApplicationServices, CoreText
|
|
|
|
, withCoreText ? false
|
2013-11-24 13:51:12 +01:00
|
|
|
, withIcu ? false # recommended by upstream as default, but most don't needed and it's big
|
2014-06-01 07:51:16 +02:00
|
|
|
, withGraphite2 ? true # it is small and major distros do include it
|
2018-08-08 20:35:37 +02:00
|
|
|
, python
|
2013-11-24 13:51:12 +01:00
|
|
|
}:
|
|
|
|
|
2015-10-05 19:26:54 +02:00
|
|
|
let
|
2020-06-10 03:12:06 +02:00
|
|
|
version = "2.6.7";
|
2015-10-05 19:26:54 +02:00
|
|
|
inherit (stdenv.lib) optional optionals optionalString;
|
|
|
|
in
|
2012-09-27 23:23:36 +02:00
|
|
|
|
2015-10-05 19:26:54 +02:00
|
|
|
stdenv.mkDerivation {
|
2015-11-20 14:32:58 +01:00
|
|
|
name = "harfbuzz${optionalString withIcu "-icu"}-${version}";
|
2012-09-27 23:23:36 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-05-29 03:15:07 +02:00
|
|
|
url = "https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-${version}.tar.xz";
|
2020-06-10 03:12:06 +02:00
|
|
|
sha256 = "065jg6s8xix45s4msj0l2r0iycw5yyyjdylripv7pyfzdk883r29";
|
2012-09-27 23:23:36 +02:00
|
|
|
};
|
|
|
|
|
2018-08-08 20:35:37 +02:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs src/gen-def.py
|
|
|
|
patchShebangs test
|
2019-02-24 05:26:54 +01:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
# ApplicationServices.framework headers have cast-align warnings.
|
|
|
|
substituteInPlace src/hb.hh \
|
|
|
|
--replace '#pragma GCC diagnostic error "-Wcast-align"' ""
|
2018-08-08 20:35:37 +02:00
|
|
|
'';
|
|
|
|
|
2016-08-29 02:30:01 +02:00
|
|
|
outputs = [ "out" "dev" ];
|
2015-10-05 19:26:54 +02:00
|
|
|
outputBin = "dev";
|
2015-07-26 13:43:49 +02:00
|
|
|
|
2013-11-24 13:51:12 +01:00
|
|
|
configureFlags = [
|
2018-04-25 20:30:22 +02:00
|
|
|
# not auto-detected by default
|
|
|
|
"--with-graphite2=${if withGraphite2 then "yes" else "no"}"
|
|
|
|
"--with-icu=${if withIcu then "yes" else "no"}"
|
2018-04-25 21:35:28 +02:00
|
|
|
]
|
|
|
|
++ stdenv.lib.optional withCoreText "--with-coretext=yes";
|
2013-11-24 13:51:12 +01:00
|
|
|
|
2018-03-14 20:15:06 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig libintl ];
|
2018-04-25 20:30:22 +02:00
|
|
|
|
|
|
|
buildInputs = [ glib freetype cairo ] # recommended by upstream
|
|
|
|
++ stdenv.lib.optionals withCoreText [ ApplicationServices CoreText ];
|
|
|
|
|
2013-10-14 08:36:39 +02:00
|
|
|
propagatedBuildInputs = []
|
2015-10-05 19:26:54 +02:00
|
|
|
++ optional withGraphite2 graphite2
|
2018-08-08 20:35:37 +02:00
|
|
|
++ optionals withIcu [ icu harfbuzz ];
|
|
|
|
|
|
|
|
checkInputs = [ python ];
|
|
|
|
doInstallCheck = false; # fails, probably a bug
|
2012-09-27 23:23:36 +02:00
|
|
|
|
2015-10-05 19:26:54 +02:00
|
|
|
# Slightly hacky; some pkgs expect them in a single directory.
|
|
|
|
postInstall = optionalString withIcu ''
|
|
|
|
rm "$out"/lib/libharfbuzz.* "$dev/lib/pkgconfig/harfbuzz.pc"
|
|
|
|
ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.la
|
|
|
|
ln -s {'${harfbuzz.dev}',"$dev"}/lib/pkgconfig/harfbuzz.pc
|
2016-07-23 07:56:08 +02:00
|
|
|
${optionalString stdenv.isDarwin ''
|
|
|
|
ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.dylib
|
|
|
|
ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.0.dylib
|
|
|
|
''}
|
2015-10-05 19:26:54 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2012-09-27 23:23:36 +02:00
|
|
|
description = "An OpenType text shaping engine";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.freedesktop.org/wiki/Software/HarfBuzz";
|
2016-09-26 15:45:48 +02:00
|
|
|
downloadPage = "https://www.freedesktop.org/software/harfbuzz/release/";
|
2015-10-05 19:26:54 +02:00
|
|
|
maintainers = [ maintainers.eelco ];
|
2018-10-10 03:27:05 +02:00
|
|
|
license = licenses.mit;
|
2015-10-05 19:26:54 +02:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2016-09-26 15:45:48 +02:00
|
|
|
inherit version;
|
|
|
|
updateWalker = true;
|
2012-09-27 23:23:36 +02:00
|
|
|
};
|
|
|
|
}
|