srb2: 2.2.10 -> 2.2.11

Note that the cmake patch reverts the following commit:
036d5cce40
This commit is contained in:
Donovan Glover 2023-05-20 10:47:12 -04:00
parent 908a1c922f
commit 0cc159ab8e
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 71 additions and 36 deletions

View File

@ -0,0 +1,61 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 915912af5..9deb22a2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,26 +76,16 @@ option(SRB2_CONFIG_ZDEBUG "Compile with ZDEBUG defined." OFF)
option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF)
set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.")
-# Enable CCache
-# (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options)
-if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL Windows)
- option(USE_CCACHE "Enable ccache support" OFF)
-
- if(USE_CCACHE)
- find_program(CCACHE_TOOL_PATH ccache)
- if(CCACHE_TOOL_PATH)
- set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
- set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
- else()
- message(WARNING "USE_CCACHE was set but ccache is not found (set CCACHE_TOOL_PATH)")
- endif()
+# Enable CCache early
+set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache")
+if (${SRB2_USE_CCACHE})
+ find_program(CCACHE_PROGRAM ccache)
+ if(CCACHE_PROGRAM)
+ message(STATUS "Found CCache: ${CCACHE_PROGRAM}")
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
+ else()
+ message(WARNING "You have specified to use CCACHE but it was not found. Object files will not be cached.")
endif()
-else()
- CPMAddPackage(
- NAME Ccache.cmake
- GITHUB_REPOSITORY TheLartians/Ccache.cmake
- VERSION 1.2
- )
endif()
# Dependencies
diff --git a/cmake/launch-c.in b/cmake/launch-c.in
new file mode 100644
index 000000000..c60558232
--- /dev/null
+++ b/cmake/launch-c.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+export CCACHE_CPP2=true
+exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"
diff --git a/cmake/launch-cxx.in b/cmake/launch-cxx.in
new file mode 100644
index 000000000..c60558232
--- /dev/null
+++ b/cmake/launch-cxx.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+export CCACHE_CPP2=true
+exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"
--
2.40.1

View File

@ -2,7 +2,6 @@
, stdenv
, fetchurl
, fetchFromGitHub
, substituteAll
, cmake
, curl
, nasm
@ -17,12 +16,11 @@
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, customAssets ? false
}:
let
version = "2.2.10";
version = "2.2.11";
# Normal assets found on the official release
assets = stdenv.mkDerivation rec {
@ -31,7 +29,7 @@ let
nativeBuildInputs = [ unzip ];
src = fetchurl {
url = "https://github.com/STJr/SRB2/releases/download/SRB2_release_${version}/SRB2-v${lib.replaceStrings ["."] [""] version}-Full.zip";
sha256 = "sha256-5prFysyG+F7quhRkSjfK2TL31wMbZniS0vm6m/tDfSU=";
sha256 = "sha256-KsJIkCczD/HyIwEy5dI3zsHbWFCMBaCoCHizfupFoWM=";
};
sourceRoot = ".";
installPhase = ''
@ -40,44 +38,16 @@ let
'';
};
# Custom assets from mazmazz
mazmazzAssets = stdenv.mkDerivation rec {
pname = "srb2-mazmazz-data";
version = "2.2.5";
nativeBuildInputs = [ p7zip ];
unpackPhase = let
mazmazzAssetsPacks = {
main = fetchurl {
url = "https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/srb2-${version}-assets.7z";
sha256 = "1m9xf3vraq9nipsi09cyvvfa4i37gzfxg970rnqfswd86z9v6v00";
};
optional = fetchurl {
url = "https://github.com/mazmazz/SRB2/releases/download/SRB2_assets_220/srb2-${version}-optional-assets.7z";
sha256 = "1j29jrd0r1k2bb11wyyl6yv9b90s2i6jhrslnh77qkrhrwnwcdz4";
};
};
in ''
7z x "${mazmazzAssetsPacks.main}"
7z x "${mazmazzAssetsPacks.optional}"
'';
installPhase = ''
mkdir -p $out/share/srb2
cp -r * $out/share/srb2
'';
};
in stdenv.mkDerivation rec {
pname = "srb2";
inherit version;
chosenAsset = if customAssets then mazmazzAssets else assets;
src = fetchFromGitHub {
owner = "STJr";
repo = "SRB2";
rev = "SRB2_release_${version}";
sha256 = "03388n094d2yr5si6ngnggbqhm8b2l0s0qvfnkz49li9bd6a81gg";
sha256 = "sha256-tyiXivJWjNnL+4YynUV6k6iaMs8o9HkHrp+qFj2+qvQ=";
};
nativeBuildInputs = [
@ -99,13 +69,17 @@ in stdenv.mkDerivation rec {
];
cmakeFlags = [
"-DSRB2_ASSET_DIRECTORY=${chosenAsset}/share/srb2"
"-DSRB2_ASSET_DIRECTORY=${assets}/share/srb2"
"-DGME_INCLUDE_DIR=${libgme}/include"
"-DOPENMPT_INCLUDE_DIR=${libopenmpt.dev}/include"
"-DSDL2_MIXER_INCLUDE_DIR=${lib.getDev SDL2_mixer}/include/SDL2"
"-DSDL2_INCLUDE_DIR=${lib.getDev SDL2.dev}/include/SDL2"
];
patches = [
./cmake.patch
];
# Desktop icon
desktopItems = [
(makeDesktopItem rec {
@ -127,8 +101,8 @@ in stdenv.mkDerivation rec {
cp ../srb2.png $out/share/pixmaps/.
cp ../srb2.png $out/share/icons/.
cp bin/lsdlsrb2-${version} $out/bin/srb2
wrapProgram $out/bin/srb2 --set SRB2WADDIR "${chosenAsset}/share/srb2"
cp bin/lsdlsrb2 $out/bin/srb2
wrapProgram $out/bin/srb2 --set SRB2WADDIR "${assets}/share/srb2"
'';
meta = with lib; {