Merge pull request #114031 from nagy/zeroad

This commit is contained in:
Sandro 2021-03-21 01:18:04 +01:00 committed by GitHub
commit 9e99491e9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 66 deletions

View File

@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "http://releases.wildfiregames.com/0ad-${version}-alpha-unix-data.tar.xz";
sha256 = "04x7729hk6zw1xj3n4s4lvaviijsnbjf5rhzvjxlr5fygvg4l6z1";
sha256 = "0b53jzl64i49rk3n3c3x0hibwbl7vih2xym8jq5s56klg61qdxa1";
};
installPhase = ''

View File

@ -1,29 +1,45 @@
{ stdenv, lib, perl, fetchurl, python2
, pkg-config, spidermonkey_38, boost, icu, libxml2, libpng, libsodium
{ stdenv, lib, perl, fetchurl, python2, fmt, libidn
, pkg-config, spidermonkey_78, boost, icu, libxml2, libpng, libsodium
, libjpeg, zlib, curl, libogg, libvorbis, enet, miniupnpc
, openal, libGLU, libGL, xorgproto, libX11, libXcursor, nspr, SDL2
, gloox, nvidia-texture-tools
, withEditor ? true, wxGTK ? null
, gloox, nvidia-texture-tools, zeroad-data
, withEditor ? true, wxGTK
}:
assert withEditor -> wxGTK != null;
# 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";
};
patches = (old.patches or []) ++ [
./spidermonkey-cargo-toml.patch
];
});
in
stdenv.mkDerivation rec {
pname = "0ad";
version = "0.0.23b";
version = "0.0.24b";
src = fetchurl {
url = "http://releases.wildfiregames.com/0ad-${version}-alpha-unix-build.tar.xz";
sha256 = "0draa53xg69i5qhqym85658m45xhwkbiimaldj4sr3703rjgggq1";
sha256 = "1a1py45hkh2cswi09vbf9chikgxdv9xplsmg6sv6xhdznv4j6p1j";
};
nativeBuildInputs = [ python2 perl pkg-config ];
buildInputs = [
spidermonkey_38 boost icu libxml2 libpng libjpeg
zlib curl libogg libvorbis enet miniupnpc openal
spidermonkey_78_6 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
nvidia-texture-tools libsodium fmt
] ++ lib.optional withEditor wxGTK;
NIX_CFLAGS_COMPILE = toString [
@ -31,35 +47,22 @@ stdenv.mkDerivation rec {
"-I${libX11.dev}/include/X11"
"-I${libXcursor.dev}/include/X11"
"-I${SDL2}/include/SDL2"
];
patches = [
./rootdir_env.patch
# Fixes build with spidermonkey-38.8.0, includes the minor version check:
# https://src.fedoraproject.org/rpms/0ad/c/26dc1657f6e3c0ad9f1180ca38cd79b933ef0c8b
(fetchurl {
url = "https://src.fedoraproject.org/rpms/0ad/raw/26dc1657f6e3c0ad9f1180ca38cd79b933ef0c8b/f/0ad-mozjs-incompatible.patch";
sha256 = "1rzpaalcrzihsgvlk3nqd87n2kxjldlwvb3qp5fcd5ffzr6k90wa";
})
"-I${fmt.dev}/include"
];
configurePhase = ''
# Delete shipped libraries which we don't need.
rm -rf libraries/source/{enet,miniupnpc,nvtt,spidermonkey}
# Workaround invalid pkg-config name for mozjs
mkdir pkg-config
ln -s ${spidermonkey_38}/lib/pkgconfig/* pkg-config/mozjs-38.pc
PKG_CONFIG_PATH="$PWD/pkg-config:$PKG_CONFIG_PATH"
# Update Makefiles
pushd build/workspaces
./update-workspaces.sh \
--with-system-nvtt \
--with-system-mozjs38 \
--with-system-mozjs \
${lib.optionalString withEditor "--enable-atlas"} \
--bindir="$out"/bin \
--libdir="$out"/lib/0ad \
--datadir="$out"/share/0ad/data \
--without-tests \
-j $NIX_BUILD_CORES
popd
@ -82,6 +85,11 @@ stdenv.mkDerivation rec {
# Copy l10n data.
install -Dm755 -t $out/share/0ad/data/l10n binaries/data/l10n/*
# Link in game data from package
ln -s ${zeroad-data}/share/0ad/data/config $out/share/0ad/data/config
ln -s ${zeroad-data}/share/0ad/data/mods $out/share/0ad/data/mods
ln -s ${zeroad-data}/share/0ad/data/tools $out/share/0ad/data/tools
# Copy libraries.
install -Dm644 -t $out/lib/0ad binaries/system/*.so

View File

@ -1,38 +0,0 @@
diff -ru3 0ad-0.0.20-alpha/source/ps/GameSetup/Paths.cpp 0ad-0.0.20-alpha-new/source/ps/GameSetup/Paths.cpp
--- 0ad-0.0.20-alpha/source/ps/GameSetup/Paths.cpp 2015-02-14 04:45:13.000000000 +0300
+++ 0ad-0.0.20-alpha-new/source/ps/GameSetup/Paths.cpp 2016-11-03 16:23:47.241514876 +0300
@@ -155,32 +155,8 @@
/*static*/ OsPath Paths::Root(const OsPath& argv0)
{
-#if OS_ANDROID
- return OsPath("/sdcard/0ad"); // TODO: this is kind of bogus
-#else
-
- // get full path to executable
- OsPath pathname = sys_ExecutablePathname(); // safe, but requires OS-specific implementation
- if(pathname.empty()) // failed, use argv[0] instead
- {
- errno = 0;
- pathname = wrealpath(argv0);
- if(pathname.empty())
- WARN_IF_ERR(StatusFromErrno());
- }
-
- // make sure it's valid
- if(!FileExists(pathname))
- {
- LOGERROR("Cannot find executable (expected at '%s')", pathname.string8());
- WARN_IF_ERR(StatusFromErrno());
- }
-
- for(size_t i = 0; i < 2; i++) // remove "system/name.exe"
- pathname = pathname.Parent();
- return pathname;
-
-#endif
+ UNUSED2(argv0);
+ return getenv("ZEROAD_ROOTDIR");
}
/*static*/ OsPath Paths::RootData(const OsPath& argv0)

View File

@ -0,0 +1,15 @@
diff --git a/Cargo.toml b/Cargo.toml
index 6f6199ab26..c3f92db9d8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -68,8 +68,8 @@ panic = "abort"
libudev-sys = { path = "dom/webauthn/libudev-sys" }
packed_simd = { git = "https://github.com/hsivonen/packed_simd", rev="3541e3818fdc7c2a24f87e3459151a4ce955a67a" }
rlbox_lucet_sandbox = { git = "https://github.com/PLSysSec/rlbox_lucet_sandbox/", rev="d510da5999a744c563b0acd18056069d1698273f" }
-nix = { git = "https://github.com/shravanrn/nix/", branch = "r0.13.1", rev="4af6c367603869a30fddb5ffb0aba2b9477ba92e" }
-spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3", rev = "20191ad2f370afd6d247edcb9ff9da32d3bedb9c" }
+nix = { git = "https://github.com/shravanrn/nix/", branch = "r0.13.1" }
+spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3" }
# failure's backtrace feature might break our builds, see bug 1608157.
failure = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
failure_derive = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }

View File

@ -27840,7 +27840,6 @@ in
zeroadPackages = dontRecurseIntoAttrs (callPackage ../games/0ad {
wxGTK = wxGTK30;
stdenv = gcc9Stdenv;
});
zeroad = zeroadPackages.zeroad;