2022-08-07 16:49:55 +00:00
|
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
stdenv,
|
|
|
|
|
SDL,
|
|
|
|
|
SDL2,
|
|
|
|
|
fetchurl,
|
|
|
|
|
gzip,
|
|
|
|
|
libvorbis,
|
|
|
|
|
libmad,
|
|
|
|
|
flac,
|
|
|
|
|
libopus,
|
|
|
|
|
opusfile,
|
|
|
|
|
libogg,
|
|
|
|
|
libxmp,
|
2021-06-29 19:29:58 +00:00
|
|
|
|
Cocoa,
|
|
|
|
|
CoreAudio,
|
|
|
|
|
CoreFoundation,
|
|
|
|
|
IOKit,
|
|
|
|
|
OpenGL,
|
2022-08-07 16:49:55 +00:00
|
|
|
|
copyDesktopItems,
|
|
|
|
|
makeDesktopItem,
|
|
|
|
|
pkg-config,
|
2021-06-29 19:29:58 +00:00
|
|
|
|
useSDL2 ? stdenv.hostPlatform.isDarwin, # TODO: CoreAudio fails to initialize with SDL 1.x for some reason.
|
|
|
|
|
}:
|
2021-06-29 23:01:13 +00:00
|
|
|
|
|
2017-04-23 20:22:44 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
|
pname = "quakespasm";
|
2024-08-05 01:42:24 +00:00
|
|
|
|
version = "0.96.3";
|
2017-04-23 20:22:44 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-09-12 11:13:31 +00:00
|
|
|
|
url = "mirror://sourceforge/quakespasm/quakespasm-${version}.tar.gz";
|
2024-08-05 01:42:24 +00:00
|
|
|
|
sha256 = "sha256-tXjWzkpPf04mokRY8YxLzI04VK5iUuuZgu6B2V5QGA4=";
|
2017-04-23 20:22:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
2019-08-15 12:41:18 +00:00
|
|
|
|
sourceRoot = "${pname}-${version}/Quake";
|
2018-04-14 20:51:41 +00:00
|
|
|
|
|
2021-06-29 19:29:58 +00:00
|
|
|
|
patches = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
|
# Makes Darwin Makefile use system libraries instead of ones from app bundle
|
|
|
|
|
./quakespasm-darwin-makefile-improvements.patch
|
|
|
|
|
];
|
|
|
|
|
|
2024-09-10 22:15:50 +00:00
|
|
|
|
# Quakespasm tries to set a 10.6 deployment target, but that’s too low for SDL2.
|
|
|
|
|
postPatch = ''
|
|
|
|
|
sed -i Makefile.darwin -e '/-mmacosx-version-min/d'
|
|
|
|
|
'';
|
|
|
|
|
|
2022-08-07 16:49:55 +00:00
|
|
|
|
nativeBuildInputs = [
|
|
|
|
|
copyDesktopItems
|
|
|
|
|
pkg-config
|
|
|
|
|
];
|
|
|
|
|
|
2017-04-23 20:22:44 +00:00
|
|
|
|
buildInputs =
|
|
|
|
|
[
|
2022-08-07 16:49:55 +00:00
|
|
|
|
gzip
|
|
|
|
|
libvorbis
|
|
|
|
|
libmad
|
|
|
|
|
flac
|
|
|
|
|
libopus
|
|
|
|
|
opusfile
|
|
|
|
|
libogg
|
|
|
|
|
libxmp
|
|
|
|
|
(if useSDL2 then SDL2 else SDL)
|
2021-06-29 19:29:58 +00:00
|
|
|
|
]
|
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
|
Cocoa
|
|
|
|
|
CoreAudio
|
|
|
|
|
IOKit
|
|
|
|
|
OpenGL
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals (stdenv.hostPlatform.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"
|
2022-08-07 16:49:55 +00:00
|
|
|
|
"USE_CODEC_FLAC=1"
|
|
|
|
|
"USE_CODEC_OPUS=1"
|
2021-06-29 19:29:58 +00:00
|
|
|
|
"USE_CODEC_MIKMOD=0"
|
|
|
|
|
"USE_CODEC_UMX=0"
|
2022-08-07 16:49:55 +00:00
|
|
|
|
"USE_CODEC_XMP=1"
|
2021-06-29 19:29:58 +00:00
|
|
|
|
"MP3LIB=mad"
|
|
|
|
|
"VORBISLIB=vorbis"
|
|
|
|
|
]
|
|
|
|
|
++ lib.optionals useSDL2 [
|
|
|
|
|
"SDL_CONFIG=sdl2-config"
|
|
|
|
|
"USE_SDL2=1"
|
2017-04-23 20:22:44 +00:00
|
|
|
|
];
|
|
|
|
|
|
2021-06-29 19:29:58 +00:00
|
|
|
|
makefile = if (stdenv.hostPlatform.isDarwin) then "Makefile.darwin" else "Makefile";
|
2018-04-14 20:51:41 +00:00
|
|
|
|
|
2017-04-23 20:22:44 +00:00
|
|
|
|
preInstall = ''
|
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
|
substituteInPlace Makefile --replace "/usr/local/games" "$out/bin"
|
2021-06-29 19:29:58 +00:00
|
|
|
|
substituteInPlace Makefile.darwin --replace "/usr/local/games" "$out/bin"
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.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'
|
2017-04-23 20:22:44 +00:00
|
|
|
|
'';
|
2017-04-23 20:24:15 +00:00
|
|
|
|
|
2017-04-23 20:22:44 +00:00
|
|
|
|
enableParallelBuilding = true;
|
2018-04-14 20:51:41 +00:00
|
|
|
|
|
2021-08-05 22:04:17 +00:00
|
|
|
|
desktopItems = [
|
|
|
|
|
(makeDesktopItem {
|
|
|
|
|
name = "quakespasm";
|
|
|
|
|
exec = "quake";
|
|
|
|
|
desktopName = "Quakespasm";
|
2022-02-22 14:56:15 +00:00
|
|
|
|
categories = [ "Game" ];
|
2021-08-05 22:04:17 +00:00
|
|
|
|
})
|
|
|
|
|
];
|
|
|
|
|
|
2021-06-29 23:01:13 +00:00
|
|
|
|
meta = with lib; {
|
2017-04-23 20:22:44 +00:00
|
|
|
|
description = "Engine for iD software's Quake";
|
2023-01-21 21:41:12 +00:00
|
|
|
|
homepage = "https://quakespasm.sourceforge.net/";
|
2017-04-23 20:22:44 +00:00
|
|
|
|
longDescription = ''
|
|
|
|
|
QuakeSpasm is a modern, cross-platform Quake 1 engine based on FitzQuake.
|
2018-04-14 20:51:41 +00:00
|
|
|
|
It includes support for 64 bit CPUs and custom music playback, a new sound driver,
|
2017-04-23 20:22:44 +00:00
|
|
|
|
some graphical niceities, and numerous bug-fixes and other improvements.
|
2018-04-14 20:51:41 +00:00
|
|
|
|
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
|
2017-04-23 20:22:44 +00:00
|
|
|
|
and smoother mouse input - though no CD support.
|
|
|
|
|
'';
|
2018-04-14 20:51:41 +00:00
|
|
|
|
|
2021-06-29 19:29:58 +00:00
|
|
|
|
platforms = platforms.unix;
|
2022-06-22 23:54:58 +00:00
|
|
|
|
maintainers = with maintainers; [ mikroskeem ];
|
2022-04-01 19:34:55 +00:00
|
|
|
|
mainProgram = "quake";
|
2017-04-23 20:22:44 +00:00
|
|
|
|
};
|
|
|
|
|
}
|