zandronum: 2.1.2 -> 3.0

remove sqlite-amalgamation and put it internal to the zandronum folder,
as it is only used by zandronum. Patches needed to avoid build impurities
and to get the correct protocol version to connect to public servers.

remove zandronum_bin as it is no longer needed
This commit is contained in:
Cray Elliott 2017-09-15 11:23:26 -07:00
parent ae624c89c1
commit 990ea8789d
7 changed files with 123 additions and 109 deletions

View File

@ -0,0 +1,15 @@
diff -Naur blah/src/gitinfo.h blah2/src/gitinfo.h
--- blah/src/gitinfo.h 1969-12-31 16:00:00.000000000 -0800
+++ blah2/src/gitinfo.h 2017-09-15 01:44:43.953562714 -0700
@@ -0,0 +1,11 @@
+// dd3c3b57023f64cda84f09ed13e4c03a4ad2b920
+//
+// This file was automatically generated by the
+// updaterevision tool. Do not edit by hand.
+
+#define GIT_DESCRIPTION "ZA_3.0-0-dd3c3b57023f"
+#define GIT_HASH "dd3c3b57023f64cda84f09ed13e4c03a4ad2b920"
+#define GIT_TIME "2017-09-01 06:40:50 -0500"
+#define HG_REVISION_NUMBER 1504266050
+#define HG_REVISION_HASH_STRING "dd3c3b57023f"
+#define HG_TIME "170901-1140"

View File

@ -1,83 +0,0 @@
{ stdenv
, atk
, bzip2
, cairo
, fetchurl
, fluidsynth
, fontconfig
, freetype
, gdk_pixbuf
, glib
, gtk2
, libjpeg_turbo
, mesa_glu
, mesa_noglu
, openssl
, pango
, SDL
, zlib
, makeWrapper
}:
stdenv.mkDerivation rec {
name = "zandronum-2.1.2";
src = fetchurl {
url = "http://zandronum.com/downloads/zandronum2.1.2-linux-x86_64.tar.bz2";
sha256 = "1f5aw2m8c0bl3lrvi2k3rrzq3q9x1ikxnxxjgh3k9qvanfn7ykbk";
};
libPath = stdenv.lib.makeLibraryPath [
atk
bzip2
cairo
fluidsynth
fontconfig
freetype
gdk_pixbuf
glib
gtk2
libjpeg_turbo
mesa_glu
mesa_noglu
openssl
pango
SDL
stdenv.cc.cc
zlib
];
nativeBuildInputs = [ makeWrapper ];
phases = [ "unpackPhase" "installPhase" ];
sourceRoot = ".";
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/zandronum
cp *.so *.pk3 zandronum zandronum-server $out/share/zandronum
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath $libPath:$out/share/zandronum \
$out/share/zandronum/zandronum
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath $libPath \
$out/share/zandronum/zandronum-server
# If we don't set absolute argv0, zandronum.wad file is not found.
makeWrapper $out/share/zandronum/zandronum $out/bin/zandronum
makeWrapper $out/share/zandronum/zandronum-server $out/bin/zandronum-server
'';
meta = {
homepage = http://zandronum.com/;
description = "Multiplayer oriented port, based off Skulltag, for Doom and Doom II by id Software. Binary version for online play";
maintainers = [ stdenv.lib.maintainers.lassulus ];
# Binary version has different version string than source code version.
license = stdenv.lib.licenses.unfreeRedistributable;
platforms = [ "x86_64-linux" ];
};
}

View File

