mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 13:30:36 +00:00
198 lines
4.2 KiB
Nix
198 lines
4.2 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
perl,
|
|
fetchurl,
|
|
fetchpatch,
|
|
python3,
|
|
fmt_9,
|
|
libidn,
|
|
pkg-config,
|
|
spidermonkey_128,
|
|
boost,
|
|
icu,
|
|
libxml2,
|
|
libpng,
|
|
libsodium,
|
|
libjpeg,
|
|
zlib,
|
|
curl,
|
|
libogg,
|
|
libvorbis,
|
|
enet,
|
|
miniupnpc,
|
|
openal,
|
|
libGLU,
|
|
libGL,
|
|
xorgproto,
|
|
libx11,
|
|
libxcursor,
|
|
nspr,
|
|
SDL2,
|
|
gloox,
|
|
nvidia-texture-tools,
|
|
premake5,
|
|
cxxtest,
|
|
freetype,
|
|
withEditor ? true,
|
|
wxwidgets_3_2,
|
|
}:
|
|
|
|
# You can find more instructions on how to build 0ad here:
|
|
# https://gitea.wildfiregames.com/0ad/0ad/wiki/BuildInstructions
|
|
|
|
let
|
|
# When updating 0 A.D., check for necessary SpiderMonkey patches here:
|
|
# https://gitea.wildfiregames.com/0ad/0ad/src/branch/main/libraries/source/spidermonkey/patches
|
|
spidermonkey = spidermonkey_128.overrideAttrs (old: {
|
|
# Fix segfault during GUI GC (fixed in v140)
|
|
# https://bugzilla.mozilla.org/show_bug.cgi?id=1982134
|
|
patches = old.patches or [ ] ++ [
|
|
(fetchpatch {
|
|
name = "fix-extra-gc-tracing.patch";
|
|
url = "https://github.com/mozilla-firefox/firefox/commit/bf1994b05baea60f84309475cd544fe89acf82f2.patch";
|
|
hash = "sha256-3sTcZb34yHheqK7O9aHSwMife3uJnf3us+0sPJ2NzKs=";
|
|
})
|
|
];
|
|
});
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "0ad";
|
|
version = "0.28.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://releases.wildfiregames.com/0ad-${finalAttrs.version}-unix-build.tar.xz";
|
|
hash = "sha256-J+IXdV73apIv5Y2/WT2W5Utu0jddI/VIw1YZqmvVpCo=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
python3
|
|
perl
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = [
|
|
spidermonkey
|
|
boost
|
|
icu
|
|
libxml2
|
|
libpng
|
|
libjpeg
|
|
zlib
|
|
curl
|
|
libogg
|
|
libvorbis
|
|
enet
|
|
miniupnpc
|
|
openal
|
|
libidn
|
|
libGLU
|
|
libGL
|
|
xorgproto
|
|
libx11
|
|
libxcursor
|
|
nspr
|
|
SDL2
|
|
gloox
|
|
nvidia-texture-tools
|
|
libsodium
|
|
fmt_9
|
|
freetype
|
|
premake5
|
|
cxxtest
|
|
]
|
|
++ lib.optional withEditor wxwidgets_3_2;
|
|
|
|
env = {
|
|
NIX_CFLAGS_COMPILE = toString [
|
|
"-I${xorgproto}/include"
|
|
"-I${libx11.dev}/include"
|
|
"-I${libxcursor.dev}/include"
|
|
"-I${SDL2}/include/SDL2"
|
|
"-I${fmt_9.dev}/include"
|
|
"-I${nvidia-texture-tools.dev}/include"
|
|
];
|
|
|
|
NIX_CFLAGS_LINK = toString [
|
|
"-L${nvidia-texture-tools.lib}/lib/static"
|
|
];
|
|
};
|
|
|
|
patches = [
|
|
./rootdir_env.patch
|
|
];
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
|
|
# Delete shipped libraries which we don't need.
|
|
rm -rf libraries/source/{cxxtest-4.4,nvtt,premake-core,spidermonkey,spirv-reflect}
|
|
|
|
# Build remaining library dependencies (should be fcollada only)
|
|
pushd libraries
|
|
./build-source-libs.sh \
|
|
--with-system-cxxtest \
|
|
--with-system-nvtt \
|
|
--with-system-mozjs \
|
|
--with-system-premake \
|
|
-j$NIX_BUILD_CORES
|
|
popd
|
|
|
|
# Update Makefiles
|
|
pushd build/workspaces
|
|
./update-workspaces.sh \
|
|
--with-system-premake5 \
|
|
--with-system-cxxtest \
|
|
--with-system-nvtt \
|
|
--with-system-mozjs \
|
|
${lib.optionalString (!withEditor) "--without-atlas"} \
|
|
--bindir="$out"/bin \
|
|
--libdir="$out"/lib/0ad \
|
|
--without-tests \
|
|
-j $NIX_BUILD_CORES
|
|
popd
|
|
|
|
# Move to the build directory.
|
|
pushd build/workspaces/gcc
|
|
|
|
runHook postConfigure
|
|
'';
|
|
|
|
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.
|
|
install -Dm755 -t $out/share/0ad/data/l10n binaries/data/l10n/*
|
|
|
|
# Copy libraries.
|
|
install -Dm644 -t $out/lib/0ad binaries/system/*.so
|
|
|
|
# Copy icon.
|
|
install -D build/resources/0ad.png $out/share/icons/hicolor/128x128/apps/0ad.png
|
|
install -D build/resources/0ad.desktop $out/share/applications/0ad.desktop
|
|
'';
|
|
|
|
meta = {
|
|
description = "Free, open-source game of ancient warfare";
|
|
homepage = "https://play0ad.com/";
|
|
license = with lib.licenses; [
|
|
gpl2Plus
|
|
lgpl21
|
|
mit
|
|
cc-by-sa-30
|
|
lib.licenses.zlib # otherwise masked by pkgs.zlib
|
|
];
|
|
maintainers = with lib.maintainers; [ chvp ];
|
|
platforms = lib.subtractLists lib.platforms.i686 lib.platforms.linux;
|
|
mainProgram = "0ad";
|
|
};
|
|
})
|