Merge pull request #136192 from andir/xonotic

xonotic: support user statistics reporting
This commit is contained in:
Andreas Rammhold 2021-09-02 17:03:17 +02:00 committed by GitHub
commit f3e49a4ae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,8 @@
libX11, libGLU, libGL, libXpm, libXext, libXxf86vm, alsa-lib libX11, libGLU, libGL, libXpm, libXext, libXxf86vm, alsa-lib
, # sdl , # sdl
SDL2 SDL2
, # blind
gmp
, withSDL ? true , withSDL ? true
, withGLX ? false , withGLX ? false
@ -63,7 +65,7 @@ let
}; };
nativeBuildInputs = [ unzip ]; nativeBuildInputs = [ unzip ];
buildInputs = [ libjpeg zlib libvorbis curl ] buildInputs = [ libjpeg zlib libvorbis curl gmp ]
++ lib.optional withGLX [ libX11.dev libGLU.dev libGL.dev libXpm.dev libXext.dev libXxf86vm.dev alsa-lib.dev ] ++ lib.optional withGLX [ libX11.dev libGLU.dev libGL.dev libXpm.dev libXext.dev libXxf86vm.dev alsa-lib.dev ]
++ lib.optional withSDL [ SDL2.dev ]; ++ lib.optional withSDL [ SDL2.dev ];
@ -74,17 +76,27 @@ let
dontStrip = target != "release"; dontStrip = target != "release";
buildPhase = lib.optionalString withDedicated '' postConfigure = ''
pushd ../d0_blind_id
./configure $configureFlags
popd
'';
buildPhase = (lib.optionalString withDedicated ''
make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES sv-${target} make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES sv-${target}
'' + lib.optionalString withGLX '' '' + lib.optionalString withGLX ''
make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES cl-${target} make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES cl-${target}
'' + lib.optionalString withSDL '' '' + lib.optionalString withSDL ''
make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES sdl-${target} make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES sdl-${target}
'') + ''
pushd ../d0_blind_id
make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES
popd
''; '';
enableParallelBuilding = true; enableParallelBuilding = true;
installPhase = '' installPhase = (''
for size in 16x16 24x24 32x32 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512 1024x1024 scalable; do for size in 16x16 24x24 32x32 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512 1024x1024 scalable; do
install -Dm644 ../../misc/logos/xonotic_icon.svg \ install -Dm644 ../../misc/logos/xonotic_icon.svg \
$out/share/icons/hicolor/$size/xonotic.svg $out/share/icons/hicolor/$size/xonotic.svg
@ -95,6 +107,10 @@ let
install -Dm755 darkplaces-glx "$out/bin/xonotic-glx" install -Dm755 darkplaces-glx "$out/bin/xonotic-glx"
'' + lib.optionalString withSDL '' '' + lib.optionalString withSDL ''
install -Dm755 darkplaces-sdl "$out/bin/xonotic-sdl" install -Dm755 darkplaces-sdl "$out/bin/xonotic-sdl"
'') + ''
pushd ../d0_blind_id
make install
popd
''; '';
# Xonotic needs to find libcurl.so at runtime for map downloads # Xonotic needs to find libcurl.so at runtime for map downloads
@ -121,10 +137,10 @@ in rec {
xonotic-data = fetchzip { xonotic-data = fetchzip {
name = "xonotic-data"; name = "xonotic-data";
url = "https://dl.xonotic.org/xonotic-${version}.zip"; url = "https://dl.xonotic.org/xonotic-${version}.zip";
sha256 = "1ygkh0v68y4sd1w5vpk8dgb65h5jm599hwszdfgjp3ax4d3ml81x"; sha256 = "15caj11v9hhr7w55w3rs1rspblzr9lg1crqivbn9pyyq0rif8cpl";
extraPostFetch = '' extraPostFetch = ''
cd $out cd $out
rm -rf $(ls | grep -v "^data$") rm -rf $(ls | grep -v "^data$" | grep -v "^key_0.d0pk$")
''; '';
meta.hydraPlatforms = []; meta.hydraPlatforms = [];
passthru.version = version; passthru.version = version;
@ -156,7 +172,7 @@ in rec {
copyDesktopItems copyDesktopItems
'' + '' '' + ''
for binary in $out/bin/xonotic-*; do for binary in $out/bin/xonotic-*; do
wrapProgram $binary --add-flags "-basedir ${xonotic-data}" wrapProgram $binary --add-flags "-basedir ${xonotic-data}" --prefix LD_LIBRARY_PATH : "${xonotic-unwrapped}/lib"
done done
''); '');
} }