From f10b660d623a6e219fd1a41c8e7793762aa6643e Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 13:29:32 -0300 Subject: [PATCH 1/5] SDL2_mixer: adopted by AndersonTorres --- pkgs/development/libraries/SDL2_mixer/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/development/libraries/SDL2_mixer/default.nix index d9e8d7e774a71ec..eaf51d1d77f8076 100644 --- a/pkgs/development/libraries/SDL2_mixer/default.nix +++ b/pkgs/development/libraries/SDL2_mixer/default.nix @@ -68,7 +68,7 @@ stdenv.mkDerivation rec { description = "SDL multi-channel audio mixer library"; platforms = platforms.unix; homepage = "https://github.com/libsdl-org/SDL_mixer"; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ AndersonTorres ]; license = licenses.zlib; }; } From ba650ad0144bbeae17ce74dc5a718719db988b47 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 18:39:11 -0300 Subject: [PATCH 2/5] SDL2_mixer: refactor - finalAttrs - use fetchFromGitHub (since the url is deactivated) - strictDeps - no nested with --- .../libraries/SDL2_mixer/default.nix | 90 ++++++++++--------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/development/libraries/SDL2_mixer/default.nix index eaf51d1d77f8076..c271614d8f5f89a 100644 --- a/pkgs/development/libraries/SDL2_mixer/default.nix +++ b/pkgs/development/libraries/SDL2_mixer/default.nix @@ -1,47 +1,40 @@ -{ lib, stdenv -, fetchurl -, pkg-config -, AudioToolbox -, AudioUnit -, CoreServices -, SDL2 -, flac -, fluidsynth -, libmodplug -, libogg -, libvorbis -, mpg123 -, opusfile -, smpeg2 -, timidity +{ + lib, + SDL2, + darwin, + fetchFromGitHub, + flac, + fluidsynth, + libmodplug, + libogg, + libvorbis, + mpg123, + opusfile, + pkg-config, + smpeg2, + stdenv, + timidity, }: -stdenv.mkDerivation rec { +let + inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit AudioToolbox; +in +stdenv.mkDerivation (finalAttrs: { pname = "SDL2_mixer"; version = "2.8.0"; - src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_mixer/release/${pname}-${version}.tar.gz"; - sha256 = "sha256-HPs0yHsm29vHr9aMT1RcARarX5C7/sxa6+Kpy0uzFUk="; + src = fetchFromGitHub { + owner = "libsdl-org"; + repo = "SDL_mixer"; + rev = "release-${finalAttrs.version}"; + hash = "sha256-jLKawxnwP5dJglUhgHfWgmKh27i32Rr4LcJQdpXasco="; }; - configureFlags = [ - "--disable-music-ogg-shared" - "--disable-music-flac-shared" - "--disable-music-mod-modplug-shared" - "--disable-music-mp3-mpg123-shared" - "--disable-music-opus-shared" - "--disable-music-midi-fluidsynth-shared" - - # override default path to allow MIDI files to be played - "--with-timidity-cfg=${timidity}/share/timidity/timidity.cfg" - ] ++ lib.optionals stdenv.isDarwin [ - "--disable-sdltest" - "--disable-smpegtest" + nativeBuildInputs = [ + SDL2 + pkg-config ]; - nativeBuildInputs = [ pkg-config ]; - buildInputs = lib.optionals stdenv.isDarwin [ AudioToolbox AudioUnit @@ -64,11 +57,26 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; - meta = with lib; { - description = "SDL multi-channel audio mixer library"; - platforms = platforms.unix; + strictDeps = true; + + configureFlags = [ + (lib.enableFeature false "music-ogg-shared") + (lib.enableFeature false "music-flac-shared") + (lib.enableFeature false "music-mod-modplug-shared") + (lib.enableFeature false "music-mp3-mpg123-shared") + (lib.enableFeature false "music-opus-shared") + (lib.enableFeature false "music-midi-fluidsynth-shared") + (lib.enableFeature (!stdenv.isDarwin) "sdltest") + (lib.enableFeature (!stdenv.isDarwin) "smpegtest") + # override default path to allow MIDI files to be played + (lib.withFeatureAs true "timidity-cfg" "${timidity}/share/timidity/timidity.cfg") + ]; + + meta = { homepage = "https://github.com/libsdl-org/SDL_mixer"; - maintainers = with maintainers; [ AndersonTorres ]; - license = licenses.zlib; + description = "SDL multi-channel audio mixer library"; + license = lib.licenses.zlib; + maintainers = with lib.maintainers; [ AndersonTorres ]; + platforms = lib.platforms.unix; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ffe55bb47fc772e..0b889594b56db9b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24340,9 +24340,7 @@ with pkgs; }; }); - SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { - inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit AudioToolbox; - }; + SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { }; # SDL2_mixer_2_0 pinned for lzwolf SDL2_mixer_2_0 = callPackage ../development/libraries/SDL2_mixer/2_0.nix { }; From 5fa2bdc79d6f9198c93275aecd606571c020cba1 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 18:50:05 -0300 Subject: [PATCH 3/5] SDL2_mixer_2_0: refactor - get rid of rec - use fetchFromGitHub (since the url is deactivated) --- pkgs/development/libraries/SDL2_mixer/2_0.nix | 61 ++++++++++--------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/pkgs/development/libraries/SDL2_mixer/2_0.nix b/pkgs/development/libraries/SDL2_mixer/2_0.nix index e75e0c9c5cc0926..e98353a0a4040fe 100644 --- a/pkgs/development/libraries/SDL2_mixer/2_0.nix +++ b/pkgs/development/libraries/SDL2_mixer/2_0.nix @@ -1,34 +1,39 @@ -{ fetchurl -, fetchpatch -, lzwolf -, SDL2_mixer -, timidity +{ + SDL2_mixer, + fetchFromGitHub, + fetchpatch, + lzwolf, + timidity, }: -SDL2_mixer.overrideAttrs(oa: rec { - version = "2.0.4"; +let + attrset = { + version = "2.0.4"; - src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-${version}.tar.gz"; - sha256 = "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl"; - }; + src = fetchFromGitHub { + owner = "libsdl-org"; + repo = "SDL_mixer"; + rev = "release-${attrset.version}"; + hash = "sha256-vo9twUGeK2emDiGd9kSGuA/X8TxVmQrRFFm71zawWYM="; + }; - patches = [ - # These patches fix incompatible function pointer conversion errors with clang 16. - (fetchpatch { - url = "https://github.com/libsdl-org/SDL_mixer/commit/4119ec3fe838d38d2433f4432cd18926bda5d093.patch"; - stripLen = 2; - hash = "sha256-Ug1EEZIRcV8+e1MeMsGHuTW7Zn6j4szqujP8IkIq2VM="; - }) - # Based on https://github.com/libsdl-org/SDL_mixer/commit/64ab759111ddb1b033bcce64e1a04e0cba6e498f - ./SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch - ]; + patches = [ + # These patches fix incompatible function pointer conversion errors with clang 16. + (fetchpatch { + url = "https://github.com/libsdl-org/SDL_mixer/commit/4119ec3fe838d38d2433f4432cd18926bda5d093.patch"; + stripLen = 2; + hash = "sha256-Ug1EEZIRcV8+e1MeMsGHuTW7Zn6j4szqujP8IkIq2VM="; + }) + # Based on https://github.com/libsdl-org/SDL_mixer/commit/64ab759111ddb1b033bcce64e1a04e0cba6e498f + ./SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch + ]; - # fix default path to timidity.cfg so MIDI files could be played - postPatch = '' - substituteInPlace timidity/options.h \ - --replace "/usr/share/timidity" "${timidity}/share/timidity" - ''; + # fix default path to timidity.cfg so MIDI files could be played + postPatch = '' + substituteInPlace timidity/options.h \ + --replace "/usr/share/timidity" "${timidity}/share/timidity" + ''; - passthru.tests.lzwolf = lzwolf; -}) + passthru.tests.lzwolf = lzwolf; + }; +in SDL2_mixer.overrideAttrs(_: attrset) From 5f77c558facf597834bdb283a902857646699f1c Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 26 Apr 2024 18:54:11 -0300 Subject: [PATCH 4/5] SDL2_mixer_2_0: migrate to by-name --- .../SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch | 0 .../2_0.nix => by-name/sd/SDL2_mixer_2_0/package.nix} | 1 + pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 1 insertion(+), 2 deletions(-) rename pkgs/{development/libraries/SDL2_mixer => by-name/sd/SDL2_mixer_2_0}/SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch (100%) rename pkgs/{development/libraries/SDL2_mixer/2_0.nix => by-name/sd/SDL2_mixer_2_0/package.nix} (96%) diff --git a/pkgs/development/libraries/SDL2_mixer/SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch b/pkgs/by-name/sd/SDL2_mixer_2_0/SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch similarity index 100% rename from pkgs/development/libraries/SDL2_mixer/SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch rename to pkgs/by-name/sd/SDL2_mixer_2_0/SDL_mixer-2.0-incompatible-pointer-comparison-fix.patch diff --git a/pkgs/development/libraries/SDL2_mixer/2_0.nix b/pkgs/by-name/sd/SDL2_mixer_2_0/package.nix similarity index 96% rename from pkgs/development/libraries/SDL2_mixer/2_0.nix rename to pkgs/by-name/sd/SDL2_mixer_2_0/package.nix index e98353a0a4040fe..9413b8dda96e6be 100644 --- a/pkgs/development/libraries/SDL2_mixer/2_0.nix +++ b/pkgs/by-name/sd/SDL2_mixer_2_0/package.nix @@ -1,3 +1,4 @@ +# SDL2_mixer_2_0 pinned for lzwolf { SDL2_mixer, fetchFromGitHub, diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0b889594b56db9b..981ec74db2e1550 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24341,8 +24341,6 @@ with pkgs; }); SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { }; - # SDL2_mixer_2_0 pinned for lzwolf - SDL2_mixer_2_0 = callPackage ../development/libraries/SDL2_mixer/2_0.nix { }; SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; From c0ad46e480df160c0c51dcf2cc02ba40b730e99c Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 2 May 2024 21:21:51 -0300 Subject: [PATCH 5/5] SDL2_mixer: migrate to by-name --- .../default.nix => by-name/sd/SDL2_mixer/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{development/libraries/SDL2_mixer/default.nix => by-name/sd/SDL2_mixer/package.nix} (100%) diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/by-name/sd/SDL2_mixer/package.nix similarity index 100% rename from pkgs/development/libraries/SDL2_mixer/default.nix rename to pkgs/by-name/sd/SDL2_mixer/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 981ec74db2e1550..79a3a3eb92c0e8d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24340,8 +24340,6 @@ with pkgs; }; }); - SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { }; - SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; SDL2_sound = callPackage ../development/libraries/SDL2_sound {