mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
parent
963006aab3
commit
9258734d71
19
pkgs/games/srb2/cmake.patch
Normal file
19
pkgs/games/srb2/cmake.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 915912af5..f5c2cf9cc 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -91,11 +91,6 @@ if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL Windows)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
- CPMAddPackage(
|
||||
- NAME Ccache.cmake
|
||||
- GITHUB_REPOSITORY TheLartians/Ccache.cmake
|
||||
- VERSION 1.2
|
||||
- )
|
||||
endif()
|
||||
|
||||
# Dependencies
|
||||
--
|
||||
2.40.1
|
||||
|
@ -2,7 +2,6 @@
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, fetchFromGitHub
|
||||
, substituteAll
|
||||
, cmake
|
||||
, curl
|
||||
, nasm
|
||||
@ -13,37 +12,29 @@
|
||||
, SDL2
|
||||
, SDL2_mixer
|
||||
, zlib
|
||||
, unzip
|
||||
, makeWrapper
|
||||
, makeDesktopItem
|
||||
, copyDesktopItems
|
||||
}:
|
||||
|
||||
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 {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "srb2";
|
||||
version = "2.2.10";
|
||||
version = "2.2.11";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "STJr";
|
||||
repo = "SRB2";
|
||||
rev = "SRB2_release_${version}";
|
||||
sha256 = "03388n094d2yr5si6ngnggbqhm8b2l0s0qvfnkz49li9bd6a81gg";
|
||||
rev = "SRB2_release_${finalAttrs.version}";
|
||||
hash = "sha256-tyiXivJWjNnL+4YynUV6k6iaMs8o9HkHrp+qFj2+qvQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
nasm
|
||||
p7zip
|
||||
makeWrapper
|
||||
copyDesktopItems
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
@ -56,31 +47,62 @@ in stdenv.mkDerivation rec {
|
||||
zlib
|
||||
];
|
||||
|
||||
assets = stdenv.mkDerivation {
|
||||
pname = "srb2-data";
|
||||
version = finalAttrs.version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
unzip
|
||||
];
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/STJr/SRB2/releases/download/SRB2_release_${finalAttrs.version}/SRB2-v${lib.replaceStrings ["."] [""] finalAttrs.version}-Full.zip";
|
||||
hash = "sha256-KsJIkCczD/HyIwEy5dI3zsHbWFCMBaCoCHizfupFoWM=";
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/srb2
|
||||
cp -r *pk3 *dta *dat models/ $out/share/srb2/
|
||||
'';
|
||||
};
|
||||
|
||||
cmakeFlags = [
|
||||
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
|
||||
"-DSRB2_ASSET_DIRECTORY=${finalAttrs.assets}/share/srb2"
|
||||
"-DGME_INCLUDE_DIR=${game-music-emu}/include"
|
||||
"-DOPENMPT_INCLUDE_DIR=${libopenmpt.dev}/include"
|
||||
"-DSDL2_MIXER_INCLUDE_DIR=${lib.getDev SDL2_mixer}/include/SDL2"
|
||||
"-DSDL2_INCLUDE_DIR=${lib.getDev SDL2}/include/SDL2"
|
||||
"-DSDL2_INCLUDE_DIR=${lib.getDev SDL2.dev}/include/SDL2"
|
||||
];
|
||||
|
||||
patches = [
|
||||
./wadlocation.patch
|
||||
# Fix unknown command "CPMAddPackage" by not using Ccache.cmake
|
||||
./cmake.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/sdl/i_system.c \
|
||||
--replace '@wadlocation@' $out
|
||||
'';
|
||||
desktopItems = [
|
||||
(makeDesktopItem rec {
|
||||
name = "Sonic Robo Blast 2";
|
||||
exec = finalAttrs.pname;
|
||||
icon = finalAttrs.pname;
|
||||
comment = finalAttrs.meta.description;
|
||||
desktopName = name;
|
||||
genericName = name;
|
||||
categories = [ "Game" ];
|
||||
})
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
7z x ${assets} -o"/build/source/assets" -aos
|
||||
7z x ${assets_optional} -o"/build/source/assets" -aos
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin $out/share/applications $out/share/pixmaps $out/share/icons
|
||||
|
||||
postInstall = ''
|
||||
mkdir $out/bin
|
||||
mv $out/lsdlsrb2-${version} $out/bin/srb2
|
||||
copyDesktopItems
|
||||
|
||||
cp ../srb2.png $out/share/pixmaps/.
|
||||
cp ../srb2.png $out/share/icons/.
|
||||
|
||||
cp bin/lsdlsrb2 $out/bin/srb2
|
||||
wrapProgram $out/bin/srb2 --set SRB2WADDIR "${finalAttrs.assets}/share/srb2"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
@ -88,6 +110,6 @@ in stdenv.mkDerivation rec {
|
||||
homepage = "https://www.srb2.org/";
|
||||
platforms = platforms.linux;
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ zeratax ];
|
||||
maintainers = with maintainers; [ zeratax donovanglover ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -1,72 +0,0 @@
|
||||
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);
|
Loading…
Reference in New Issue
Block a user