about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2021-03-21 01:18:04 +0100
committerGitHub <noreply@github.com>2021-03-21 01:18:04 +0100
commit9e99491e9e9f6bd5166943caa0bd697407f6bb5b (patch)
treec6e1e7104543578f72740d290b09ae7c87be8432 /pkgs/games
parente295138fdf92e4ffa1dd8940f027904cdbf7c955 (diff)
parenta410e5dc477f4a6c5f1683513b4406ad14d10718 (diff)
downloadnixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.tar
nixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.tar.gz
nixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.tar.bz2
nixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.tar.lz
nixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.tar.xz
nixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.tar.zst
nixlib-9e99491e9e9f6bd5166943caa0bd697407f6bb5b.zip
Merge pull request #114031 from nagy/zeroad
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/0ad/data.nix2
-rw-r--r--pkgs/games/0ad/game.nix62
-rw-r--r--pkgs/games/0ad/rootdir_env.patch38
-rw-r--r--pkgs/games/0ad/spidermonkey-cargo-toml.patch15
4 files changed, 51 insertions, 66 deletions
diff --git a/pkgs/games/0ad/data.nix b/pkgs/games/0ad/data.nix
index 1bebf922c48d..5cb28b3f3bd6 100644
--- a/pkgs/games/0ad/data.nix
+++ b/pkgs/games/0ad/data.nix
@@ -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 = ''
diff --git a/pkgs/games/0ad/game.nix b/pkgs/games/0ad/game.nix
index 1ba975aa8854..bb3b7c0138af 100644
--- a/pkgs/games/0ad/game.nix
+++ b/pkgs/games/0ad/game.nix
@@ -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
 
diff --git a/pkgs/games/0ad/rootdir_env.patch b/pkgs/games/0ad/rootdir_env.patch
deleted file mode 100644
index c001473e5104..000000000000
--- a/pkgs/games/0ad/rootdir_env.patch
+++ /dev/null
@@ -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)
diff --git a/pkgs/games/0ad/spidermonkey-cargo-toml.patch b/pkgs/games/0ad/spidermonkey-cargo-toml.patch
new file mode 100644
index 000000000000..4cb8c3735dbd
--- /dev/null
+++ b/pkgs/games/0ad/spidermonkey-cargo-toml.patch
@@ -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" }