btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / fc / fcft / package.nix
blob2a36329b386fa8175995ef2c3bfd56f1e3db1f4d
1 { stdenv, lib, fetchFromGitea, fetchpatch, pkg-config, meson, ninja, scdoc
2 , freetype, fontconfig, nanosvg, 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 }:
10 let
11   # Needs to be reflect upstream meson_options.txt
12   availableShapingTypes = [
13     "grapheme"
14     "run"
15   ];
18 stdenv.mkDerivation rec {
19   pname = "fcft";
20   version = "3.1.9";
22   src = fetchFromGitea {
23     domain = "codeberg.org";
24     owner = "dnkl";
25     repo = "fcft";
26     rev = version;
27     hash = "sha256-D4W62IHuM7ofEeU/3sp038tv2a1+xQd0mdSKXaY7Ikg=";
28   };
30   depsBuildBuild = [ pkg-config ];
31   nativeBuildInputs = [ pkg-config meson ninja scdoc ];
32   buildInputs = [ freetype fontconfig nanosvg pixman tllist ]
33     ++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
34     ++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
35   nativeCheckInputs = [ check ];
37   mesonBuildType = "release";
38   mesonFlags = [
39     (lib.mesonEnable "system-nanosvg" true)
40   ] ++ builtins.map (t:
41     lib.mesonEnable "${t}-shaping" (lib.elem t withShapingTypes)
42   ) availableShapingTypes;
44   doCheck = true;
46   outputs = [ "out" "doc" "man" ];
48   passthru.tests = {
49     noShaping = fcft.override { withShapingTypes = []; };
50     onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
51   };
53   meta = with lib; {
54     homepage = "https://codeberg.org/dnkl/fcft";
55     changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
56     description = "Simple library for font loading and glyph rasterization";
57     maintainers = with maintainers; [
58       fionera
59       sternenseemann
60     ];
61     license = with licenses; [ mit zlib ];
62     platforms = with platforms; linux;
63   };