2021-05-15 23:36:46 +00:00
|
|
|
{ lib
|
|
|
|
, config
|
|
|
|
, fetchzip
|
|
|
|
, stdenv
|
|
|
|
, SDL
|
|
|
|
, SDL_image
|
|
|
|
, SDL_ttf
|
|
|
|
, SDL_mixer
|
|
|
|
, libmysqlclient
|
2022-10-14 03:59:59 +00:00
|
|
|
, wxGTK32
|
2021-05-15 23:36:46 +00:00
|
|
|
, symlinkJoin
|
|
|
|
, runCommandLocal
|
|
|
|
, makeWrapper
|
|
|
|
, coreutils
|
2021-05-18 21:54:55 +00:00
|
|
|
, scalingFactor ? 2 # this is to resize the fixed-size zod_launcher window
|
|
|
|
, substituteAll
|
2021-05-15 23:36:46 +00:00
|
|
|
}:
|
|
|
|
let
|
2021-06-22 21:44:58 +00:00
|
|
|
name = "zod-engine";
|
2021-05-15 23:36:46 +00:00
|
|
|
version = "2011-09-06";
|
|
|
|
src = fetchzip {
|
|
|
|
url = "mirror://sourceforge/zod/linux_releases/zod_linux-${version}.tar.gz";
|
|
|
|
sha256 = "017v96aflrv07g8j8zk9mq8f8rqxl5228rjff5blq8dxpsv1sx7h";
|
2011-03-28 16:08:29 +00:00
|
|
|
};
|
2023-02-05 17:34:47 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed '1i#include <ctime>' -i zod_src/common.cpp # gcc12
|
|
|
|
'';
|
2021-05-15 23:36:46 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
SDL
|
|
|
|
SDL_image
|
|
|
|
SDL_ttf
|
|
|
|
SDL_mixer
|
|
|
|
libmysqlclient
|
2022-10-14 03:59:59 +00:00
|
|
|
wxGTK32
|
2021-05-15 23:36:46 +00:00
|
|
|
coreutils
|
|
|
|
];
|
2017-10-12 19:07:41 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
2019-09-22 07:38:09 +00:00
|
|
|
NIX_LDFLAGS = "-L${libmysqlclient}/lib/mysql";
|
2021-05-15 23:36:46 +00:00
|
|
|
zod_engine = stdenv.mkDerivation {
|
2023-02-05 17:34:47 +00:00
|
|
|
inherit version src postPatch nativeBuildInputs buildInputs hardeningDisable NIX_LDFLAGS;
|
2021-05-15 23:36:46 +00:00
|
|
|
pname = "${name}-engine";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
preBuild = "cd zod_src";
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install -m755 zod $out/bin/
|
2022-03-14 18:06:00 +00:00
|
|
|
wrapProgram $out/bin/zod --chdir "${zod_assets}/usr/lib/commander-zod"
|
2021-05-15 23:36:46 +00:00
|
|
|
'';
|
2011-03-28 16:08:29 +00:00
|
|
|
};
|
2021-05-15 23:36:46 +00:00
|
|
|
zod_map_editor = stdenv.mkDerivation {
|
2023-02-05 17:34:47 +00:00
|
|
|
inherit version src postPatch nativeBuildInputs buildInputs hardeningDisable NIX_LDFLAGS;
|
2021-05-15 23:36:46 +00:00
|
|
|
pname = "${name}-map_editor";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
preBuild = "cd zod_src";
|
|
|
|
makeFlags = [ "map_editor" ];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install -m755 zod_map_editor $out/bin
|
2022-03-14 18:06:00 +00:00
|
|
|
wrapProgram $out/bin/zod_map_editor --chdir "${zod_assets}/usr/lib/commander-zod"
|
2021-05-15 23:36:46 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
zod_launcher = stdenv.mkDerivation {
|
2021-06-22 21:44:58 +00:00
|
|
|
inherit version src nativeBuildInputs buildInputs zod_engine zod_map_editor;
|
2021-05-15 23:36:46 +00:00
|
|
|
pname = "${name}-launcher";
|
|
|
|
# This is necessary because the zod_launcher has terrible fixed-width window
|
|
|
|
# the Idea is to apply the scalingFactor to all positions and sizes and I tested 1,2,3 and 4
|
|
|
|
# 2,3,4 look acceptable on my 4k monitor and 1 is unreadable.
|
|
|
|
# also the ./ in the run command is removed to have easier time starting the game
|
2021-05-18 21:54:55 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
inherit scalingFactor;
|
|
|
|
src=./0002-add-scaling-factor-to-source.patch;
|
|
|
|
})
|
|
|
|
];
|
2021-05-15 23:36:46 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace zod_launcher_src/zod_launcherFrm.cpp \
|
2022-10-14 03:59:59 +00:00
|
|
|
--replace 'message = wxT("./zod");' 'message = wxT("zod");' \
|
|
|
|
--replace "check.replace(i,1,1,'_');" "check.replace(i,1,1,(wxUniChar)'_');"
|
2021-05-15 23:36:46 +00:00
|
|
|
'';
|
|
|
|
preBuild = "cd zod_launcher_src";
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install -m755 zod_launcher $out/bin
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
zod_assets = runCommandLocal "${name}-assets" {} ''
|
|
|
|
mkdir -p $out/usr/lib/commander-zod{,blank_maps}
|
|
|
|
cp -r ${src}/assets $out/usr/lib/commander-zod/assets
|
|
|
|
for i in ${src}/*.map ${src}/*.txt; do
|
|
|
|
install -m644 $i $out/usr/lib/commander-zod
|
|
|
|
done
|
|
|
|
for map in ${src}/blank_maps/*; do
|
|
|
|
install -m644 $map $out/usr/lib/commander-zod/blank_maps
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
symlinkJoin {
|
|
|
|
inherit name;
|
|
|
|
paths = [
|
|
|
|
zod_engine
|
|
|
|
zod_launcher
|
|
|
|
zod_map_editor
|
|
|
|
zod_assets
|
|
|
|
];
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Multiplayer remake of ZED";
|
|
|
|
homepage = "http://zod.sourceforge.net/";
|
|
|
|
maintainers = with maintainers; [ zeri ];
|
|
|
|
license = licenses.gpl3Plus; /* Says the website */
|
2022-10-14 03:59:59 +00:00
|
|
|
platforms = platforms.linux;
|
2021-05-15 23:36:46 +00:00
|
|
|
};
|
|
|
|
}
|