starsector: update JVM flags

During this update, due to a new version of Java, the software broke.
On startup it crashed with the error: "Conflicting collector
combinations in option list". This was due to mixing the default
`-XX:+UseG1GC` and the `-XX:+UseConcMarkSweepGC -XX:+UseParNewGC` flags.
I removed the latter flags, leaving the default garbage collector

Furthermore, on succesful launch, the game wound warn about the
`-XX:PermSize=192m -XX:MaxPermSize=192m` flags, that were removed in
Java 8. Thus, those flags were also removed.

The `substituteInPlace` deprecated `--replace` argument was also
replaced by the new alternatives.
This commit is contained in:
rafaelrc7 2024-02-05 19:51:17 -03:00
parent 4b1aab2219
commit ff5a8516dd
No known key found for this signature in database
GPG Key ID: A2E6A1C9A59514A5

View File

@ -63,12 +63,14 @@ stdenv.mkDerivation rec {
# it tries to run everything with relative paths, which makes it CWD dependent
# also point mod, screenshot, and save directory to $XDG_DATA_HOME
# additionally, add some GC options to improve performance of the game
# and remove flags "PermSize" and "MaxPermSize" that were removed with Java 8
postPatch = ''
substituteInPlace starsector.sh \
--replace "./jre_linux/bin/java" "${openjdk}/bin/java" \
--replace "./native/linux" "$out/share/starsector/native/linux" \
--replace "=." "=\''${XDG_DATA_HOME:-\$HOME/.local/share}/starsector" \
--replace "-XX:+CompilerThreadHintNoPreempt" "-XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSConcurrentMTEnabled -XX:+DisableExplicitGC"
--replace-fail "./jre_linux/bin/java" "${openjdk}/bin/java" \
--replace-fail "./native/linux" "$out/share/starsector/native/linux" \
--replace-fail "=." "=\''${XDG_DATA_HOME:-\$HOME/.local/share}/starsector" \
--replace-warn "-XX:+CompilerThreadHintNoPreempt" "-XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:+CMSConcurrentMTEnabled -XX:+DisableExplicitGC" \
--replace-quiet " -XX:PermSize=192m -XX:MaxPermSize=192m" ""
'';
meta = with lib; {