40 # You can find more instructions on how to build 0ad here:
41 # https://trac.wildfiregames.com/wiki/BuildInstructions
44 # the game requires a special version 78.6.0 of spidermonkey, otherwise
45 # we get compilation errors. We override the src attribute of spidermonkey_78
46 # in order to reuse that declartion, while giving it a different source input.
47 spidermonkey_78_6 = spidermonkey_78.overrideAttrs (old: rec {
50 url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
51 sha256 = "0lyg65v380j8i2lrylwz8a5ya80822l8vcnlx3dfqpd3s6zzjsay";
53 patches = (old.patches or [ ]) ++ [
54 ./spidermonkey-cargo-toml.patch
58 stdenv.mkDerivation rec {
63 url = "http://releases.wildfiregames.com/0ad-${version}-alpha-unix-build.tar.xz";
64 sha256 = "Lhxt9+MxLnfF+CeIZkz/w6eNO/YGBsAAOSdeHRPA7ks=";
100 ] ++ lib.optional withEditor wxGTK;
102 env.NIX_CFLAGS_COMPILE = toString [
103 "-I${xorgproto}/include"
104 "-I${libX11.dev}/include"
105 "-I${libXcursor.dev}/include"
106 "-I${SDL2}/include/SDL2"
107 "-I${fmt.dev}/include"
108 "-I${nvidia-texture-tools.dev}/include"
111 NIX_CFLAGS_LINK = toString [
112 "-L${nvidia-texture-tools.lib}/lib/static"
118 # Fix build with libxml v2.12
119 # FIXME: Remove with next package update
121 name = "libxml-2.12-fix.patch";
122 url = "https://github.com/0ad/0ad/commit/d242631245edb66816ef9960bdb2c61b68e56cec.patch";
123 hash = "sha256-Ik8ThkewB7wyTPTI7Y6k88SqpWUulXK698tevfSBr6I=";
125 # Fix build with GCC 13
126 # FIXME: Remove with next package update
128 name = "gcc-13-fix.patch";
129 url = "https://github.com/0ad/0ad/commit/093e1eb23519ab4a4633a999a555a58e4fd5343e.patch";
130 hash = "sha256-NuWO64narU1JID/F3cj7lJKjo96XR7gSW0w8I3/hhuw=";
132 # Fix build with miniupnpc 2.2.8
133 # https://github.com/0ad/0ad/pull/45
135 url = "https://github.com/0ad/0ad/commit/1575580bbc5278576693f3fbbb32de0b306aa27e.patch?full_index=1";
136 hash = "sha256-iXiUYTJCWwJpb2U3P58jTV4OpyW6quofu8Jq6xNEq48=";
141 # Delete shipped libraries which we don't need.
142 rm -rf libraries/source/{enet,miniupnpc,nvtt,spidermonkey}
145 pushd build/workspaces
146 ./update-workspaces.sh \
148 --with-system-mozjs \
149 ${lib.optionalString withEditor "--enable-atlas"} \
150 --bindir="$out"/bin \
151 --libdir="$out"/lib/0ad \
156 # Move to the build directory.
157 pushd build/workspaces/gcc
160 enableParallelBuilding = true;
166 install -Dm755 binaries/system/pyrogenesis "$out"/bin/0ad
167 ${lib.optionalString withEditor ''
168 install -Dm755 binaries/system/ActorEditor "$out"/bin/ActorEditor
172 install -Dm755 -t $out/share/0ad/data/l10n binaries/data/l10n/*
175 install -Dm644 -t $out/lib/0ad binaries/system/*.so
178 install -D build/resources/0ad.png $out/share/icons/hicolor/128x128/apps/0ad.png
179 install -D build/resources/0ad.desktop $out/share/applications/0ad.desktop
183 description = "Free, open-source game of ancient warfare";
184 homepage = "https://play0ad.com/";
185 license = with licenses; [
190 licenses.zlib # otherwise masked by pkgs.zlib
192 maintainers = with maintainers; [ chvp ];
193 platforms = subtractLists platforms.i686 platforms.linux;