2021-01-21 18:00:13 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, glib, freetype, cairo, libintl
|
2020-08-23 19:56:44 +02:00
|
|
|
, meson, ninja
|
2020-07-25 07:36:50 +02:00
|
|
|
, gobject-introspection
|
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
|
2020-08-23 19:56:44 +02:00
|
|
|
, python3
|
|
|
|
, gtk-doc, docbook-xsl-nons, docbook_xml_dtd_43
|
2013-11-24 13:51:12 +01:00
|
|
|
}:
|
|
|
|
|
2015-10-05 19:26:54 +02:00
|
|
|
let
|
2021-03-18 08:37:04 +01:00
|
|
|
version = "2.8.0";
|
2021-01-21 18:00:13 +01:00
|
|
|
inherit (lib) optional optionals optionalString;
|
2020-08-23 19:56:44 +02:00
|
|
|
mesonFeatureFlag = opt: b:
|
|
|
|
"-D${opt}=${if b then "enabled" else "disabled"}";
|
2015-10-05 19:26:54 +02:00
|
|
|
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
|
|
|
|
2020-08-23 19:56:44 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "harfbuzz";
|
|
|
|
repo = "harfbuzz";
|
|
|
|
rev = version;
|
2021-03-18 08:37:04 +01:00
|
|
|
sha256 = "sha256-JnvOFGK2HWIpzuwgZtyt0IfKfnoXD1LMeVb3RzMmyY4=";
|
2012-09-27 23:23:36 +02:00
|
|
|
};
|
|
|
|
|
2018-08-08 20:35:37 +02:00
|
|
|
postPatch = ''
|
2020-08-23 19:56:44 +02:00
|
|
|
patchShebangs src/*.py
|
2018-08-08 20:35:37 +02:00
|
|
|
patchShebangs test
|
2021-01-21 18:00:13 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2019-02-24 05:26:54 +01:00
|
|
|
# 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
|
|
|
'';
|
|
|
|
|
2020-08-23 19:56:44 +02:00
|
|
|
outputs = [ "out" "dev" "devdoc" ];
|
2015-10-05 19:26:54 +02:00
|
|
|
outputBin = "dev";
|
2015-07-26 13:43:49 +02:00
|
|
|
|
2020-08-23 19:56:44 +02:00
|
|
|
mesonFlags = [
|
|
|
|
(mesonFeatureFlag "graphite" withGraphite2)
|
|
|
|
(mesonFeatureFlag "icu" withIcu)
|
|
|
|
(mesonFeatureFlag "coretext" withCoreText)
|
|
|
|
];
|
2013-11-24 13:51:12 +01:00
|
|
|
|
2020-07-25 07:36:50 +02:00
|
|
|
nativeBuildInputs = [
|
2020-08-23 19:56:44 +02:00
|
|
|
meson
|
|
|
|
ninja
|
2020-07-25 07:36:50 +02:00
|
|
|
gobject-introspection
|
|
|
|
libintl
|
2021-01-19 07:50:56 +01:00
|
|
|
pkg-config
|
2020-08-23 19:56:44 +02:00
|
|
|
python3
|
|
|
|
gtk-doc
|
|
|
|
docbook-xsl-nons
|
|
|
|
docbook_xml_dtd_43
|
2020-07-25 07:36:50 +02:00
|
|
|
];
|
2018-04-25 20:30:22 +02:00
|
|
|
|
|
|
|
buildInputs = [ glib freetype cairo ] # recommended by upstream
|
2021-01-21 18:00:13 +01:00
|
|
|
++ lib.optionals withCoreText [ ApplicationServices CoreText ];
|
2018-04-25 20:30:22 +02:00
|
|
|
|
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 ];
|
|
|
|
|
2020-08-23 19:56:44 +02:00
|
|
|
doCheck = true;
|
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.
|
2020-08-23 19:56:44 +02:00
|
|
|
postFixup = optionalString withIcu ''
|
2015-10-05 19:26:54 +02:00
|
|
|
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
|
|
|
'';
|
|
|
|
|
2021-01-21 18:00:13 +01:00
|
|
|
meta = with lib; {
|
2012-09-27 23:23:36 +02:00
|
|
|
description = "An OpenType text shaping engine";
|
2020-08-23 19:56:44 +02:00
|
|
|
homepage = "https://harfbuzz.github.io/";
|
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;
|
2012-09-27 23:23:36 +02:00
|
|
|
};
|
|
|
|
}
|