depot/third_party/nixpkgs/pkgs/development/libraries/fcft/default.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

73 lines
2.1 KiB
Nix

{ stdenv, lib, fetchFromGitea, fetchpatch, pkg-config, meson, ninja, scdoc
, freetype, fontconfig, nanosvg, pixman, tllist, check
# 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
}:
let
# Needs to be reflect upstream meson_options.txt
availableShapingTypes = [
"grapheme"
"run"
];
in
stdenv.mkDerivation rec {
pname = "fcft";
version = "3.1.8";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "dnkl";
repo = "fcft";
rev = version;
hash = "sha256-Wgm2QdW4rg573soF/8HhDmlyN4S2cA0VWOejow464gU=";
};
patches = [
(fetchpatch {
name = "system-nanosvg.patch";
url = "https://codeberg.org/dnkl/fcft/commit/5cee776e1d7f1bdb0df383c3dd798831a6fe4fa0.patch";
excludes = [ "CHANGELOG.md" ];
hash = "sha256-yRBtKCKT/Oih66/OQqt4GPg3GfHmhiLM8mlLEWYYRC0=";
})
];
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [ pkg-config meson ninja scdoc ];
buildInputs = [ freetype fontconfig nanosvg pixman tllist ]
++ lib.optionals (withShapingTypes != []) [ harfbuzz ]
++ lib.optionals (builtins.elem "run" withShapingTypes) [ utf8proc ];
nativeCheckInputs = [ check ];
mesonBuildType = "release";
mesonFlags = [
(lib.mesonEnable "system-nanosvg" true)
] ++ builtins.map (t:
lib.mesonEnable "${t}-shaping" (lib.elem t withShapingTypes)
) availableShapingTypes;
doCheck = true;
outputs = [ "out" "doc" "man" ];
passthru.tests = {
noShaping = fcft.override { withShapingTypes = []; };
onlyGraphemeShaping = fcft.override { withShapingTypes = [ "grapheme" ]; };
};
meta = with lib; {
homepage = "https://codeberg.org/dnkl/fcft";
changelog = "https://codeberg.org/dnkl/fcft/releases/tag/${version}";
description = "Simple library for font loading and glyph rasterization";
maintainers = with maintainers; [
fionera
sternenseemann
];
license = with licenses; [ mit zlib ];
platforms = with platforms; linux;
};
}