2021-05-25 19:00:17 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-10-02 09:14:56 +00:00
|
|
|
, fetchurl
|
2021-05-25 19:00:17 +00:00
|
|
|
, pkg-config
|
|
|
|
, glib
|
|
|
|
, freetype
|
2021-06-12 10:44:12 +00:00
|
|
|
, fontconfig
|
2021-05-25 19:00:17 +00:00
|
|
|
, libintl
|
|
|
|
, meson
|
|
|
|
, ninja
|
2020-07-25 05:36:50 +00:00
|
|
|
, gobject-introspection
|
2021-05-25 19:00:17 +00:00
|
|
|
, icu
|
|
|
|
, graphite2
|
|
|
|
, harfbuzz # The icu variant uses and propagates the non-icu one.
|
|
|
|
, ApplicationServices
|
|
|
|
, CoreText
|
2018-04-25 18:30:22 +00:00
|
|
|
, withCoreText ? false
|
2013-11-24 12:51:12 +00:00
|
|
|
, withIcu ? false # recommended by upstream as default, but most don't needed and it's big
|
2014-06-01 05:51:16 +00:00
|
|
|
, withGraphite2 ? true # it is small and major distros do include it
|
2020-08-23 17:56:44 +00:00
|
|
|
, python3
|
2021-05-25 19:00:17 +00:00
|
|
|
, gtk-doc
|
|
|
|
, docbook-xsl-nons
|
|
|
|
, docbook_xml_dtd_43
|
2022-02-14 21:57:34 +00:00
|
|
|
# for passthru.tests
|
|
|
|
, gimp
|
|
|
|
, gtk3
|
|
|
|
, gtk4
|
|
|
|
, mapnik
|
|
|
|
, qt5
|
2013-11-24 12:51:12 +00:00
|
|
|
}:
|
|
|
|
|
2015-10-05 17:26:54 +00:00
|
|
|
let
|
2022-10-02 09:07:11 +00:00
|
|
|
version = "5.2.0";
|
2021-01-21 17:00:13 +00:00
|
|
|
inherit (lib) optional optionals optionalString;
|
2022-11-13 23:03:19 +00:00
|
|
|
mesonFeatureFlag = feature: flag:
|
|
|
|
"-D${feature}=${if flag then "enabled" else "disabled"}";
|
2015-10-05 17:26:54 +00:00
|
|
|
in
|
2012-09-27 21:23:36 +00:00
|
|
|
|
2015-10-05 17:26:54 +00:00
|
|
|
stdenv.mkDerivation {
|
2021-08-24 21:35:35 +00:00
|
|
|
pname = "harfbuzz${optionalString withIcu "-icu"}";
|
|
|
|
inherit version;
|
2012-09-27 21:23:36 +00:00
|
|
|
|
2022-10-02 09:14:56 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/harfbuzz/harfbuzz/releases/download/${version}/harfbuzz-${version}.tar.xz";
|
|
|
|
sha256 = "0b4lpkidwx0lf8slczjji652yll6g5zgmm5lmisnb4s7gf8r8nkk";
|
2012-09-27 21:23:36 +00:00
|
|
|
};
|
|
|
|
|
2018-08-08 18:35:37 +00:00
|
|
|
postPatch = ''
|
2021-08-24 21:35:35 +00:00
|
|
|
patchShebangs src/*.py test
|
2021-01-21 17:00:13 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2019-02-24 04:26:54 +00:00
|
|
|
# ApplicationServices.framework headers have cast-align warnings.
|
|
|
|
substituteInPlace src/hb.hh \
|
|
|
|
--replace '#pragma GCC diagnostic error "-Wcast-align"' ""
|
2018-08-08 18:35:37 +00:00
|
|
|
'';
|
|
|
|
|
2020-08-23 17:56:44 +00:00
|
|
|
outputs = [ "out" "dev" "devdoc" ];
|
2015-10-05 17:26:54 +00:00
|
|
|
outputBin = "dev";
|
2015-07-26 11:43:49 +00:00
|
|
|
|
2020-08-23 17:56:44 +00:00
|
|
|
mesonFlags = [
|
2021-06-12 10:44:12 +00:00
|
|
|
# upstream recommends cairo, but it is only used for development purposes
|
|
|
|
# and is not part of the library.
|
|
|
|
# Cairo causes transitive (build) dependencies on various X11 or other
|
|
|
|
# GUI-related libraries, so it shouldn't be re-added lightly.
|
|
|
|
(mesonFeatureFlag "cairo" false)
|
2021-06-12 20:18:35 +00:00
|
|
|
# chafa is only used in a development utility, not in the library
|
|
|
|
(mesonFeatureFlag "chafa" false)
|
2021-06-12 20:20:51 +00:00
|
|
|
(mesonFeatureFlag "coretext" withCoreText)
|
|
|
|
(mesonFeatureFlag "graphite" withGraphite2)
|
|
|
|
(mesonFeatureFlag "icu" withIcu)
|
2022-07-07 18:34:37 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
2020-08-23 17:56:44 +00:00
|
|
|
];
|
2013-11-24 12:51:12 +00:00
|
|
|
|
2020-07-25 05:36:50 +00:00
|
|
|
nativeBuildInputs = [
|
2020-08-23 17:56:44 +00:00
|
|
|
meson
|
|
|
|
ninja
|
2020-07-25 05:36:50 +00:00
|
|
|
gobject-introspection
|
|
|
|
libintl
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2020-08-23 17:56:44 +00:00
|
|
|
python3
|
|
|
|
gtk-doc
|
|
|
|
docbook-xsl-nons
|
|
|
|
docbook_xml_dtd_43
|
2020-07-25 05:36:50 +00:00
|
|
|
];
|
2018-04-25 18:30:22 +00:00
|
|
|
|
2022-07-12 12:17:11 +00:00
|
|
|
buildInputs = [ glib freetype gobject-introspection ]
|
2022-07-07 18:34:37 +00:00
|
|
|
++ lib.optionals withCoreText [ ApplicationServices CoreText ];
|
2018-04-25 18:30:22 +00:00
|
|
|
|
2021-05-25 19:13:38 +00:00
|
|
|
propagatedBuildInputs = optional withGraphite2 graphite2
|
2018-08-08 18:35:37 +00:00
|
|
|
++ optionals withIcu [ icu harfbuzz ];
|
|
|
|
|
2020-08-23 17:56:44 +00:00
|
|
|
doCheck = true;
|
2012-09-27 21:23:36 +00:00
|
|
|
|
2015-10-05 17:26:54 +00:00
|
|
|
# Slightly hacky; some pkgs expect them in a single directory.
|
2020-08-23 17:56:44 +00:00
|
|
|
postFixup = optionalString withIcu ''
|
2015-10-05 17:26:54 +00: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 05:56:08 +00:00
|
|
|
${optionalString stdenv.isDarwin ''
|
|
|
|
ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.dylib
|
|
|
|
ln -s {'${harfbuzz.out}',"$out"}/lib/libharfbuzz.0.dylib
|
|
|
|
''}
|
2015-10-05 17:26:54 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-14 21:57:34 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit gimp gtk3 gtk4 mapnik;
|
|
|
|
inherit (qt5) qtbase;
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2012-09-27 21:23:36 +00:00
|
|
|
description = "An OpenType text shaping engine";
|
2020-08-23 17:56:44 +00:00
|
|
|
homepage = "https://harfbuzz.github.io/";
|
2015-10-05 17:26:54 +00:00
|
|
|
maintainers = [ maintainers.eelco ];
|
2018-10-10 01:27:05 +00:00
|
|
|
license = licenses.mit;
|
2015-10-05 17:26:54 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2012-09-27 21:23:36 +00:00
|
|
|
};
|
|
|
|
}
|