fuzzel: refactor configure options
The current configure options exposed emulates the `choices` type of the SVG and PNG backends from upstream meson_options with a freeform string, however this is error prone and require accompanying validation which unnecessarily complicates the derivation. Two alternatives were considered: 1. Splits the possible choices into separate options nad perform assertions to ensure only one is selected. 2. Expose a set of sane default configure options, and structure the derivation around this subset. Users who wish to customize the choice used can do so using `override` or `overrideAttrs`. Option 1 is not sustainable for large amounts of options which require large amount of assertions just for ensuring uniqueness of selection, and adds complexity to the configure phase. Option 2 minimally impairs the customizablity of the derivation and was chosen in part to address option checking[1]. [1] - https://github.com/NixOS/nixpkgs/pull/141836#discussion_r739910095
This commit is contained in:
parent
36f77596b1
commit
a983d4e779
@ -13,14 +13,16 @@
|
||||
, tllist
|
||||
, fcft
|
||||
, enableCairo ? true
|
||||
, withPNGBackend ? "libpng"
|
||||
, withSVGBackend ? "librsvg"
|
||||
# Optional dependencies
|
||||
, svgSupport ? true
|
||||
, pngSupport ? true
|
||||
# Optional dependencies
|
||||
, cairo
|
||||
, librsvg
|
||||
, libpng
|
||||
}:
|
||||
|
||||
assert svgSupport -> enableCairo;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "fuzzel";
|
||||
version = "1.7.0";
|
||||
@ -49,15 +51,15 @@ stdenv.mkDerivation rec {
|
||||
tllist
|
||||
fcft
|
||||
] ++ lib.optional enableCairo cairo
|
||||
++ lib.optional (withPNGBackend == "libpng") libpng
|
||||
++ lib.optional (withSVGBackend == "librsvg") librsvg;
|
||||
++ lib.optional pngSupport libpng
|
||||
++ lib.optional svgSupport librsvg;
|
||||
|
||||
mesonBuildType = "release";
|
||||
|
||||
mesonFlags = [
|
||||
"-Denable-cairo=${if enableCairo then "enabled" else "disabled"}"
|
||||
"-Dpng-backend=${withPNGBackend}"
|
||||
"-Dsvg-backend=${withSVGBackend}"
|
||||
"-Dpng-backend=${if pngSupport then "libpng" else "none"}"
|
||||
"-Dsvg-backend=${if svgSupport then "librsvg" else "none"}"
|
||||
];
|
||||
|
||||
CFLAGS = "-Wno-error=comment"; # https://gitlab.gnome.org/GNOME/librsvg/-/issues/856
|
||||
|
Loading…
Reference in New Issue
Block a user