nixpkgs/pkgs/games/srb2/default.nix

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

94 lines
2.0 KiB
Nix
Raw Normal View History

2020-11-26 22:08:51 +00:00
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, substituteAll
, cmake
, curl
, nasm
2022-06-13 23:42:58 +00:00
, libopenmpt
2020-11-26 22:08:51 +00:00
, p7zip
, game-music-emu
2020-11-26 22:08:51 +00:00
, libpng
, SDL2
, SDL2_mixer
, zlib
}:
let
assets_version = "2.2.5";
assets = fetchurl {
url = "https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/srb2-${assets_version}-assets.7z";
sha256 = "1m9xf3vraq9nipsi09cyvvfa4i37gzfxg970rnqfswd86z9v6v00";
};
assets_optional = fetchurl {
url = "https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/srb2-${assets_version}-optional-assets.7z";
sha256 = "1j29jrd0r1k2bb11wyyl6yv9b90s2i6jhrslnh77qkrhrwnwcdz4";
};
in stdenv.mkDerivation rec {
pname = "srb2";
2022-05-09 20:49:21 +00:00
version = "2.2.10";
2020-11-26 22:08:51 +00:00
src = fetchFromGitHub {
owner = "STJr";
repo = "SRB2";
rev = "SRB2_release_${version}";
2022-05-09 20:49:21 +00:00
sha256 = "03388n094d2yr5si6ngnggbqhm8b2l0s0qvfnkz49li9bd6a81gg";
2020-11-26 22:08:51 +00:00
};
nativeBuildInputs = [
cmake
nasm
p7zip
];
buildInputs = [
curl
game-music-emu
2020-11-26 22:08:51 +00:00
libpng
2022-06-13 23:42:58 +00:00
libopenmpt
2020-11-26 22:08:51 +00:00
SDL2
SDL2_mixer
zlib
];
cmakeFlags = [
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
"-DGME_INCLUDE_DIR=${game-music-emu}/include"
2022-06-13 23:42:58 +00:00
"-DOPENMPT_INCLUDE_DIR=${libopenmpt.dev}/include"
"-DSDL2_MIXER_INCLUDE_DIR=${lib.getDev SDL2_mixer}/include/SDL2"
"-DSDL2_INCLUDE_DIR=${lib.getDev SDL2}/include/SDL2"
2020-11-26 22:08:51 +00:00
];
patches = [
./wadlocation.patch
];
postPatch = ''
substituteInPlace src/sdl/i_system.c \
--replace '@wadlocation@' $out
'';
preConfigure = ''
7z x ${assets} -o"/build/source/assets" -aos
7z x ${assets_optional} -o"/build/source/assets" -aos
'';
postInstall = ''
mkdir $out/bin
mv $out/lsdlsrb2-${version} $out/bin/srb2
'';
meta = with lib; {
description = "Sonic Robo Blast 2 is a 3D Sonic the Hedgehog fangame based on a modified version of Doom Legacy";
homepage = "https://www.srb2.org/";
platforms = platforms.linux;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ zeratax ];
};
}