New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mindustry: build Arc from source #108274
mindustry: build Arc from source #108274
Conversation
This works now, but the whole file definitely needs a cleanup because it is currently very messy. |
I wonder if this fixes the aarch64 build too |
Partially: libsdl-arc64.so can be built, but libarcarm64.so, which is also used for sprite packing at build-time, is still missing. On x86_64-linux this is blob is downloaded from maven. All of these binary downloads that are not easily packagable all the way down are so ugly I can't even, but this is a generic Java problem. |
Anuken/Mindustry#1704 (comment) full build log for mindustry / mindustry-deps for reference: https://termbin.com/2igz |
I can now build both libarc64.so (via the jnigenBuild task) and libsdl-arc64.so (as before via the sdlnatives task) on x86_64-linux and inject them into the downloaded maven deps before starting the build. This should also make some of the LD_LIBRARY_PATH hacks unnecessary, since libarc64.so now has the correct rpath with alsaLib and so on. |
That's unfortunate. While you're at it then could you set meta.platforms to x86_64 and remove aarch64 from meta.broken, since it's unsupported upstream? |
Done. Okay, so this has turned into a complete refactor:
This might have broken some more things on darwin, but since it didn't work before and it doesn't look like that problem will be solved soon, I would like to ignore that for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't like how we had to build the whole project twice each time (once for the -deps), so I investigated a bit and found a solution to only prefetch all dependencies in the -deps derivation, without building anything.
This is great! I also tried to do something like this some time ago but failed miserably...
By accident I discovered that the Mindustry gradle project will discover an Arc checkout if it's placed in ../Arc (probably mostly intended for development) and use that instead of attempting to download prebuilt versions. So I used this to combine the Arc and Mindustry builds into one derivation, going back to one -deps derivation as well.
Also good news! Only two hashes is definitely more manageable. Did you discover a way to find invalid hashes?
Thanks for the PR, +1 from me!
I left some minor comments here and there.
Conflict |
is resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird. Github still shows it as conflicting. Oh well.
pkgs/games/mindustry/default.nix
Outdated
install -Dm644 desktop/build/libs/Mindustry.jar $out/share/mindustry.jar | ||
mkdir -p $out/bin | ||
makeWrapper ${jre}/bin/java $out/bin/mindustry \ | ||
${stdenv.lib.optionalString stdenv.isLinux "--prefix LD_LIBRARY_PATH : ${alsaLib}/lib"} \ | ||
makeWrapper ${jdk}/bin/java $out/bin/mindustry \ | ||
--add-flags "-jar $out/share/mindustry.jar" | ||
install -Dm644 core/assets/icons/icon_64.png $out/share/icons/hicolor/64x64/apps/mindustry.png | ||
install -Dm644 ${desktopItem}/share/applications/Mindustry.desktop $out/share/applications/Mindustry.desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait I think you forgot to remove this since you use copyDesktopItems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, you're right
- reduce the buildPhase of the fixed-output dependencies derivation to only download all dependencies, instead of building the full thing. - add wayland variant, which is linked against a different variant of the glew library to run natively using SDL_VIDEODRIVER=wayland - use jdk (Java 15) instead of jre (Java 8) at runtime - use new copyDesktopItems hook
Sorry I forgot to push earlier. |
thank you! one binary less in nixpkgs 🎉 |
There will probably be a followup PR with some minor refinements and aarch64 support in the next few days (also planning to add aarch64 support upstream) |
Motivation for this change
Currently we use binary shared libraries from maven. These include statically linked variants of SDL2 and glew from the author's build machine. To run mindustry on wayland without Xwayland it is necessary to link against a different glew library.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)