sdl{2-compat,3}: clean up dependencies (#414472)
This commit is contained in:
@@ -21,7 +21,11 @@
|
||||
ffmpeg,
|
||||
qemu,
|
||||
}:
|
||||
|
||||
let
|
||||
# tray support on sdl3 pulls in gtk3, which is quite an expensive dependency.
|
||||
# sdl2 does not support the tray, so we can just disable that requirement.
|
||||
sdl3' = sdl3.override { traySupport = false; };
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "sdl2-compat";
|
||||
version = "2.32.56";
|
||||
@@ -39,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
sdl3
|
||||
sdl3'
|
||||
libX11
|
||||
];
|
||||
|
||||
@@ -57,7 +61,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "SDL2COMPAT_TESTS" finalAttrs.finalPackage.doCheck)
|
||||
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" (lib.makeLibraryPath [ sdl3 ]))
|
||||
(lib.cmakeFeature "CMAKE_INSTALL_RPATH" (lib.makeLibraryPath [ sdl3' ]))
|
||||
];
|
||||
|
||||
# skip timing-based tests as those are flaky
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
libudevSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
|
||||
sndioSupport ? false,
|
||||
testSupport ? true,
|
||||
traySupport ? true,
|
||||
waylandSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid,
|
||||
x11Support ? !stdenv.hostPlatform.isAndroid && !stdenv.hostPlatform.isWindows,
|
||||
}:
|
||||
@@ -58,16 +59,21 @@
|
||||
assert lib.assertMsg (
|
||||
waylandSupport -> openglSupport
|
||||
) "SDL3 requires OpenGL support to enable Wayland";
|
||||
assert lib.assertMsg (ibusSupport -> dbusSupport) "SDL3 requires dbus support to enable ibus";
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "sdl3";
|
||||
version = "3.2.16";
|
||||
|
||||
outputs = [
|
||||
"lib"
|
||||
"dev"
|
||||
"out"
|
||||
];
|
||||
outputs =
|
||||
[
|
||||
"lib"
|
||||
"dev"
|
||||
"out"
|
||||
]
|
||||
++ lib.optionals testSupport [
|
||||
"installedTests"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "libsdl-org";
|
||||
@@ -78,13 +84,19 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
postPatch =
|
||||
# Tests timeout on Darwin
|
||||
# `testtray` loads assets from a relative path, which we are patching to be absolute
|
||||
lib.optionalString testSupport ''
|
||||
substituteInPlace test/CMakeLists.txt \
|
||||
--replace-fail 'set(noninteractive_timeout 10)' 'set(noninteractive_timeout 30)'
|
||||
|
||||
substituteInPlace test/testtray.c \
|
||||
--replace-warn '../test/' '${placeholder "installedTests"}/share/assets/'
|
||||
''
|
||||
+ lib.optionalString waylandSupport ''
|
||||
substituteInPlace src/video/wayland/SDL_waylandmessagebox.c \
|
||||
--replace-fail '"zenity"' '"${lib.getExe zenity}"'
|
||||
substituteInPlace src/dialog/unix/SDL_zenitydialog.c \
|
||||
--replace-fail '"zenity"' '"${lib.getExe zenity}"'
|
||||
'';
|
||||
|
||||
strictDeps = true;
|
||||
@@ -117,7 +129,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
libusb1
|
||||
]
|
||||
++ lib.optional (
|
||||
stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin
|
||||
stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin && traySupport
|
||||
) libayatana-appindicator
|
||||
++ lib.optional alsaSupport alsa-lib
|
||||
++ lib.optional dbusSupport dbus
|
||||
@@ -164,11 +176,13 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
(lib.cmakeBool "SDL_PULSEAUDIO" pulseaudioSupport)
|
||||
(lib.cmakeBool "SDL_SNDIO" sndioSupport)
|
||||
(lib.cmakeBool "SDL_TEST_LIBRARY" testSupport)
|
||||
(lib.cmakeBool "SDL_TRAY_DUMMY" (!traySupport))
|
||||
(lib.cmakeBool "SDL_WAYLAND" waylandSupport)
|
||||
(lib.cmakeBool "SDL_WAYLAND_LIBDECOR" libdecorSupport)
|
||||
(lib.cmakeBool "SDL_X11" x11Support)
|
||||
|
||||
(lib.cmakeBool "SDL_TESTS" finalAttrs.finalPackage.doCheck)
|
||||
(lib.cmakeBool "SDL_INSTALL_TESTS" testSupport)
|
||||
];
|
||||
|
||||
doCheck = testSupport && stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
||||
@@ -184,6 +198,12 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
) "-rpath ${lib.makeLibraryPath (finalAttrs.dlopenBuildInputs)}";
|
||||
};
|
||||
|
||||
postInstall = lib.optionalString testSupport ''
|
||||
moveToOutput "share/installed-tests" "$installedTests"
|
||||
moveToOutput "libexec/installed-tests" "$installedTests"
|
||||
install -Dm 444 -t $installedTests/share/assets test/*.bmp
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
# Building this in its own derivation to make sure the rpath hack above propagate to users
|
||||
debug-text-example = stdenv.mkDerivation (finalAttrs': {
|
||||
|
||||
Reference in New Issue
Block a user