{SDL1, SDL_compat}: migrate to by-name (#339311)
This commit is contained in:
@@ -1,34 +1,50 @@
|
||||
{ lib, stdenv, config, fetchurl, fetchpatch, pkg-config, audiofile, libcap, libiconv
|
||||
{ lib
|
||||
, alsa-lib
|
||||
, audiofile
|
||||
, config
|
||||
, darwin
|
||||
, fetchpatch
|
||||
, fetchurl
|
||||
, libGL
|
||||
, libGLU
|
||||
, libICE
|
||||
, libXext
|
||||
, libXrandr
|
||||
, libcap
|
||||
, libiconv
|
||||
, libpulseaudio
|
||||
, pkg-config
|
||||
, stdenv
|
||||
# Boolean flags
|
||||
, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid
|
||||
, libGLSupported ? lib.meta.availableOn stdenv.hostPlatform libGL
|
||||
, openglSupport ? libGLSupported, libGL, libGLU
|
||||
, alsaSupport ? stdenv.isLinux && !stdenv.hostPlatform.isAndroid, alsa-lib
|
||||
, openglSupport ? libGLSupported
|
||||
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid && lib.meta.availableOn stdenv.hostPlatform libpulseaudio
|
||||
, x11Support ? !stdenv.isCygwin && !stdenv.hostPlatform.isAndroid
|
||||
, libXext, libICE, libXrandr
|
||||
, pulseaudioSupport ? config.pulseaudio or stdenv.isLinux && !stdenv.hostPlatform.isAndroid && lib.meta.availableOn stdenv.hostPlatform libpulseaudio, libpulseaudio
|
||||
, OpenGL, GLUT, CoreAudio, CoreServices, AudioUnit, Kernel, Cocoa
|
||||
}:
|
||||
|
||||
# NOTE: When editing this expression see if the same change applies to
|
||||
# SDL2 expression too
|
||||
|
||||
let
|
||||
inherit (darwin.apple_sdk.frameworks) OpenGL CoreAudio CoreServices AudioUnit Kernel Cocoa GLUT;
|
||||
extraPropagatedBuildInputs = [ ]
|
||||
++ lib.optionals x11Support [ libXext libICE libXrandr ]
|
||||
++ lib.optionals (openglSupport && stdenv.isLinux) [ libGL libGLU ]
|
||||
++ lib.optionals (openglSupport && stdenv.isLinux) [ libGL ]
|
||||
# libGLU doesn’t work with Android's SDL
|
||||
++ lib.optionals (openglSupport && stdenv.isLinux && (!stdenv.hostPlatform.isAndroid)) [ libGLU ]
|
||||
++ lib.optionals (openglSupport && stdenv.isDarwin) [ OpenGL GLUT ]
|
||||
++ lib.optional alsaSupport alsa-lib
|
||||
++ lib.optional pulseaudioSupport libpulseaudio
|
||||
++ lib.optional stdenv.isDarwin Cocoa;
|
||||
rpath = lib.makeLibraryPath extraPropagatedBuildInputs;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "SDL";
|
||||
version = "1.2.15";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.libsdl.org/release/${pname}-${version}.tar.gz";
|
||||
sha256 = "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn";
|
||||
url = "https://www.libsdl.org/release/SDL-${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-1tMWp5Pl40gVXw3ZO5eXmJM/uYqh7evMEIgp1kdKrQA=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
@@ -39,8 +55,9 @@ stdenv.mkDerivation rec {
|
||||
|
||||
propagatedBuildInputs = [ libiconv ] ++ extraPropagatedBuildInputs;
|
||||
|
||||
buildInputs = [ ]
|
||||
++ lib.optional (!stdenv.hostPlatform.isMinGW && alsaSupport) audiofile
|
||||
buildInputs =
|
||||
[ ]
|
||||
++ lib.optionals (!stdenv.hostPlatform.isMinGW && alsaSupport) [ audiofile ]
|
||||
++ lib.optionals stdenv.isDarwin [ AudioUnit CoreAudio CoreServices Kernel OpenGL ];
|
||||
|
||||
configureFlags = [
|
||||
@@ -106,12 +123,16 @@ stdenv.mkDerivation rec {
|
||||
})
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
postInstall = ''
|
||||
moveToOutput share/aclocal "$dev"
|
||||
'';
|
||||
|
||||
# See the same place in the expression for SDL2
|
||||
postFixup = ''
|
||||
postFixup = let
|
||||
rpath = lib.makeLibraryPath extraPropagatedBuildInputs;
|
||||
in ''
|
||||
for lib in $out/lib/*.so* ; do
|
||||
if [[ -L "$lib" ]]; then
|
||||
patchelf --set-rpath "$(patchelf --print-rpath $lib):${rpath}" "$lib"
|
||||
@@ -123,14 +144,12 @@ stdenv.mkDerivation rec {
|
||||
|
||||
passthru = { inherit openglSupport; };
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
homepage = "http://www.libsdl.org/";
|
||||
description = "Cross-platform multimedia library";
|
||||
license = lib.licenses.lgpl21;
|
||||
mainProgram = "sdl-config";
|
||||
homepage = "http://www.libsdl.org/";
|
||||
maintainers = with maintainers; [ lovek323 ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.lgpl21;
|
||||
maintainers = lib.teams.sdl.members ++ (with lib.maintainers; [ lovek323 ]);
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
})
|
||||
+24
-24
@@ -1,62 +1,62 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, pkg-config
|
||||
, SDL2
|
||||
, cmake
|
||||
, darwin
|
||||
, fetchFromGitHub
|
||||
, libGLU
|
||||
, libiconv
|
||||
, Cocoa
|
||||
, autoSignDarwinBinariesHook
|
||||
, mesa
|
||||
, pkg-config
|
||||
, stdenv
|
||||
# Boolean flags
|
||||
, libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms
|
||||
, openglSupport ? libGLSupported
|
||||
, libGLU
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) optionals makeLibraryPath;
|
||||
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||
inherit (darwin) autoSignDarwinBinariesHook;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "SDL_compat";
|
||||
version = "1.2.68";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "libsdl-org";
|
||||
repo = "sdl12-compat";
|
||||
rev = "release-" + version;
|
||||
rev = "release-" + finalAttrs.version;
|
||||
hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake pkg-config ]
|
||||
++ optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ];
|
||||
++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ];
|
||||
|
||||
propagatedBuildInputs = [ SDL2 ]
|
||||
++ optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ]
|
||||
++ optionals openglSupport [ libGLU ];
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ]
|
||||
++ lib.optionals openglSupport [ libGLU ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
setupHook = ../SDL/setup-hook.sh;
|
||||
setupHook = ./setup-hook.sh;
|
||||
|
||||
postFixup = ''
|
||||
for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do
|
||||
if [[ -L "$lib" ]]; then
|
||||
${if stdenv.hostPlatform.isDarwin then ''
|
||||
install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${makeLibraryPath [x]} ") propagatedBuildInputs} "$lib"
|
||||
install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${lib.makeLibraryPath [x]} ") finalAttrs.propagatedBuildInputs} "$lib"
|
||||
'' else ''
|
||||
patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib"
|
||||
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath finalAttrs.propagatedBuildInputs}" "$lib"
|
||||
''}
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Cross-platform multimedia library - build SDL 1.2 applications against 2.0";
|
||||
mainProgram = "sdl-config";
|
||||
meta = {
|
||||
homepage = "https://www.libsdl.org/";
|
||||
license = licenses.zlib;
|
||||
maintainers = with maintainers; [ peterhoeg ];
|
||||
platforms = platforms.all;
|
||||
description = "Cross-platform multimedia library - build SDL 1.2 applications against 2.0";
|
||||
license = lib.licenses.zlib;
|
||||
mainProgram = "sdl-config";
|
||||
maintainers = lib.teams.sdl.members ++ (with lib.maintainers; [ peterhoeg ]);
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
addSDLPath () {
|
||||
if [ -e "$1/include/SDL" ]; then
|
||||
export SDL_PATH="${SDL_PATH-}${SDL_PATH:+ }$1/include/SDL"
|
||||
# NB this doesn’t work with split dev packages because different packages
|
||||
# will contain "include/SDL/" and "lib/" directories.
|
||||
#
|
||||
# However the SDL_LIB_PATH is consumed by SDL itself and serves to locate
|
||||
# libraries like SDL_mixer, SDL_image, etc which are not split-package
|
||||
# so the check above will only trigger on them.
|
||||
if [ -e "$1/lib" ]; then
|
||||
export SDL_LIB_PATH="${SDL_LIB_PATH-}${SDL_LIB_PATH:+ }-L$1/lib"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
addEnvHooks "$hostOffset" addSDLPath
|
||||
@@ -40,8 +40,8 @@ stdenv.mkDerivation rec {
|
||||
"SHAREWARE=${if buildShareware then "1" else "0"}"
|
||||
];
|
||||
|
||||
# when using SDL_compat instead of SDL_classic, SDL_mixer isn't correctly
|
||||
# detected, but there is no harm just specifying it
|
||||
# when using SDL_compat instead of SDL1, SDL_mixer isn't correctly detected,
|
||||
# but there is no harm just specifying it
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-I${lib.getDev SDL_mixer}/include/SDL"
|
||||
];
|
||||
|
||||
@@ -1372,6 +1372,7 @@ mapAliases ({
|
||||
|
||||
### S ###
|
||||
|
||||
SDL_classic = SDL1; # Added 2024-09-03
|
||||
s2n = s2n-tls; # Added 2021-03-03
|
||||
sandboxfs = throw "'sandboxfs' has been removed due to being unmaintained, consider using linux namespaces for sandboxing instead"; # Added 2024-06-06
|
||||
sane-backends-git = sane-backends; # Added 2021-02-19
|
||||
|
||||
@@ -23442,19 +23442,7 @@ with pkgs;
|
||||
|
||||
scope-lite = callPackage ../development/libraries/scope-lite { };
|
||||
|
||||
SDL_classic = callPackage ../development/libraries/SDL ({
|
||||
inherit (darwin.apple_sdk.frameworks) OpenGL CoreAudio CoreServices AudioUnit Kernel Cocoa GLUT;
|
||||
} // lib.optionalAttrs stdenv.hostPlatform.isAndroid {
|
||||
# libGLU doesn’t work with Android’s SDL
|
||||
libGLU = null;
|
||||
});
|
||||
|
||||
SDL_compat = callPackage ../development/libraries/SDL_compat {
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa;
|
||||
inherit (darwin) autoSignDarwinBinariesHook;
|
||||
};
|
||||
|
||||
SDL = SDL_classic;
|
||||
SDL = SDL1;
|
||||
|
||||
SDL2 = callPackage ../development/libraries/SDL2 {
|
||||
inherit (darwin.apple_sdk.frameworks) AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL;
|
||||
|
||||
Reference in New Issue
Block a user