libsixel: make linking against gd a choosable option. (#372698)

This commit is contained in:
Arne Keller
2025-01-10 18:39:55 +01:00
committed by GitHub
+26 -6
View File
@@ -7,19 +7,33 @@
gdk-pixbuf,
gd,
pkg-config,
# Enable linking against image loading libraries as part of the
# implementation of the sixel_helper_{load,write}_image_file() functions.
# These helper functions are not needed for the main functionality of the
# library to encode image buffers to sixels.
#
# libsixel already uses vendored stb image loading to provide basic
# implementations, but also allows for the "gd" library to be linked for
# a wider set of image formats.
# This pulls in a large amount of deps bloating the resulting library.
#
# Default off, but configurable in case you really need it.
withGd ? false,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "libsixel";
version = "1.10.5";
src = fetchFromGitHub {
owner = "libsixel";
repo = "libsixel";
rev = "v${version}";
rev = "v${finalAttrs.version}";
hash = "sha256-obzBZAknN3N7+Bvtd0+JHuXcemVb7wRv+Pt4VjS6Bck=";
};
buildInputs = [
buildInputs = lib.optionals withGd [
gdk-pixbuf
gd
];
@@ -34,8 +48,14 @@ stdenv.mkDerivation rec {
mesonFlags = [
"-Dtests=enabled"
# build system seems to be broken here, it still seems to handle jpeg
# through some other ways.
"-Dimg2sixel=enabled"
"-Dsixel2png=enabled"
(lib.mesonEnable "gd" withGd)
# build system seems to be broken here; error message indicates pkconfig
# issue.
# Not to worry: jpeg and png are handled by the built-in stb and/or gd lib.
"-Djpeg=disabled"
"-Dpng=disabled"
];
@@ -47,4 +67,4 @@ stdenv.mkDerivation rec {
license = licenses.mit;
platforms = platforms.unix;
};
}
})