2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, SDL2
|
2022-09-09 14:08:57 +00:00
|
|
|
, libiconv
|
|
|
|
, Cocoa
|
2023-02-02 18:25:31 +00:00
|
|
|
, autoSignDarwinBinariesHook
|
2022-06-16 17:23:12 +00:00
|
|
|
, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms
|
|
|
|
, openglSupport ? libGLSupported
|
|
|
|
, libGLU
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) optionals makeLibraryPath;
|
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "SDL_compat";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.2.68";
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libsdl-org";
|
|
|
|
repo = "sdl12-compat";
|
|
|
|
rev = "release-" + version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ]
|
|
|
|
++ optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ SDL2 ]
|
2022-09-09 14:08:57 +00:00
|
|
|
++ optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ]
|
2024-07-27 06:49:29 +00:00
|
|
|
++ optionals openglSupport [ libGLU ];
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
setupHook = ../SDL/setup-hook.sh;
|
|
|
|
|
|
|
|
postFixup = ''
|
2022-09-09 14:08:57 +00:00
|
|
|
for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do
|
2022-06-16 17:23:12 +00:00
|
|
|
if [[ -L "$lib" ]]; then
|
2022-09-09 14:08:57 +00:00
|
|
|
${if stdenv.hostPlatform.isDarwin then ''
|
|
|
|
install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${makeLibraryPath [x]} ") propagatedBuildInputs} "$lib"
|
|
|
|
'' else ''
|
|
|
|
patchelf --set-rpath "$(patchelf --print-rpath $lib):${makeLibraryPath propagatedBuildInputs}" "$lib"
|
|
|
|
''}
|
2022-06-16 17:23:12 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Cross-platform multimedia library - build SDL 1.2 applications against 2.0";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "sdl-config";
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://www.libsdl.org/";
|
|
|
|
license = licenses.zlib;
|
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|