2021-09-18 10:52:07 +00:00
|
|
|
{ lib, stdenv, SDL, SDL2, fetchurl, gzip, libvorbis, libmad
|
|
|
|
, Cocoa, CoreAudio, CoreFoundation, IOKit, OpenGL
|
|
|
|
, copyDesktopItems, makeDesktopItem
|
|
|
|
, useSDL2 ? stdenv.isDarwin # TODO: CoreAudio fails to initialize with SDL 1.x for some reason.
|
|
|
|
}:
|
2021-07-03 03:11:41 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "quakespasm";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "0.94.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-09-18 10:52:07 +00:00
|
|
|
url = "mirror://sourceforge/quakespasm/quakespasm-${version}.tar.gz";
|
2022-08-12 12:06:08 +00:00
|
|
|
sha256 = "sha256-xkXG+PBCCM+vzSZESgP2kOsD0rSg6pRupJdH5Y+fc/4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = "${pname}-${version}/Quake";
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
patches = lib.optionals stdenv.isDarwin [
|
|
|
|
# Makes Darwin Makefile use system libraries instead of ones from app bundle
|
|
|
|
./quakespasm-darwin-makefile-improvements.patch
|
|
|
|
];
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
nativeBuildInputs = [ copyDesktopItems ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
2021-09-18 10:52:07 +00:00
|
|
|
gzip libvorbis libmad (if useSDL2 then SDL2 else SDL)
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
Cocoa CoreAudio IOKit OpenGL
|
|
|
|
] ++ lib.optionals (stdenv.isDarwin && useSDL2) [
|
|
|
|
CoreFoundation
|
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = [
|
|
|
|
"DO_USERDIRS=1"
|
|
|
|
# Makefile defaults, set here to enforce consistency on Darwin build
|
|
|
|
"USE_CODEC_WAVE=1"
|
|
|
|
"USE_CODEC_MP3=1"
|
|
|
|
"USE_CODEC_VORBIS=1"
|
|
|
|
"USE_CODEC_FLAC=0"
|
|
|
|
"USE_CODEC_OPUS=0"
|
|
|
|
"USE_CODEC_MIKMOD=0"
|
|
|
|
"USE_CODEC_UMX=0"
|
|
|
|
"MP3LIB=mad"
|
|
|
|
"VORBISLIB=vorbis"
|
|
|
|
] ++ lib.optionals useSDL2 [
|
|
|
|
"SDL_CONFIG=sdl2-config"
|
|
|
|
"USE_SDL2=1"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
makefile = if (stdenv.isDarwin) then "Makefile.darwin" else "Makefile";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
substituteInPlace Makefile --replace "/usr/local/games" "$out/bin"
|
2021-09-18 10:52:07 +00:00
|
|
|
substituteInPlace Makefile.darwin --replace "/usr/local/games" "$out/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Let's build app bundle
|
|
|
|
mkdir -p $out/Applications/Quake.app/Contents/MacOS
|
|
|
|
mkdir -p $out/Applications/Quake.app/Contents/Resources
|
|
|
|
cp ../MacOSX/Info.plist $out/Applications/Quake.app/Contents/
|
|
|
|
cp ../MacOSX/QuakeSpasm.icns $out/Applications/Quake.app/Contents/Resources/
|
|
|
|
cp -r ../MacOSX/English.lproj $out/Applications/Quake.app/Contents/Resources/
|
|
|
|
ln -sf $out/bin/quake $out/Applications/Quake.app/Contents/MacOS/quake
|
|
|
|
|
|
|
|
substituteInPlace $out/Applications/Quake.app/Contents/Info.plist \
|
|
|
|
--replace '>''${EXECUTABLE_NAME}' '>quake'
|
|
|
|
substituteInPlace $out/Applications/Quake.app/Contents/Info.plist \
|
|
|
|
--replace '>''${PRODUCT_NAME}' '>QuakeSpasm'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "quakespasm";
|
|
|
|
exec = "quake";
|
|
|
|
desktopName = "Quakespasm";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Game" ];
|
2021-08-08 23:34:03 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An engine for iD software's Quake";
|
|
|
|
homepage = "http://quakespasm.sourceforge.net/";
|
|
|
|
longDescription = ''
|
|
|
|
QuakeSpasm is a modern, cross-platform Quake 1 engine based on FitzQuake.
|
|
|
|
It includes support for 64 bit CPUs and custom music playback, a new sound driver,
|
|
|
|
some graphical niceities, and numerous bug-fixes and other improvements.
|
|
|
|
Quakespasm utilizes either the SDL or SDL2 frameworks, so choose which one
|
|
|
|
works best for you. SDL is probably less buggy, but SDL2 has nicer features
|
|
|
|
and smoother mouse input - though no CD support.
|
|
|
|
'';
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.unix;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ mikroskeem ];
|
2022-04-27 09:35:20 +00:00
|
|
|
mainProgram = "quake";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|