SDL: add libcaca video driver

SDL 1.2 has support for the libcaca library, which allows for rendering
to ASCII art. Games with software rendering (e.g. Chocolate Doom) can
then render to a terminal.
This commit is contained in:
Jack O'Sullivan 2024-06-05 23:34:38 +01:00
parent 437193c757
commit 0a72bce07f

View File

@ -10,6 +10,7 @@
, libICE , libICE
, libXext , libXext
, libXrandr , libXrandr
, libcaca
, libcap , libcap
, libiconv , libiconv
, libpulseaudio , libpulseaudio
@ -21,6 +22,7 @@
, openglSupport ? libGLSupported , openglSupport ? libGLSupported
, pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid && lib.meta.availableOn stdenv.hostPlatform libpulseaudio , pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid && lib.meta.availableOn stdenv.hostPlatform libpulseaudio
, x11Support ? !stdenv.hostPlatform.isCygwin && !stdenv.hostPlatform.isAndroid , x11Support ? !stdenv.hostPlatform.isCygwin && !stdenv.hostPlatform.isAndroid
, cacaSupport ? false # x11Support || stdenv.isDarwin
}: }:
# NOTE: When editing this expression see if the same change applies to # NOTE: When editing this expression see if the same change applies to
@ -58,7 +60,8 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = buildInputs =
[ ] [ ]
++ lib.optionals (!stdenv.hostPlatform.isMinGW && alsaSupport) [ audiofile ] ++ lib.optionals (!stdenv.hostPlatform.isMinGW && alsaSupport) [ audiofile ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ AudioUnit CoreAudio CoreServices Kernel OpenGL ]; ++ lib.optionals stdenv.hostPlatform.isDarwin [ AudioUnit CoreAudio CoreServices Kernel OpenGL ]
++ lib.optional cacaSupport libcaca;
configureFlags = [ configureFlags = [
"--disable-oss" "--disable-oss"
@ -73,7 +76,8 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-x11-shared" ] ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-x11-shared"
++ lib.optional (!x11Support) "--without-x" ++ lib.optional (!x11Support) "--without-x"
++ lib.optional alsaSupport "--with-alsa-prefix=${alsa-lib.out}/lib" ++ lib.optional alsaSupport "--with-alsa-prefix=${alsa-lib.out}/lib"
++ lib.optional stdenv.hostPlatform.isMusl "CFLAGS=-DICONV_INBUF_NONCONST"; ++ lib.optional stdenv.hostPlatform.isMusl "CFLAGS=-DICONV_INBUF_NONCONST"
++ lib.optional cacaSupport "--enable-video-caca";
patches = [ patches = [
./find-headers.patch ./find-headers.patch