nixpkgs/pkgs/games/doom-ports/zandronum/alpha/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

129 lines
3.1 KiB
Nix

{
stdenv,
lib,
fetchhg,
cmake,
pkg-config,
makeWrapper,
callPackage,
soundfont-fluid,
SDL_compat,
libGL,
glew,
bzip2,
zlib,
libjpeg,
fluidsynth,
fmodex,
openssl,
gtk2,
python3,
game-music-emu,
serverOnly ? false,
}:
let
suffix = lib.optionalString serverOnly "-server";
fmod = fmodex; # fmodex is on nixpkgs now
sqlite = callPackage ../sqlite.nix { };
clientLibPath = lib.makeLibraryPath [ fluidsynth ];
in
stdenv.mkDerivation rec {
pname = "zandronum-alpha${suffix}";
version = "3.2-230709-1914";
src = fetchhg {
# expired ssl certificate
url = "http://hg.osdn.net/view/zandronum/zandronum-stable";
rev = "89bccf7127ba";
hash = "sha256-waD9hKk0A0zMPyqEvAKxaz2e2TBG2G0MJRrzjx1LyB0=";
};
# zandronum tries to download sqlite now when running cmake, don't let it
# it also needs the current mercurial revision info embedded in gitinfo.h
# otherwise, the client will fail to connect to servers because the
# protocol version doesn't match.
patches = [
./zan_configure_impurity.patch
./dont_update_gitinfo.patch
./add_gitinfo.patch
];
# I have no idea why would SDL and libjpeg be needed for the server part!
# But they are.
buildInputs =
[
openssl
bzip2
zlib
SDL_compat
libjpeg
sqlite
game-music-emu
]
++ lib.optionals (!serverOnly) [
libGL
glew
fmod
fluidsynth
gtk2
];
nativeBuildInputs = [
cmake
pkg-config
makeWrapper
python3
];
preConfigure =
''
ln -s ${sqlite}/* sqlite/
sed -ie 's| restrict| _restrict|g' dumb/include/dumb.h \
dumb/src/it/*.c
''
+ lib.optionalString (!serverOnly) ''
sed -i \
-e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
-e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
src/sound/music_fluidsynth_mididevice.cpp
'';
cmakeFlags = [
"-DFORCE_INTERNAL_GME=OFF"
] ++ (if serverOnly then [ "-DSERVERONLY=ON" ] else [ "-DFMOD_LIBRARY=${fmod}/lib/libfmodex.so" ]);
hardeningDisable = [ "format" ];
# Won't work well without C or en_US. Setting LANG might not be enough if the user is making use of LC_* so wrap with LC_ALL instead
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/lib/zandronum
cp zandronum${suffix} \
*.pk3 \
${lib.optionalString (!serverOnly) "liboutput_sdl.so"} \
$out/lib/zandronum
makeWrapper $out/lib/zandronum/zandronum${suffix} $out/bin/zandronum-alpha${suffix}
wrapProgram $out/bin/zandronum-alpha${suffix} \
--set LC_ALL="C"
'';
postFixup = lib.optionalString (!serverOnly) ''
patchelf --set-rpath $(patchelf --print-rpath $out/lib/zandronum/zandronum):$out/lib/zandronum:${clientLibPath} \
$out/lib/zandronum/zandronum
'';
passthru = {
inherit fmod sqlite;
};
meta = with lib; {
homepage = "https://zandronum.com/";
description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software";
maintainers = with maintainers; [ lassulus ];
license = licenses.sleepycat;
platforms = platforms.linux;
};
}