srb2: init at 2.2.8
This commit is contained in:
parent
b3f1be780c
commit
e8e144a22a
93
pkgs/games/srb2/default.nix
Normal file
93
pkgs/games/srb2/default.nix
Normal file
|
@ -0,0 +1,93 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, fetchFromGitHub
|
||||
, substituteAll
|
||||
, cmake
|
||||
, curl
|
||||
, nasm
|
||||
, openmpt123
|
||||
, p7zip
|
||||
, libgme
|
||||
, 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";
|
||||
version = "2.2.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "STJr";
|
||||
repo = "SRB2";
|
||||
rev = "SRB2_release_${version}";
|
||||
sha256 = "10prk617pbxkpiyybwwjzv425pkjczfqdb8pxwfyq91aa2rg0kl8";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
nasm
|
||||
p7zip
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
curl
|
||||
libgme
|
||||
libpng
|
||||
openmpt123
|
||||
SDL2
|
||||
SDL2_mixer
|
||||
zlib
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
|
||||
"-DGME_INCLUDE_DIR=${libgme}/include"
|
||||
"-DOPENMPT_INCLUDE_DIR=${openmpt123}/include"
|
||||
"-DSDL2_MIXER_INCLUDE_DIR=${SDL2_mixer}/include/SDL2"
|
||||
"-DSDL2_INCLUDE_DIR=${SDL2.dev}/include/SDL2"
|
||||
];
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
72
pkgs/games/srb2/wadlocation.patch
Normal file
72
pkgs/games/srb2/wadlocation.patch
Normal file
|
@ -0,0 +1,72 @@
|
|||
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
|
||||
index 10c0747bf..861f00728 100644
|
||||
--- a/src/sdl/i_system.c
|
||||
+++ b/src/sdl/i_system.c
|
||||
@@ -145,13 +145,7 @@ int TimeFunction(int requested_frequency);
|
||||
|
||||
// Locations for searching the srb2.pk3
|
||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||
-#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2"
|
||||
-#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2"
|
||||
-#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2"
|
||||
-#define DEFAULTWADLOCATION4 "/usr/games/SRB2"
|
||||
-#define DEFAULTSEARCHPATH1 "/usr/local/games"
|
||||
-#define DEFAULTSEARCHPATH2 "/usr/games"
|
||||
-#define DEFAULTSEARCHPATH3 "/usr/local"
|
||||
+#define DEFAULTWADLOCATION1 "@wadlocation@"
|
||||
#elif defined (_WIN32)
|
||||
#define DEFAULTWADLOCATION1 "c:\\games\\srb2"
|
||||
#define DEFAULTWADLOCATION2 "\\games\\srb2"
|
||||
@@ -2812,34 +2806,6 @@ static const char *locateWad(void)
|
||||
if (((envstr = I_GetEnv("SRB2WADDIR")) != NULL) && isWadPathOk(envstr))
|
||||
return envstr;
|
||||
|
||||
-#ifndef NOCWD
|
||||
- I_OutputMsg(",.");
|
||||
- // examine current dir
|
||||
- strcpy(returnWadPath, ".");
|
||||
- if (isWadPathOk(returnWadPath))
|
||||
- return NULL;
|
||||
-#endif
|
||||
-
|
||||
-
|
||||
-#ifdef CMAKECONFIG
|
||||
-#ifndef NDEBUG
|
||||
- I_OutputMsg(","CMAKE_ASSETS_DIR);
|
||||
- strcpy(returnWadPath, CMAKE_ASSETS_DIR);
|
||||
- if (isWadPathOk(returnWadPath))
|
||||
- {
|
||||
- return returnWadPath;
|
||||
- }
|
||||
-#endif
|
||||
-#endif
|
||||
-
|
||||
-#ifdef __APPLE__
|
||||
- OSX_GetResourcesPath(returnWadPath);
|
||||
- I_OutputMsg(",%s", returnWadPath);
|
||||
- if (isWadPathOk(returnWadPath))
|
||||
- {
|
||||
- return returnWadPath;
|
||||
- }
|
||||
-#endif
|
||||
|
||||
// examine default dirs
|
||||
#ifdef DEFAULTWADLOCATION1
|
||||
@@ -2884,16 +2850,7 @@ static const char *locateWad(void)
|
||||
if (isWadPathOk(returnWadPath))
|
||||
return returnWadPath;
|
||||
#endif
|
||||
-#ifndef NOHOME
|
||||
- // find in $HOME
|
||||
- I_OutputMsg(",HOME");
|
||||
- if ((envstr = I_GetEnv("HOME")) != NULL)
|
||||
- {
|
||||
- WadPath = searchWad(envstr);
|
||||
- if (WadPath)
|
||||
- return WadPath;
|
||||
- }
|
||||
-#endif
|
||||
+
|
||||
#ifdef DEFAULTSEARCHPATH1
|
||||
// find in /usr/local
|
||||
I_OutputMsg(", in:"DEFAULTSEARCHPATH1);
|
|
@ -32158,6 +32158,8 @@ with pkgs;
|
|||
|
||||
springLobby = callPackage ../games/spring/springlobby.nix { };
|
||||
|
||||
srb2 = callPackage ../games/srb2 { };
|
||||
|
||||
ssl-cert-check = callPackage ../tools/admin/ssl-cert-check { };
|
||||
|
||||
stardust = callPackage ../games/stardust { };
|
||||
|
|
Loading…
Reference in a new issue