nixpkgs/pkgs/by-name/sd/SDL_compat/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.8 KiB
Nix
Raw Normal View History

2022-05-10 06:06:36 +01:00
{ lib
, SDL2
, cmake
, darwin
, fetchFromGitHub
, libGLU
2022-09-08 22:05:48 +01:00
, libiconv
, mesa
, pkg-config
, stdenv
# Boolean flags
, libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms
2022-05-10 06:06:36 +01:00
, openglSupport ? libGLSupported
}:
let
inherit (darwin.apple_sdk.frameworks) Cocoa;
inherit (darwin) autoSignDarwinBinariesHook;
2022-05-10 06:06:36 +01:00
in
stdenv.mkDerivation (finalAttrs: {
2022-05-10 06:06:36 +01:00
pname = "SDL_compat";
2023-10-07 20:22:41 +01:00
version = "1.2.68";
2022-05-10 06:06:36 +01:00
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "sdl12-compat";
rev = "release-" + finalAttrs.version;
2023-10-07 20:22:41 +01:00
hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM=";
2022-05-10 06:06:36 +01:00
};
2022-09-08 22:05:48 +01:00
2023-01-26 02:00:30 +00:00
nativeBuildInputs = [ cmake pkg-config ]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ autoSignDarwinBinariesHook ];
2022-05-10 06:06:36 +01:00
propagatedBuildInputs = [ SDL2 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ]
++ lib.optionals openglSupport [ libGLU ];
2022-05-10 06:06:36 +01:00
enableParallelBuilding = true;
setupHook = ./setup-hook.sh;
2022-05-10 06:06:36 +01:00
postFixup = ''
2022-09-08 22:05:48 +01:00
for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do
2022-05-10 06:06:36 +01:00
if [[ -L "$lib" ]]; then
2022-09-08 22:05:48 +01:00
${if stdenv.hostPlatform.isDarwin then ''
install_name_tool ${lib.strings.concatMapStrings (x: " -add_rpath ${lib.makeLibraryPath [x]} ") finalAttrs.propagatedBuildInputs} "$lib"
2022-09-08 22:05:48 +01:00
'' else ''
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath finalAttrs.propagatedBuildInputs}" "$lib"
2022-09-08 22:05:48 +01:00
''}
2022-05-10 06:06:36 +01:00
fi
done
'';
meta = {
homepage = "https://www.libsdl.org/";
2022-05-10 06:06:36 +01:00
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;
2022-05-10 06:06:36 +01:00
};
})