Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL2_mixer: adopt and refactor #308362

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions pkgs/by-name/sd/SDL2_mixer/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
lib,
SDL2,
darwin,
fetchFromGitHub,
flac,
fluidsynth,
libmodplug,
libogg,
libvorbis,
mpg123,
opusfile,
pkg-config,
smpeg2,
stdenv,
timidity,
}:

let
inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit AudioToolbox;
in
stdenv.mkDerivation (finalAttrs: {
pname = "SDL2_mixer";
version = "2.8.0";

src = fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL_mixer";
rev = "release-${finalAttrs.version}";
hash = "sha256-jLKawxnwP5dJglUhgHfWgmKh27i32Rr4LcJQdpXasco=";
};

nativeBuildInputs = [
SDL2
pkg-config
];

buildInputs = lib.optionals stdenv.isDarwin [
AudioToolbox
AudioUnit
CoreServices
];

propagatedBuildInputs = [
SDL2
flac
fluidsynth
libmodplug
libogg
libvorbis
mpg123
opusfile
smpeg2
# MIDI patterns
timidity
];

outputs = [ "out" "dev" ];

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";
description = "SDL multi-channel audio mixer library";
license = lib.licenses.zlib;
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.unix;
};
})
40 changes: 40 additions & 0 deletions pkgs/by-name/sd/SDL2_mixer_2_0/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SDL2_mixer_2_0 pinned for lzwolf
{
SDL2_mixer,
fetchFromGitHub,
fetchpatch,
lzwolf,
timidity,
}:

let
attrset = {
version = "2.0.4";

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
];

# 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;
};
in SDL2_mixer.overrideAttrs(_: attrset)
34 changes: 0 additions & 34 deletions pkgs/development/libraries/SDL2_mixer/2_0.nix

This file was deleted.

74 changes: 0 additions & 74 deletions pkgs/development/libraries/SDL2_mixer/default.nix

This file was deleted.

6 changes: 0 additions & 6 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24340,12 +24340,6 @@ with pkgs;
};
});

SDL2_mixer = callPackage ../development/libraries/SDL2_mixer {
inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit AudioToolbox;
};
# 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 { };

SDL2_sound = callPackage ../development/libraries/SDL2_sound {
Expand Down