2021-08-08 23:34:03 +00:00
|
|
|
{ stdenv, lib, fetchFromGitea, pkg-config, meson, ninja, scdoc
|
2021-02-05 17:12:51 +00:00
|
|
|
, freetype, fontconfig, pixman, tllist, check
|
2021-12-06 16:07:01 +00:00
|
|
|
# Text shaping methods to enable, empty list disables all text shaping.
|
|
|
|
# See `availableShapingTypes` or upstream meson_options.txt for available types.
|
|
|
|
, withShapingTypes ? [ "grapheme" "run" ]
|
|
|
|
, harfbuzz, utf8proc
|
|
|
|
, fcft # for passthru.tests
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
let
|
2021-12-06 16:07:01 +00:00
|
|
|
# Needs to be reflect upstream meson_options.txt
|
|
|
|
availableShapingTypes = [
|
|
|
|
"grapheme"
|
|
|
|
"run"
|
|
|
|
];
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
# Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54
|
|
|
|
mesonFeatureFlag = opt: b: "-D${opt}=${if b then "enabled" else "disabled"}";
|
|
|
|
in
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fcft";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "3.1.2";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "codeberg.org";
|
|
|
|
owner = "dnkl";
|
|
|
|
repo = "fcft";
|
|
|
|
rev = version;
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "1m7prc792dsd4mg6iqqwbfbmvs3a2yw2zmj0cd3qrf7h672b8snq";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
depsBuildBuild = [ pkg-config ];
|
2020-08-20 17:08:02 +00:00
|
|
|
nativeBuildInputs = [ pkg-config meson ninja scdoc ];
|
2021-02-05 17:12:51 +00:00
|
|
|
buildInputs = [ freetype fontconfig pixman tllist ]
|
2021-12-06 16:07:01 +00:00
|
|
|
++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
|
|
|
|
++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
|
2020-09-25 04:45:31 +00:00
|
|
|
checkInputs = [ check ];
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
mesonBuildType = "release";
|
2021-12-06 16:07:01 +00:00
|
|
|
mesonFlags = builtins.map (t:
|
|
|
|
mesonFeatureFlag "${t}-shaping" (lib.elem t withShapingTypes)
|
|
|
|
) availableShapingTypes;
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
passthru.tests = {
|
|
|
|
noShaping = fcft.override { withShapingTypes = []; };
|
|
|
|
onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
|
|
|
|
};
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://codeberg.org/dnkl/fcft";
|
2021-08-08 23:34:03 +00:00
|
|
|
changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "Simple library for font loading and glyph rasterization";
|
2021-04-15 00:37:46 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
fionera
|
|
|
|
sternenseemann
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = with platforms; linux;
|
|
|
|
};
|
|
|
|
}
|