3
0
Fork 0
forked from mirrors/nixpkgs

srb2kart: init at 1.3.0

This commit is contained in:
Lluís Batlle i Rossell 2022-05-09 00:40:50 +02:00
parent e8e144a22a
commit a93a197fc9
3 changed files with 151 additions and 0 deletions

View file

@ -0,0 +1,88 @@
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, substituteAll
, cmake
, curl
, nasm
, unzip
, libgme
, libpng
, SDL2
, SDL2_mixer
, zlib
}:
let
release_tag = "v1.3";
installer = fetchurl {
url = "https://github.com/STJr/Kart-Public/releases/download/${release_tag}/srb2kart-v13-Installer.exe";
sha256 = "0bk36y7wf6xfdg6j0b8qvk8671hagikzdp5nlfqg478zrj0qf6cs";
};
in stdenv.mkDerivation rec {
pname = "srb2kart";
version = "1.3.0";
src = fetchFromGitHub {
owner = "STJr";
repo = "Kart-Public";
rev = release_tag;
sha256 = "131g9bmc9ihvz0klsc3yzd0pnkhx3mz1vzm8y7nrrsgdz5278y49";
};
nativeBuildInputs = [
cmake
nasm
unzip
];
buildInputs = [
curl
libgme
libpng
SDL2
SDL2_mixer
zlib
];
cmakeFlags = [
#"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
"-DGME_INCLUDE_DIR=${libgme}/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 = ''
mkdir assets/installer
pushd assets/installer
unzip ${installer} "*.kart" srb2.srb
popd
'';
postInstall = ''
mkdir -p $out/bin $out/share/games/SRB2Kart
mv $out/srb2kart* $out/bin/
mv $out/*.kart $out/share/games/SRB2Kart
'';
meta = with lib; {
description = "SRB2Kart is a classic styled kart racer";
homepage = "https://mb.srb2.org/threads/srb2kart.25868/";
platforms = platforms.linux;
license = licenses.gpl2Plus;
maintainers = with maintainers; [ viric ];
};
}

View file

@ -0,0 +1,61 @@
diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c
index 51f708d0..c4d971f7 100644
--- a/src/sdl/i_system.c
+++ b/src/sdl/i_system.c
@@ -139,7 +139,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
// Locations for searching the srb2.srb
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
-#define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2Kart"
+#define DEFAULTWADLOCATION1 "@wadlocation@"
#define DEFAULTWADLOCATION2 "/usr/local/games/SRB2Kart"
#define DEFAULTWADLOCATION3 "/usr/share/games/SRB2Kart"
#define DEFAULTWADLOCATION4 "/usr/games/SRB2Kart"
@@ -3646,47 +3646,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 DEFAULTDIR
- I_OutputMsg(",HOME/" DEFAULTDIR);
- // examine user jart directory
- if ((envstr = I_GetEnv("HOME")) != NULL)
- {
- sprintf(returnWadPath, "%s" PATHSEP DEFAULTDIR, envstr);
- if (isWadPathOk(returnWadPath))
- return returnWadPath;
- }
-#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
I_OutputMsg(","DEFAULTWADLOCATION1);

View file

@ -32160,6 +32160,8 @@ with pkgs;
srb2 = callPackage ../games/srb2 { };
srb2kart = callPackage ../games/srb2kart { };
ssl-cert-check = callPackage ../tools/admin/ssl-cert-check { };
stardust = callPackage ../games/stardust { };