1{ stdenv, lib, fetchFromGitea, pkg-config, meson, ninja, scdoc
2, freetype, fontconfig, pixman, tllist, check
3# Text shaping methods to enable, empty list disables all text shaping.
4# See `availableShapingTypes` or upstream meson_options.txt for available types.
5, withShapingTypes ? [ "grapheme" "run" ]
6, harfbuzz, utf8proc
7, fcft # for passthru.tests
8}:
9
10let
11 # Needs to be reflect upstream meson_options.txt
12 availableShapingTypes = [
13 "grapheme"
14 "run"
15 ];
16in
17
18stdenv.mkDerivation rec {
19 pname = "fcft";
20 version = "3.1.8";
21
22 src = fetchFromGitea {
23 domain = "codeberg.org";
24 owner = "dnkl";
25 repo = "fcft";
26 rev = version;
27 hash = "sha256-Wgm2QdW4rg573soF/8HhDmlyN4S2cA0VWOejow464gU=";
28 };
29
30 depsBuildBuild = [ pkg-config ];
31 nativeBuildInputs = [ pkg-config meson ninja scdoc ];
32 buildInputs = [ freetype fontconfig pixman tllist ]
33 ++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
34 ++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
35 nativeCheckInputs = [ check ];
36
37 mesonBuildType = "release";
38 mesonFlags = builtins.map (t:
39 lib.mesonEnable "${t}-shaping" (lib.elem t withShapingTypes)
40 ) availableShapingTypes;
41
42 doCheck = true;
43
44 outputs = [ "out" "doc" "man" ];
45
46 passthru.tests = {
47 noShaping = fcft.override { withShapingTypes = []; };
48 onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
49 };
50
51 meta = with lib; {
52 homepage = "https://codeberg.org/dnkl/fcft";
53 changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
54 description = "Simple library for font loading and glyph rasterization";
55 maintainers = with maintainers; [
56 fionera
57 sternenseemann
58 ];
59 license = with licenses; [ mit zlib ];
60 platforms = with platforms; linux;
61 };
62}