2024-01-13 08:15:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, curl
|
|
|
|
, libGL
|
|
|
|
, libX11
|
|
|
|
, libXxf86dga
|
|
|
|
, alsa-lib
|
|
|
|
, libXrandr
|
|
|
|
, libXxf86vm
|
|
|
|
, libXext
|
|
|
|
, SDL2
|
|
|
|
, glibc
|
|
|
|
, copyDesktopItems
|
|
|
|
, makeDesktopItem
|
2022-04-27 09:35:20 +00:00
|
|
|
}:
|
2024-06-20 14:57:18 +00:00
|
|
|
let
|
|
|
|
arch =
|
|
|
|
/**/ if stdenv.hostPlatform.isx86_64 then "x64"
|
|
|
|
else stdenv.hostPlatform.parsed.cpu.name;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "Quake3e";
|
2022-04-27 09:35:20 +00:00
|
|
|
version = "2022-04-01-dev";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ec-";
|
|
|
|
repo = pname;
|
2022-04-27 09:35:20 +00:00
|
|
|
rev = "c6cec00b858aa5955eb1d6eb65b9bfd41fd869cb";
|
|
|
|
sha256 = "0qd13fndbhgkkmhxbprpzmj2l2v9ihacxagpdqi9sg9nrzvahr9h";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper copyDesktopItems ];
|
2022-04-27 09:35:20 +00:00
|
|
|
buildInputs = [ curl libGL libX11 libXxf86dga alsa-lib libXrandr libXxf86vm libXext SDL2 glibc ];
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2";
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e 's#OpenGLLib = dlopen( dllname#OpenGLLib = dlopen( "${libGL}/lib/libGL.so"#' code/unix/linux_qgl.c
|
2022-04-27 09:35:20 +00:00
|
|
|
sed -i -e 's#Sys_LoadLibrary( "libpthread.so.0" )#Sys_LoadLibrary( "${glibc}/lib/libpthread.so.0" )#' code/unix/linux_snd.c
|
2021-06-28 23:13:55 +00:00
|
|
|
sed -i -e 's#Sys_LoadLibrary( "libasound.so.2" )#Sys_LoadLibrary( "${alsa-lib}/lib/libasound.so.2" )#' code/unix/linux_snd.c
|
2022-04-27 09:35:20 +00:00
|
|
|
sed -i -e 's#Sys_LoadLibrary( "libXxf86dga.so.1" )#Sys_LoadLibrary( "${libXxf86dga}/lib/libXxf86dga.so.1" )#' code/unix/x11_dga.c
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i -e 's#Sys_LoadLibrary( "libXrandr.so.2" )#Sys_LoadLibrary( "${libXrandr}/lib/libXrandr.so.2" )#' code/unix/x11_randr.c
|
|
|
|
sed -i -e 's#Sys_LoadLibrary( "libXxf86vm.so.1" )#Sys_LoadLibrary( "${libXxf86vm}/lib/libXxf86vm.so.1" )#' code/unix/x11_randr.c
|
2022-04-27 09:35:20 +00:00
|
|
|
sed -i -e 's#Sys_LoadLibrary( "libXxf86vm.so.1" )#Sys_LoadLibrary( "${libXxf86vm}/lib/libXxf86vm.so.1" )#' code/unix/x11_vidmode.c
|
2021-12-06 16:07:01 +00:00
|
|
|
sed -i -e 's#"libcurl.so.4"#"${curl.out}/lib/libcurl.so.4"#' code/client/cl_curl.h
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# Default value for `USE_SDL` changed (from 0 to 1) in 5f8ce6d (2020-12-26)
|
|
|
|
# Setting `USE_SDL=0` in `makeFlags` doesn't work
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i 's/USE_SDL *= 1/USE_SDL = 0/' Makefile
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2024-01-13 08:15:51 +00:00
|
|
|
runHook preInstall
|
2022-04-27 09:35:20 +00:00
|
|
|
make install DESTDIR=$out/lib
|
2024-06-20 14:57:18 +00:00
|
|
|
makeWrapper $out/lib/quake3e.${arch} $out/bin/quake3e
|
|
|
|
makeWrapper $out/lib/quake3e.ded.${arch} $out/bin/quake3e.ded
|
2024-01-13 08:15:51 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "Quake3e";
|
|
|
|
exec = "quake3e";
|
|
|
|
desktopName = "Quake3e";
|
|
|
|
categories = [ "Game" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/ec-/Quake3e";
|
|
|
|
description = "Improved Quake III Arena engine";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ pmiddend ];
|
|
|
|
};
|
|
|
|
}
|