zandronum-alpha: init at 3.2-230709-1914

new file:   pkgs/games/doom-ports/zandronum/alpha/add_gitinfo.patch
	new file:   pkgs/games/doom-ports/zandronum/alpha/default.nix
	new file:   pkgs/games/doom-ports/zandronum/alpha/dont_update_gitinfo.patch
	new file:   pkgs/games/doom-ports/zandronum/alpha/zan_configure_impurity.patch
	modified:   pkgs/top-level/all-packages.nix
This commit is contained in:
souxd 2023-12-01 14:59:56 -03:00
parent f5c27c6136
commit 125fc57962
5 changed files with 212 additions and 0 deletions

View File

@ -0,0 +1,15 @@
diff -r 89bccf7127ba src/gitinfo.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gitinfo.h Fri Dec 01 10:18:23 2023 -0300
@@ -0,0 +1,11 @@
+// 89bccf7127ba1ebe92558f674be69549bf2c4bd4
+//
+// This file was automatically generated by the
+// updaterevision tool. Do not edit by hand.
+
+#define GIT_DESCRIPTION "ZA_3.1-404-89bccf7127ba"
+#define GIT_HASH "89bccf7127ba1ebe92558f674be69549bf2c4bd4"
+#define GIT_TIME "2023-07-09 15:14:38 -0400"
+#define HG_REVISION_NUMBER 1688930078
+#define HG_REVISION_HASH_STRING "89bccf7127ba"
+#define HG_TIME "230709-1914"

View File

@ -0,0 +1,103 @@
{ 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 MP2E ];
license = licenses.sleepycat;
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,19 @@
diff -r 89bccf7127ba src/CMakeLists.txt
--- a/src/CMakeLists.txt Sun Jul 09 15:14:38 2023 -0400
+++ b/src/CMakeLists.txt Fri Dec 01 10:16:26 2023 -0300
@@ -642,15 +642,6 @@
add_definitions( -DBACKPATCH )
endif( BACKPATCH )
-# Update gitinfo.h
-
-get_target_property( UPDATEREVISION_EXE updaterevision LOCATION )
-
-add_custom_target( revision_check ALL
- COMMAND ${UPDATEREVISION_EXE} src/gitinfo.h
- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- DEPENDS updaterevision )
-
# Libraries ZDoom needs
message( STATUS "Fluid synth libs: ${FLUIDSYNTH_LIBRARIES}" )

View File

