2021-02-22 21:06:43 +01:00
|
|
|
{ stdenv, lib, perl, fetchurl, python2, fmt, libidn
|
|
|
|
, pkg-config, spidermonkey_78, boost, icu, libxml2, libpng, libsodium
|
2016-11-03 14:43:42 +01:00
|
|
|
, libjpeg, zlib, curl, libogg, libvorbis, enet, miniupnpc
|
2019-11-10 17:44:34 +01:00
|
|
|
, openal, libGLU, libGL, xorgproto, libX11, libXcursor, nspr, SDL2
|
2021-04-16 18:40:48 +02:00
|
|
|
, gloox, nvidia-texture-tools
|
2021-02-22 21:06:43 +01:00
|
|
|
, withEditor ? true, wxGTK
|
2016-11-03 14:43:42 +01:00
|
|
|
}:
|
|
|
|
|
2021-02-22 21:06:43 +01:00
|
|
|
# You can find more instructions on how to build 0ad here:
|
|
|
|
# https://trac.wildfiregames.com/wiki/BuildInstructions
|
|
|
|
|
|
|
|
let
|
|
|
|
# the game requires a special version 78.6.0 of spidermonkey, otherwise
|
|
|
|
# we get compilation errors. We override the src attribute of spidermonkey_78
|
|
|
|
# in order to reuse that declartion, while giving it a different source input.
|
|
|
|
spidermonkey_78_6 = spidermonkey_78.overrideAttrs(old: rec {
|
|
|
|
version = "78.6.0";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
|
|
|
|
sha256 = "0lyg65v380j8i2lrylwz8a5ya80822l8vcnlx3dfqpd3s6zzjsay";
|
|
|
|
};
|
2021-03-20 15:34:10 +01:00
|
|
|
patches = (old.patches or []) ++ [
|
|
|
|
./spidermonkey-cargo-toml.patch
|
|
|
|
];
|
2021-02-22 21:06:43 +01:00
|
|
|
});
|
|
|
|
in
|
2016-11-03 14:43:42 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "0ad";
|
2021-08-29 17:47:04 +02:00
|
|
|
version = "0.0.25b";
|
2016-11-03 14:43:42 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://releases.wildfiregames.com/0ad-${version}-alpha-unix-build.tar.xz";
|
2021-08-29 17:47:04 +02:00
|
|
|
sha256 = "1p9fa8f7sjb9c5wl3mawzyfqvgr614kdkhrj2k4db9vkyisws3fp";
|
2016-11-03 14:43:42 +01:00
|
|
|
};
|
|
|
|
|
2021-01-17 06:49:22 +01:00
|
|
|
nativeBuildInputs = [ python2 perl pkg-config ];
|
2016-11-03 14:43:42 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2021-02-22 21:06:43 +01:00
|
|
|
spidermonkey_78_6 boost icu libxml2 libpng libjpeg
|
|
|
|
zlib curl libogg libvorbis enet miniupnpc openal libidn
|
2019-11-10 17:44:34 +01:00
|
|
|
libGLU libGL xorgproto libX11 libXcursor nspr SDL2 gloox
|
2021-02-22 21:06:43 +01:00
|
|
|
nvidia-texture-tools libsodium fmt
|
2016-11-03 14:43:42 +01:00
|
|
|
] ++ lib.optional withEditor wxGTK;
|
|
|
|
|
2019-10-30 12:34:47 +01:00
|
|
|
NIX_CFLAGS_COMPILE = toString [
|
2018-12-31 04:40:47 +01:00
|
|
|
"-I${xorgproto}/include/X11"
|
2016-11-03 14:43:42 +01:00
|
|
|
"-I${libX11.dev}/include/X11"
|
|
|
|
"-I${libXcursor.dev}/include/X11"
|
|
|
|
"-I${SDL2}/include/SDL2"
|
2021-02-22 21:06:43 +01:00
|
|
|
"-I${fmt.dev}/include"
|
2018-12-18 12:05:33 +01:00
|
|
|
];
|
2016-11-03 14:43:42 +01:00
|
|
|
|
2021-04-16 18:40:48 +02:00
|
|
|
patches = [ ./rootdir_env.patch ];
|
|
|
|
|
2016-11-03 14:43:42 +01:00
|
|
|
configurePhase = ''
|
|
|
|
# Delete shipped libraries which we don't need.
|
|
|
|
rm -rf libraries/source/{enet,miniupnpc,nvtt,spidermonkey}
|
|
|
|
|
|
|
|
# Update Makefiles
|
|
|
|
pushd build/workspaces
|
|
|
|
./update-workspaces.sh \
|
|
|
|
--with-system-nvtt \
|
2021-02-22 21:06:43 +01:00
|
|
|
--with-system-mozjs \
|
2016-11-03 14:43:42 +01:00
|
|
|
${lib.optionalString withEditor "--enable-atlas"} \
|
|
|
|
--bindir="$out"/bin \
|
|
|
|
--libdir="$out"/lib/0ad \
|
|
|
|
--without-tests \
|
|
|
|
-j $NIX_BUILD_CORES
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Move to the build directory.
|
|
|
|
pushd build/workspaces/gcc
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
popd
|
|
|
|
|
|
|
|
# Copy executables.
|
|
|
|
install -Dm755 binaries/system/pyrogenesis "$out"/bin/0ad
|
|
|
|
${lib.optionalString withEditor ''
|
|
|
|
install -Dm755 binaries/system/ActorEditor "$out"/bin/ActorEditor
|
|
|
|
''}
|
|
|
|
|
|
|
|
# Copy l10n data.
|
2018-05-20 21:32:03 +02:00
|
|
|
install -Dm755 -t $out/share/0ad/data/l10n binaries/data/l10n/*
|
2016-11-03 14:43:42 +01:00
|
|
|
|
|
|
|
# Copy libraries.
|
2018-05-20 21:32:03 +02:00
|
|
|
install -Dm644 -t $out/lib/0ad binaries/system/*.so
|
2016-11-03 14:43:42 +01:00
|
|
|
|
|
|
|
# Copy icon.
|
2018-05-20 21:32:03 +02:00
|
|
|
install -D build/resources/0ad.png $out/share/icons/hicolor/128x128/0ad.png
|
|
|
|
install -D build/resources/0ad.desktop $out/share/applications/0ad.desktop
|
2016-11-03 14:43:42 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-11-03 14:43:42 +01:00
|
|
|
description = "A free, open-source game of ancient warfare";
|
2017-10-23 00:19:28 +02:00
|
|
|
homepage = "https://play0ad.com/";
|
2016-11-03 14:43:42 +01:00
|
|
|
license = with licenses; [
|
|
|
|
gpl2 lgpl21 mit cc-by-sa-30
|
|
|
|
licenses.zlib # otherwise masked by pkgs.zlib
|
|
|
|
];
|
2021-04-16 18:42:32 +02:00
|
|
|
maintainers = with maintainers; [ chvp ];
|
2017-03-30 16:22:49 +02:00
|
|
|
platforms = subtractLists platforms.i686 platforms.linux;
|
2016-11-03 14:43:42 +01:00
|
|
|
};
|
|
|
|
}
|