54 lines
1.5 KiB
Nix
54 lines
1.5 KiB
Nix
{ lib, stdenv, fetchFromGitHub, libpng, agbcc, gcc-arm-embedded, rsync, modern ? false, roms ? null, german ? false }:
|
|
let
|
|
roms' =
|
|
if roms == null
|
|
then
|
|
(if german
|
|
then [ "ruby_de" "ruby_de_rev1" "sapphire_de" "sapphire_de_rev1" ]
|
|
else [ "ruby" "ruby_rev1" "ruby_rev2" "sapphire" "sapphire_rev1" "sapphire_rev2" ])
|
|
else roms;
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "pokeruby${lib.optionalString german "-de"}${lib.optionalString modern "-modern"}";
|
|
version = "unstable-2021-07-16";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "pret";
|
|
repo = "pokeruby";
|
|
rev = "7cc7f95aa646bb38cb4c29e4422df7b6f1ffd81e";
|
|
sha256 = "sha256-i4MOcvJQTAoWJRgf0l0oSSFz2MoUzD4+ADmvhldytg4=";
|
|
};
|
|
|
|
nativeBuildInputs = [ gcc-arm-embedded ] ++ lib.optional german rsync;
|
|
buildInputs = [ libpng ];
|
|
|
|
postPatch = ''
|
|
ln -s ${agbcc}/tools/agbcc tools/
|
|
'';
|
|
|
|
preBuild = lib.optionalString german ''
|
|
bash de_before.sh
|
|
'';
|
|
|
|
makeFlags = [
|
|
"TOOLCHAIN=${gcc-arm-embedded}"
|
|
"MODERN=${if modern then "1" else "0"}"
|
|
] ++ roms';
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out
|
|
cp poke{${lib.concatStringsSep "," roms'}}${lib.optionalString modern "_modern"}.gba $out
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "ROM built from disassembly of Pokémon Ruby/Sapphire";
|
|
homepage = "https://github.com/pret/pokeruby";
|
|
license = licenses.unfree;
|
|
maintainers = with maintainers; [ sbruder ];
|
|
};
|
|
}
|