@ -0,0 +1,69 @@
diff -r 89bccf7127ba sqlite/CMakeLists.txt
--- a/sqlite/CMakeLists.txt Sun Jul 09 15:14:38 2023 -0400
+++ b/sqlite/CMakeLists.txt Fri Dec 01 10:10:35 2023 -0300
@@ -1,65 +1,5 @@
cmake_minimum_required( VERSION 2.4 )
-# [BB/EP] Download SQLite archive and extract the sources if necessary.
-set( ZAN_SQLITE_VERSION 3360000 ) # SQL version 3.36.0
-set( ZAN_SQLITE_YEAR 2021 )
-set( ZAN_SQLITE_SHA1 "a4bcf9e951bfb9745214241ba08476299fc2dc1e" )
-set( ZAN_SQLITE_DOWNLOAD_NAME "sqlite-autoconf-${ZAN_SQLITE_VERSION}" )
-set( ZAN_SQLITE_TEMP_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz" )
-set( ZAN_SQLITE_HASHED_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/sqlite-${ZAN_SQLITE_SHA1}.tar.gz" )
-
-if( IS_DIRECTORY ${ZAN_SQLITE_HASHED_ARCHIVE} OR IS_SYMLINK ${ZAN_SQLITE_HASHED_ARCHIVE} )
- message( FATAL_ERROR "SQLite: ${ZAN_SQLITE_HASHED_ARCHIVE} must be a valid file.\n"
- "SQLite: Please remove it and try again." )
-elseif( ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sqlite3.c ) OR ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sqlite3.h ) OR ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sqlite3ext.h ) )
-
- if( NOT EXISTS ${ZAN_SQLITE_HASHED_ARCHIVE} )
- if( IS_DIRECTORY ${ZAN_SQLITE_TEMP_ARCHIVE} OR IS_SYMLINK ${ZAN_SQLITE_TEMP_ARCHIVE} )
- message( FATAL_ERROR "SQLite: ${ZAN_SQLITE_TEMP_ARCHIVE} must be a valid file.\n"
- "SQLite: Please remove it and try again." )
- endif()
-
- message( STATUS "SQLite: downloading the archive..." )
-
- file( DOWNLOAD https://www.sqlite.org/${ZAN_SQLITE_YEAR}/${ZAN_SQLITE_DOWNLOAD_NAME}.tar.gz ${ZAN_SQLITE_TEMP_ARCHIVE}
- SHOW_PROGRESS
- STATUS ZAN_SQLITE_DOWNLOAD_STATUS )
-
- # Report any problem if present and abort immediately.
- list( GET ZAN_SQLITE_DOWNLOAD_STATUS 0 ZAN_SQLITE_DOWNLOAD_ERROR_CODE )
- if( ZAN_SQLITE_DOWNLOAD_ERROR_CODE )
- list( GET ZAN_SQLITE_DOWNLOAD_STATUS 1 ZAN_SQLITE_DOWNLOAD_ERROR_MESSAGE )
- message( FATAL_ERROR "SQLite: download failed. Reason: ${ZAN_SQLITE_DOWNLOAD_ERROR_MESSAGE}" )
- endif()
-
- # Check the hash. Abort immediately if it's not valid (something is wrong with the download)
- file( SHA1 ${ZAN_SQLITE_TEMP_ARCHIVE} ZAN_SQLITE_CURRENT_SHA1 )
- if( NOT ZAN_SQLITE_CURRENT_SHA1 STREQUAL ZAN_SQLITE_SHA1 )
- message( FATAL_ERROR "SQLite: download failed. The downloaded file has a different hash:\n"
- "SQLite: valid: ${ZAN_SQLITE_SHA1}\n"
- "SQLite: downloaded: ${ZAN_SQLITE_CURRENT_SHA1}" )
- endif()
-
- # Rename the archive.
- execute_process( COMMAND ${CMAKE_COMMAND} -E rename ${ZAN_SQLITE_TEMP_ARCHIVE} ${ZAN_SQLITE_HASHED_ARCHIVE} )
- endif()
-
- message( STATUS "SQLite: saving the source files into the 'sqlite' directory." )
-
- # Extract the archive.
- execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${ZAN_SQLITE_HASHED_ARCHIVE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
-
- # Copy the required files.
- execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3.c ${CMAKE_CURRENT_SOURCE_DIR} )
- execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3.h ${CMAKE_CURRENT_SOURCE_DIR} )
- execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME}/sqlite3ext.h ${CMAKE_CURRENT_SOURCE_DIR} )
-
- # Remove the extracted folder.
- execute_process( COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_SOURCE_DIR}/${ZAN_SQLITE_DOWNLOAD_NAME} )
-
- message( STATUS "SQLite: done." )
-endif()
-
# [BB] Silence all GCC warnings
IF ( CMAKE_COMPILER_IS_GNUCXX )
ADD_DEFINITIONS ( -w )

View File

@ -37430,6 +37430,12 @@ with pkgs;
serverOnly = true; serverOnly = true;
}; };
zandronum-alpha = callPackage ../games/doom-ports/zandronum/alpha { };
zandronum-alpha-server = zandronum-alpha.override {
serverOnly = true;
};
fmodex = callPackage ../games/doom-ports/zandronum/fmod.nix { }; fmodex = callPackage ../games/doom-ports/zandronum/fmod.nix { };
doom-bcc = callPackage ../games/doom-ports/zdoom/bcc-git.nix { }; doom-bcc = callPackage ../games/doom-ports/zdoom/bcc-git.nix { };