2020-11-26 22:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, curl
|
|
|
|
, nasm
|
2022-06-13 23:42:58 +00:00
|
|
|
, libopenmpt
|
2020-11-26 22:08:51 +00:00
|
|
|
, p7zip
|
2022-07-20 14:18:25 +00:00
|
|
|
, game-music-emu
|
2020-11-26 22:08:51 +00:00
|
|
|
, libpng
|
|
|
|
, SDL2
|
|
|
|
, SDL2_mixer
|
|
|
|
, zlib
|
2023-05-20 18:14:01 +00:00
|
|
|
, unzip
|
|
|
|
, makeWrapper
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
2020-11-26 22:08:51 +00:00
|
|
|
}:
|
|
|
|
|
2023-05-20 18:14:01 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-11-26 22:08:51 +00:00
|
|
|
pname = "srb2";
|
2023-09-13 13:28:07 +00:00
|
|
|
version = "2.2.13";
|
2020-11-26 22:08:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "STJr";
|
|
|
|
repo = "SRB2";
|
2023-05-20 18:14:01 +00:00
|
|
|
rev = "SRB2_release_${finalAttrs.version}";
|
2023-09-13 13:28:07 +00:00
|
|
|
hash = "sha256-OSkkjCz7ZW5+0vh6l7+TpnHLzXmd/5QvTidRQSHJYX8=";
|
2020-11-26 22:08:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
nasm
|
|
|
|
p7zip
|
2023-05-20 18:14:01 +00:00
|
|
|
makeWrapper
|
|
|
|
copyDesktopItems
|
2020-11-26 22:08:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
2022-07-20 14:18:25 +00:00
|
|
|
game-music-emu
|
2020-11-26 22:08:51 +00:00
|
|
|
libpng
|
2022-06-13 23:42:58 +00:00
|
|
|
libopenmpt
|
2020-11-26 22:08:51 +00:00
|
|
|
SDL2
|
|
|
|
SDL2_mixer
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
2023-05-20 18:14:01 +00:00
|
|
|
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";
|
2023-09-13 13:28:07 +00:00
|
|
|
hash = "sha256-g7kaNRE1tjcF5J2v+kTnrDzz4zs5f1b/NH67ce2ifUo=";
|
2023-05-20 18:14:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/share/srb2
|
|
|
|
cp -r *pk3 *dta *dat models/ $out/share/srb2/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-11-26 22:08:51 +00:00
|
|
|
cmakeFlags = [
|
2023-05-20 18:14:01 +00:00
|
|
|
"-DSRB2_ASSET_DIRECTORY=${finalAttrs.assets}/share/srb2"
|
2022-07-20 14:18:25 +00:00
|
|
|
"-DGME_INCLUDE_DIR=${game-music-emu}/include"
|
2022-06-13 23:42:58 +00:00
|
|
|
"-DOPENMPT_INCLUDE_DIR=${libopenmpt.dev}/include"
|
2022-09-18 10:48:40 +00:00
|
|
|
"-DSDL2_MIXER_INCLUDE_DIR=${lib.getDev SDL2_mixer}/include/SDL2"
|
2023-05-20 18:14:01 +00:00
|
|
|
"-DSDL2_INCLUDE_DIR=${lib.getDev SDL2.dev}/include/SDL2"
|
2020-11-26 22:08:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
patches = [
|
2023-09-13 13:28:07 +00:00
|
|
|
# Make the build work without internet connectivity
|
|
|
|
# See: https://build.opensuse.org/request/show/1109889
|
2023-05-20 18:14:01 +00:00
|
|
|
./cmake.patch
|
2023-09-13 13:28:07 +00:00
|
|
|
./thirdparty.patch
|
2020-11-26 22:08:51 +00:00
|
|
|
];
|
|
|
|
|
2023-05-20 18:14:01 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem rec {
|
|
|
|
name = "Sonic Robo Blast 2";
|
|
|
|
exec = finalAttrs.pname;
|
|
|
|
icon = finalAttrs.pname;
|
|
|
|
comment = finalAttrs.meta.description;
|
|
|
|
desktopName = name;
|
|
|
|
genericName = name;
|
|
|
|
categories = [ "Game" ];
|
|
|
|
})
|
|
|
|
];
|
2020-11-26 22:08:51 +00:00
|
|
|
|
2023-05-20 18:14:01 +00:00
|
|
|
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/.
|
2020-11-26 22:08:51 +00:00
|
|
|
|
2023-05-20 18:14:01 +00:00
|
|
|
cp bin/lsdlsrb2 $out/bin/srb2
|
|
|
|
wrapProgram $out/bin/srb2 --set SRB2WADDIR "${finalAttrs.assets}/share/srb2"
|
2020-11-26 22:08:51 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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;
|
2023-05-20 18:14:01 +00:00
|
|
|
maintainers = with maintainers; [ zeratax donovanglover ];
|
2023-09-13 13:28:07 +00:00
|
|
|
mainProgram = "srb2";
|
2020-11-26 22:08:51 +00:00
|
|
|
};
|
2023-05-20 18:14:01 +00:00
|
|
|
})
|