8 , makefile ? "Makefile.libretro"
9 , extraBuildInputs ? [ ]
10 , extraNativeBuildInputs ? [ ]
11 # Location of resulting RetroArch core on $out
12 , libretroCore ? "/lib/retroarch/cores"
13 # The core filename is derivated from the core name
14 # Setting `normalizeCore` to `true` will convert `-` to `_` on the core filename
15 , normalizeCore ? true
20 d2u = if normalizeCore then (lib.replaceStrings [ "-" ] [ "_" ]) else (x: x);
21 coreDir = placeholder "out" + libretroCore;
22 coreFilename = "${d2u core}_libretro${stdenv.hostPlatform.extensions.sharedLibrary}";
23 mainProgram = "retroarch-${core}";
24 extraArgs = builtins.removeAttrs args [
33 "extraNativeBuildInputs"
40 stdenv.mkDerivation ({
41 pname = "libretro-${core}";
43 buildInputs = [ zlib ] ++ extraBuildInputs;
44 nativeBuildInputs = [ makeWrapper ] ++ extraNativeBuildInputs;
53 }.${stdenv.hostPlatform.parsed.kernel.name} or stdenv.hostPlatform.parsed.kernel.name}"
59 }.${stdenv.hostPlatform.parsed.cpu.name} or stdenv.hostPlatform.parsed.cpu.name}"
60 ] ++ (args.makeFlags or [ ]);
65 install -Dt ${coreDir} ${coreFilename}
66 makeWrapper ${retroarch}/bin/retroarch $out/bin/${mainProgram} \
67 --add-flags "-L ${coreDir}/${coreFilename}"
72 enableParallelBuilding = true;
75 inherit core libretroCore;
76 updateScript = [ ./update_cores.py repo ];
81 inherit (retroarch.meta) platforms;
82 homepage = "https://www.libretro.com/";
83 maintainers = with maintainers; teams.libretro.members ++ [ hrdinka ];
84 } // (args.meta or { });