Unverified Commit d0aef5b0 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

SDL2_sound: 2.0.1 -> 2.0.4; modernize (#420257)

parents 31795c57 d226b8e9
Loading
Loading
Loading
Loading
+32 −28
Original line number Diff line number Diff line
@@ -2,53 +2,57 @@
  stdenv,
  lib,
  fetchFromGitHub,
  fetchpatch,
  cmake,
  SDL2,
  flac,
  libmikmod,
  libvorbis,
  timidity,
  nix-update-script,
}:

stdenv.mkDerivation rec {
# As of 2025-06-27 this library has no dependents in nixpkgs (https://github.com/NixOS/nixpkgs/pull/420339) and is
# considered for deletion.
stdenv.mkDerivation (finalAttrs: {
  pname = "SDL2_sound";
  version = "2.0.1";
  version = "2.0.4";

  src = fetchFromGitHub {
    owner = "icculus";
    repo = "SDL_sound";
    rev = "v${version}";
    hash = "sha256-N2znqy58tMHgYa07vEsSedWLRhoJzDoINcsUu0UYLnA=";
    rev = "v${finalAttrs.version}";
    hash = "sha256-5t2ELm8d8IX+cIJqGl/8sffwXGj5Cm0kZI6+bmjvvPg=";
  };

  patches = [
    (fetchpatch {
      # https://github.com/icculus/SDL_sound/pull/32 - fix build on darwin
      # can be dropped on the next update
      url = "https://github.com/icculus/SDL_sound/commit/c15d75b7720113b28639baad284f45f943846294.patch";
      hash = "sha256-4GL8unsZ7eNkzjLXq9QdaxFQMzX2tdP0cBR1jTaRLc0=";
    })
  outputs = [
    "out"
    "lib"
    "dev"
  ];

  nativeBuildInputs = [ cmake ];

  cmakeFlags = [ "-DSDLSOUND_DECODER_MIDI=1" ];

  buildInputs = [
    SDL2
    flac
    libmikmod
    libvorbis
    timidity
  cmakeFlags = [
    (lib.cmakeBool "SDLSOUND_DECODER_MIDI" true)
    (lib.cmakeBool "SDLSOUND_BUILD_SHARED" (!stdenv.hostPlatform.isStatic))
    (lib.cmakeBool "SDLSOUND_BUILD_STATIC" stdenv.hostPlatform.isStatic)
  ];

  meta = with lib; {
  buildInputs = [ SDL2 ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "SDL2 sound library";
    mainProgram = "playsound";
    platforms = platforms.unix;
    license = licenses.zlib;
    platforms = lib.platforms.all;
    license = with lib.licenses; [
      zlib

      # various vendored decoders
      publicDomain

      # timidity
      artistic1
      lgpl21Only
    ];
    teams = [ lib.teams.sdl ];
    homepage = "https://www.icculus.org/SDL_sound/";
  };
}
})