nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 ];
16
17 # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54
18 mesonFeatureFlag = opt: b: "-D${opt}=${if b then "enabled" else "disabled"}";
19in
20
21stdenv.mkDerivation rec {
22 pname = "fcft";
23 version = "3.1.2";
24
25 src = fetchFromGitea {
26 domain = "codeberg.org";
27 owner = "dnkl";
28 repo = "fcft";
29 rev = version;
30 sha256 = "1m7prc792dsd4mg6iqqwbfbmvs3a2yw2zmj0cd3qrf7h672b8snq";
31 };
32
33 depsBuildBuild = [ pkg-config ];
34 nativeBuildInputs = [ pkg-config meson ninja scdoc ];
35 buildInputs = [ freetype fontconfig pixman tllist ]
36 ++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
37 ++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
38 checkInputs = [ check ];
39
40 mesonBuildType = "release";
41 mesonFlags = builtins.map (t:
42 mesonFeatureFlag "${t}-shaping" (lib.elem t withShapingTypes)
43 ) availableShapingTypes;
44
45 doCheck = true;
46
47 outputs = [ "out" "doc" "man" ];
48
49 passthru.tests = {
50 noShaping = fcft.override { withShapingTypes = []; };
51 onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
52 };
53
54 meta = with lib; {
55 homepage = "https://codeberg.org/dnkl/fcft";
56 changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
57 description = "Simple library for font loading and glyph rasterization";
58 maintainers = with maintainers; [
59 fionera
60 sternenseemann
61 ];
62 license = licenses.mit;
63 platforms = with platforms; linux;
64 };
65}