@ -1,31 +1,40 @@
{ stdenv, lib, fetchhg, cmake, pkgconfig, makeWrapper, callPackage
, soundfont-fluid, SDL, mesa, bzip2, zlib, libjpeg, fluidsynth, openssl, sqlite-amalgamation, gtk2
, soundfont-fluid, SDL, mesa, glew, bzip2, zlib, libjpeg, fluidsynth, openssl, gtk2, python3
, serverOnly ? false
}:
let
suffix = lib.optionalString serverOnly "-server";
fmod = callPackage ./fmod.nix { };
sqlite = callPackage ./sqlite.nix { };
# FIXME: drop binary package when upstream fixes their protocol versioning
in stdenv.mkDerivation {
name = "zandronum${suffix}-2.1.2";
name = "zandronum${suffix}-3.0";
src = fetchhg {
url = "https://bitbucket.org/Torr_Samaho/zandronum-stable";
rev = "a3663b0061d5";
sha256 = "0qwsnbwhcldwrirfk6hpiklmcj3a7dzh6pn36nizci6pcza07p56";
rev = "dd3c3b57023f";
sha256 = "1f8pd8d2zjwdp6v9anp9yrkdbfhd2mp7svmnna0jiqgxjw6wkyls";
};
# 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 ./add_gitinfo.patch ./dont_update_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 libjpeg ]
++ lib.optionals (!serverOnly) [ mesa fmod fluidsynth gtk2 ];
buildInputs = [ openssl bzip2 zlib SDL libjpeg sqlite ]
++ lib.optionals (!serverOnly) [ mesa glew fmod fluidsynth gtk2 ];
nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
nativeBuildInputs = [ cmake pkgconfig makeWrapper python3 ];
preConfigure = ''
ln -s ${sqlite-amalgamation}/* sqlite/
ln -s ${sqlite}/* sqlite/
sed -ie 's| restrict| _restrict|g' dumb/include/dumb.h \
dumb/src/it/*.c
'' + lib.optionalString serverOnly ''
@ -53,7 +62,7 @@ in stdenv.mkDerivation {
$out/lib/zandronum
# For some reason, while symlinks work for binary version, they don't for source one.
makeWrapper $out/lib/zandronum/zandronum${suffix} $out/bin/zandronum${suffix}
makeWrapper $out/lib/zandronum/zandronum${suffix} $out/bin/zandronum${suffix} --prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH:${fluidsynth}/lib"
'';
postFixup = lib.optionalString (!serverOnly) ''

View File

@ -0,0 +1,19 @@
diff -r dd3c3b57023f src/CMakeLists.txt
--- a/src/CMakeLists.txt Fri Sep 01 06:40:50 2017 -0500
+++ b/src/CMakeLists.txt Fri Sep 15 01:46:34 2017 -0700
@@ -636,15 +636,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

@ -1,27 +1,20 @@
{ lib, stdenv, fetchurl, unzip }:
stdenv.mkDerivation {
name = "sqlite-amalgamation-201505302257";
name = "sqlite-zandronum-3.0";
src = fetchurl {
url = "https://www.sqlite.org/snapshot/sqlite-amalgamation-201505302257.zip";
sha256 = "0488wjrpnxd61g7pcka6fckx0q8yl1k26i6q5hrmkm92qcpml76h";
url = "https://www.sqlite.org/2017/sqlite-autoconf-3180000.tar.gz";
sha256 = "0p5cx7nbjxk7glcm277ypi5w4gv144qazw79ql47svlpccj62mrp";
};
phases = [ "unpackPhase" "buildPhase" ];
buildInputs = [ unzip ];
unpackPhase = ''
unzip $src
'';
buildPhase = ''
mkdir -p $out
cp sqlite3.c $out/
cp sqlite3.h $out/
cp sqlite3ext.h $out/
cp shell.c $out/
'';
meta = {

View File

@ -0,0 +1,65 @@
diff -r 6d5130e4ae52 sqlite/CMakeLists.txt
--- a/sqlite/CMakeLists.txt Sun Sep 10 18:53:00 2017 +0200
+++ b/sqlite/CMakeLists.txt Fri Sep 15 00:12:11 2017 -0700
@@ -1,62 +1,5 @@
cmake_minimum_required( VERSION 2.4 )
-# [BB/EP] Download SQLite archive and extract the sources if necessary.
-set( ZAN_SQLITE_VERSION 3180000 ) # SQL version 3.18.0
-set( ZAN_SQLITE_YEAR 2017 )
-set( ZAN_SQLITE_SHA1 "74559194e1dd9b9d577cac001c0e9d370856671b" )
-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 ${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()
-
- message( STATUS "SQLite: saving the source files into the 'sqlite' directory." )
-
- # Rename the archive.
- execute_process( COMMAND ${CMAKE_COMMAND} -E rename ${ZAN_SQLITE_TEMP_ARCHIVE} ${ZAN_SQLITE_HASHED_ARCHIVE} )
-
- # 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()
-
add_library( sqlite3 sqlite3.c )
target_link_libraries( sqlite3 ${CMAKE_DL_LIBS} )

View File

@ -3795,6 +3795,8 @@ with pkgs;
pdf2svg = callPackage ../tools/graphics/pdf2svg { };
fmodex = callPackage ../games/zandronum/fmod.nix { };
pdfmod = callPackage ../applications/misc/pdfmod { };
jbig2enc = callPackage ../tools/graphics/jbig2enc { };
@ -10484,8 +10486,6 @@ with pkgs;
sqlite3_analyzer = lowPrio (callPackage ../development/libraries/sqlite/sqlite3_analyzer.nix { });
sqlite-amalgamation = callPackage ../development/libraries/sqlite-amalgamation { };
sqlite-interactive = appendToName "interactive" (sqlite.override { interactive = true; }).bin;
sqlcipher = lowPrio (callPackage ../development/libraries/sqlcipher {
@ -17830,16 +17830,12 @@ with pkgs;
xsokoban = callPackage ../games/xsokoban { };
zandronum = callPackage ../games/zandronum {
cmake = cmake_2_8;
};
zandronum = callPackage ../games/zandronum { };
zandronum-server = zandronum.override {
serverOnly = true;
};
zandronum-bin = hiPrio (callPackage ../games/zandronum/bin.nix { });
zangband = callPackage ../games/zangband { };
zdbsp = callPackage ../games/zdoom/zdbsp.nix { };