From 67081ee1ba2492f5d985d221e6ed81380ecd1a03 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Tue, 20 May 2025 11:36:32 +0200 Subject: [PATCH] SDL2_classic: drop --- .../sd/SDL2_classic/find-headers.patch | 32 --- pkgs/by-name/sd/SDL2_classic/package.nix | 223 ------------------ pkgs/by-name/sd/SDL2_classic/setup-hook.sh | 7 - pkgs/top-level/aliases.nix | 1 + 4 files changed, 1 insertion(+), 262 deletions(-) delete mode 100644 pkgs/by-name/sd/SDL2_classic/find-headers.patch delete mode 100644 pkgs/by-name/sd/SDL2_classic/package.nix delete mode 100644 pkgs/by-name/sd/SDL2_classic/setup-hook.sh diff --git a/pkgs/by-name/sd/SDL2_classic/find-headers.patch b/pkgs/by-name/sd/SDL2_classic/find-headers.patch deleted file mode 100644 index 8739da91eac1..000000000000 --- a/pkgs/by-name/sd/SDL2_classic/find-headers.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in -index db864aab9..b94e16043 100644 ---- a/sdl2-config.cmake.in -+++ b/sdl2-config.cmake.in -@@ -26,7 +26,9 @@ set_and_check(SDL2_EXEC_PREFIX "${exec_prefix}") - set_and_check(SDL2_BINDIR "${bindir}") - set_and_check(SDL2_INCLUDE_DIR "${includedir}/SDL2") - set_and_check(SDL2_LIBDIR "${libdir}") --set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}") -+ -+set(SDL2_INCLUDE_DIRS "${includedir};${SDL2_INCLUDE_DIR}" $ENV{SDL2_PATH}) -+separate_arguments(SDL2_INCLUDE_DIRS) - - set(SDL2_LIBRARIES SDL2::SDL2) - set(SDL2_STATIC_LIBRARIES SDL2::SDL2-static) -diff --git a/sdl2-config.in b/sdl2-config.in -index f6eca7668..c0cd94590 100644 ---- a/sdl2-config.in -+++ b/sdl2-config.in -@@ -46,7 +46,11 @@ while test $# -gt 0; do - echo @SDL_VERSION@ - ;; - --cflags) -- echo -I@includedir@/SDL2 @SDL_CFLAGS@ -+ SDL_CFLAGS="" -+ for i in @includedir@/SDL2 $SDL2_PATH; do -+ SDL_CFLAGS="$SDL_CFLAGS -I$i" -+ done -+ echo $SDL_CFLAGS @SDL_CFLAGS@ - ;; - @ENABLE_SHARED_TRUE@ --libs) - @ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ diff --git a/pkgs/by-name/sd/SDL2_classic/package.nix b/pkgs/by-name/sd/SDL2_classic/package.nix deleted file mode 100644 index 2c88c50914d9..000000000000 --- a/pkgs/by-name/sd/SDL2_classic/package.nix +++ /dev/null @@ -1,223 +0,0 @@ -{ - lib, - stdenv, - config, - fetchFromGitHub, - nix-update-script, - pkg-config, - mesa, - libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms, - openglSupport ? libGLSupported, - libGL, - alsaSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - alsa-lib, - x11Support ? !stdenv.hostPlatform.isWindows && !stdenv.hostPlatform.isAndroid, - libX11, - xorgproto, - libICE, - libXi, - libXScrnSaver, - libXcursor, - libXinerama, - libXext, - libXxf86vm, - libXrandr, - waylandSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - wayland, - wayland-protocols, - wayland-scanner, - drmSupport ? false, - libdrm, - libgbm, - libxkbcommon, - dbusSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - dbus, - udevSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - udev, - ibusSupport ? false, - ibus, - libdecorSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - libdecor, - pipewireSupport ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - pipewire, # NOTE: must be built with SDL2 without pipewire support - pulseaudioSupport ? - config.pulseaudio or stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAndroid, - libpulseaudio, - audiofile, - libiconv, - withStatic ? stdenv.hostPlatform.isMinGW, - # passthru.tests - testers, -}: - -# NOTE: When editing this expression see if the same change applies to -# SDL expression too - -stdenv.mkDerivation (finalAttrs: { - pname = "SDL2"; - version = "2.32.6"; - - src = fetchFromGitHub { - owner = "libsdl-org"; - repo = "SDL"; - rev = "release-${finalAttrs.version}"; - hash = "sha256-sXlW+ivDRCNMcZDzZEfOPGvFGU0aE4n/fO+Wxym6GGw="; - }; - dontDisableStatic = if withStatic then 1 else 0; - outputs = [ - "out" - "dev" - ]; - outputBin = "dev"; # sdl-config - - patches = [ - # `sdl2-config --cflags` from Nixpkgs returns include path to just SDL2. - # On a normal distro this is enough for includes from all SDL2* packages to work, - # but on NixOS they're spread across different paths. - # This patch + the setup-hook will ensure that `sdl2-config --cflags` works correctly. - ./find-headers.patch - ]; - - postPatch = '' - # Fix running wayland-scanner for the build platform when cross-compiling. - # See comment here: https://github.com/libsdl-org/SDL/issues/4860#issuecomment-1119003545 - substituteInPlace configure \ - --replace '$(WAYLAND_SCANNER)' 'wayland-scanner' - ''; - - strictDeps = true; - - depsBuildBuild = [ pkg-config ]; - - nativeBuildInputs = - [ pkg-config ] - ++ lib.optionals waylandSupport [ - wayland - wayland-scanner - ]; - - dlopenPropagatedBuildInputs = - [ ] - # Propagated for #include in SDL_opengles.h. - ++ lib.optional (openglSupport && !stdenv.hostPlatform.isDarwin) libGL - # Propagated for #include and in SDL_syswm.h. - ++ lib.optionals x11Support [ libX11 ]; - - propagatedBuildInputs = - lib.optionals x11Support [ xorgproto ] ++ finalAttrs.dlopenPropagatedBuildInputs; - - dlopenBuildInputs = - lib.optionals alsaSupport [ - alsa-lib - audiofile - ] - ++ lib.optional dbusSupport dbus - ++ lib.optional libdecorSupport libdecor - ++ lib.optional pipewireSupport pipewire - ++ lib.optional pulseaudioSupport libpulseaudio - ++ lib.optional udevSupport udev - ++ lib.optionals waylandSupport [ - wayland - libxkbcommon - ] - ++ lib.optionals x11Support [ - libICE - libXi - libXScrnSaver - libXcursor - libXinerama - libXext - libXrandr - libXxf86vm - ] - ++ lib.optionals drmSupport [ - libdrm - libgbm - ]; - - buildInputs = - [ libiconv ] - ++ finalAttrs.dlopenBuildInputs - ++ lib.optional ibusSupport ibus - ++ lib.optionals waylandSupport [ wayland-protocols ]; - - enableParallelBuilding = true; - - configureFlags = - [ "--disable-oss" ] - ++ lib.optional (!x11Support) "--without-x" - ++ lib.optional alsaSupport "--with-alsa-prefix=${alsa-lib.out}/lib" - ++ lib.optional stdenv.hostPlatform.isWindows "--disable-video-opengles" - ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-sdltest"; - - # We remove libtool .la files when static libs are requested, - # because they make the builds of downstream libs like `SDL_tff` - # fail with `cannot find -lXext, `-lXcursor` etc. linker errors - # because the `.la` files are not pruned if static libs exist - # (see https://github.com/NixOS/nixpkgs/commit/fd97db43bcb05e37f6bb77f363f1e1e239d9de53) - # and they also don't carry the necessary `-L` paths of their - # X11 dependencies. - # For static linking, it is better to rely on `pkg-config` `.pc` - # files. - postInstall = '' - if [ "$dontDisableStatic" -eq "1" ]; then - rm $out/lib/*.la - else - rm $out/lib/*.a - fi - moveToOutput bin/sdl2-config "$dev" - ''; - - # SDL is weird in that instead of just dynamically linking with - # libraries when you `--enable-*` (or when `configure` finds) them - # it `dlopen`s them at runtime. In principle, this means it can - # ignore any missing optional dependencies like alsa, pulseaudio, - # some x11 libs, wayland, etc if they are missing on the system - # and/or work with wide array of versions of said libraries. In - # nixpkgs, however, we don't need any of that. Moreover, since we - # don't have a global ld-cache we have to stuff all the propagated - # libraries into rpath by hand or else some applications that use - # SDL API that requires said libraries will fail to start. - # - # You can grep SDL sources with `grep -rE 'SDL_(NAME|.*_SYM)'` to - # list the symbols used in this way. - postFixup = - let - rpath = lib.makeLibraryPath ( - finalAttrs.dlopenPropagatedBuildInputs ++ finalAttrs.dlopenBuildInputs - ); - in - lib.optionalString (stdenv.hostPlatform.extensions.sharedLibrary == ".so") '' - for lib in $out/lib/*.so* ; do - if ! [[ -L "$lib" ]]; then - patchelf --set-rpath "$(patchelf --print-rpath $lib):${rpath}" "$lib" - fi - done - ''; - - setupHook = ./setup-hook.sh; - - passthru = { - inherit openglSupport; - updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "release-(2\\..*)" - ]; - }; - tests = { - pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; - }; - }; - - meta = with lib; { - description = "Cross-platform multimedia library"; - mainProgram = "sdl2-config"; - homepage = "http://www.libsdl.org/"; - changelog = "https://github.com/libsdl-org/SDL/releases/tag/release-${finalAttrs.version}"; - license = licenses.zlib; - platforms = platforms.all; - teams = [ lib.teams.sdl ]; - pkgConfigModules = [ "sdl2" ]; - }; -}) diff --git a/pkgs/by-name/sd/SDL2_classic/setup-hook.sh b/pkgs/by-name/sd/SDL2_classic/setup-hook.sh deleted file mode 100644 index 0119926491af..000000000000 --- a/pkgs/by-name/sd/SDL2_classic/setup-hook.sh +++ /dev/null @@ -1,7 +0,0 @@ -addSDL2Path () { - if [ -e "$1/include/SDL2" ]; then - export SDL2_PATH="${SDL2_PATH-}${SDL2_PATH:+ }$1/include/SDL2" - fi -} - -addEnvHooks "$hostOffset" addSDL2Path diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index d7144b8ae3dc..b80a1efb0249 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1687,6 +1687,7 @@ mapAliases { SDL_gpu = throw "'SDL_gpu' has been removed due to lack of upstream maintenance and known users"; # Added 2025-03-15 SDL_image_2_0 = throw "'SDL_image_2_0' has been removed in favor of the latest version"; # Added 2025-04-20 SDL2_mixer_2_0 = throw "'SDL2_mixer_2_0' has been removed in favor of the latest version"; # Added 2025-04-27 + SDL2_classic = throw "'SDL2_classic' has been removed. Consider upgrading to 'sdl2-compat', also available as 'SDL2'."; # Added 2025-05-20 SDL2_classic_image = throw "'SDL2_classic_image' has been removed as part of the deprecation of 'SDL2_classic'. Consider upgrading to 'SDL2_image' built with 'sdl2-compat'."; # Added 2025-05-20 SDL2_classic_mixer_2_0 = throw "'SDL2_classic_mixer_2_0' has been removed in favor of the latest version"; # Added 2025-04-27 SDL2_classic_mixer = throw "'SDL2_classic_mixer' has been removed as part of the deprecation of 'SDL2_classic'. Consider upgrading to 'SDL2_mixer' built with 'sdl2-compat'."; # Added 2025-05-20