depot/pkgs/by-name/sd/SDL_compat/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

62 lines
1.8 KiB
Nix

{ lib
, SDL2
, cmake
, darwin
, fetchFromGitHub
, libGLU
, libiconv
, mesa
, pkg-config
, stdenv
# Boolean flags
, libGLSupported ? lib.elem stdenv.hostPlatform.system mesa.meta.platforms
, openglSupport ? libGLSupported
}:
let
inherit (darwin.apple_sdk.frameworks) Cocoa;
inherit (darwin) autoSignDarwinBinariesHook;
in
stdenv.mkDerivation (finalAttrs: {
pname = "SDL_compat";
version = "1.2.68";
src = fetchFromGitHub {
owner = "libsdl-org";
repo = "sdl12-compat";
rev = "release-" + finalAttrs.version;
hash = "sha256-f2dl3L7/qoYNl4sjik1npcW/W09zsEumiV9jHuKnUmM=";
};
nativeBuildInputs = [ cmake pkg-config ]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [ autoSignDarwinBinariesHook ];
propagatedBuildInputs = [ SDL2 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv Cocoa ]
++ lib.optionals openglSupport [ libGLU ];
enableParallelBuilding = true;
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 ${lib.makeLibraryPath [x]} ") finalAttrs.propagatedBuildInputs} "$lib"
'' else ''
patchelf --set-rpath "$(patchelf --print-rpath $lib):${lib.makeLibraryPath finalAttrs.propagatedBuildInputs}" "$lib"
''}
fi
done
'';
meta = {
homepage = "https://www.libsdl.org/";
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;
};
})