Merge pull request #146557 from Mindavi/mindustry/unbreak

mindustry: unbreak
This commit is contained in:
Guillaume Girol 2021-11-25 19:11:27 +00:00 committed by GitHub
commit 9d4747aec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 10 deletions

View File

@ -4,7 +4,7 @@
, copyDesktopItems
, fetchFromGitHub
, gradle_6
, jdk11
, jdk
, perl
# for arc
@ -87,8 +87,7 @@ let
popd
'';
jdk = jdk11;
gradle = (gradle_6.override (old: { java = jdk11; }));
gradle = (gradle_6.override (old: { java = jdk; }));
# fake build to pre-download deps into fixed-output derivation
deps = stdenv.mkDerivation {
@ -129,6 +128,15 @@ stdenv.mkDerivation rec {
rm Arc/backends/backend-sdl/libs/linux64/libsdl-arc*.so
'' + cleanupMindustrySrc;
# Propagate glew to prevent it from being cleaned up.
# Since a jar is a compressed archive, nix can't figure out that the dependency is actually in there,
# and will assume that it's not actually needed.
# This can cause issues.
# See https://github.com/NixOS/nixpkgs/issues/109798.
propagatedBuildInputs = lib.optionals enableClient [
glew.out
];
buildInputs = lib.optionals enableClient [
SDL2
glew
@ -157,9 +165,11 @@ stdenv.mkDerivation rec {
'' + optionalString enableClient ''
gradle --offline --no-daemon jnigenBuild -Pbuildversion=${buildVersion}
gradle --offline --no-daemon sdlnatives -Pdynamic -Pbuildversion=${buildVersion}
glewlib=${lib.getLib glew}/lib/libGLEW.so
sdllib=${lib.getLib SDL2}/lib/libSDL2.so
patchelf ../Arc/backends/backend-sdl/libs/linux64/libsdl-arc*.so \
--add-needed ${glew.out}/lib/libGLEW.so \
--add-needed ${SDL2}/lib/libSDL2.so
--add-needed $glewlib \
--add-needed $sdllib
gradle --offline --no-daemon desktop:dist -Pbuildversion=${buildVersion}
'' + optionalString enableServer ''
gradle --offline --no-daemon server:dist -Pbuildversion=${buildVersion}
@ -191,8 +201,6 @@ stdenv.mkDerivation rec {
platforms = platforms.x86_64;
# Hash mismatch on darwin:
# https://github.com/NixOS/nixpkgs/pull/105590#issuecomment-737120293
broken = stdenv.isDarwin
# does not work with any maintained java version (https://github.com/Anuken/Mindustry/issues/5114)
|| true;
broken = stdenv.isDarwin;
};
}

View File

@ -30316,10 +30316,16 @@ with pkgs;
methane = callPackage ../games/methane { };
mindustry = callPackage ../games/mindustry { };
mindustry-wayland = callPackage ../games/mindustry { glew = glew-egl; };
mindustry = callPackage ../games/mindustry {
jdk = adoptopenjdk-hotspot-bin-15;
};
mindustry-wayland = callPackage ../games/mindustry {
jdk = adoptopenjdk-hotspot-bin-15;
glew = glew-egl;
};
mindustry-server = callPackage ../games/mindustry {
jdk = adoptopenjdk-hotspot-bin-15;
enableClient = false;
enableServer = true;
};