diff options
| author | Donovan Glover <donovan@dglover.co> | 2023-05-20 14:14:01 -0400 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2023-07-16 13:19:14 +0000 |
| commit | e840e0fc5a935252059a09d7b10d4ff4cd6ff919 (patch) | |
| tree | 6e14aac340be10ee7fe299637d8cb5d12432060f | |
| parent | nicotine-plus: 3.2.8 -> 3.2.9 (diff) | |
| download | nixpkgs-origin/backport-233085-to-release-23.05.tar.gz | |
srb2: 2.2.10 -> 2.2.11origin/backport-233085-to-release-23.05
Fixes #203224
Fixes #232984
Based on #187320
(cherry picked from commit 9258734d718d3416bbf958dfff4da28b66f474b2)
| -rw-r--r-- | pkgs/games/srb2/cmake.patch | 19 | ||||
| -rw-r--r-- | pkgs/games/srb2/default.nix | 92 | ||||
| -rw-r--r-- | pkgs/games/srb2/wadlocation.patch | 72 |
3 files changed, 76 insertions, 107 deletions
diff --git a/pkgs/games/srb2/cmake.patch b/pkgs/games/srb2/cmake.patch new file mode 100644 index 000000000000..adb070a13c19 --- /dev/null +++ b/pkgs/games/srb2/cmake.patch @@ -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 + diff --git a/pkgs/games/srb2/default.nix b/pkgs/games/srb2/default.nix index 26bc4eae96c9..4213039f8877 100644 --- a/pkgs/games/srb2/default.nix +++ b/pkgs/games/srb2/default.nix @@ -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 + + copyDesktopItems + + cp ../srb2.png $out/share/pixmaps/. + cp ../srb2.png $out/share/icons/. - postInstall = '' - mkdir $out/bin - mv $out/lsdlsrb2-${version} $out/bin/srb2 + 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 ]; }; -} +}) diff --git a/pkgs/games/srb2/wadlocation.patch b/pkgs/games/srb2/wadlocation.patch deleted file mode 100644 index ee3e1111e6f0..000000000000 --- a/pkgs/games/srb2/wadlocation.patch +++ /dev/null @@ -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); |
