wesnoth: fix darwin and LLVM 19 compatibility#381227
wesnoth: fix darwin and LLVM 19 compatibility#381227niklaskorz merged 5 commits intoNixOS:masterfrom
Conversation
c09cc3a to
501c0cd
Compare
|
Samasaur1
left a comment
There was a problem hiding this comment.
Looks good to me. I did notice that this won't support nix run, and I have seen some macOS app PRs recently that add a little shim in $out/bin that launches the app. Up to you whether you want to include one or not — I suspect that it's rare for anyone to try to nix run this package anyway
|
I’m a little worried about the patch that upstream presumably wouldn’t accept. Can we do something that doesn’t pull in another dependency? |
pkgs/games/wesnoth/default.nix
Outdated
There was a problem hiding this comment.
Since this is llvm-19 specific, can we do a more precise version check here? Since nixpkgs allows using both earlier and later versions, it may be nicer to only apply this for llvm19+
There was a problem hiding this comment.
Fair enough, will do!
The upstream solution would be adopting C++20 imho, which is a bit beyond the scope of this PR. The only other alternative I see would be to vendor an even more lightweight implementation of span than gsl-lite, e.g. https://github.com/martinmoene/span-lite (which is also packaged in nixpkgs already), but I'm generally more confident in using gsl-lite as it's more widely used and more actively maintained. Upstreaming this fix could use my changes as a starting point, but replacing gsl-lite with C++20's std::span and then going from there to fix all other incompatibilities with C++20. |
That's a good idea, it might not be the most frequent way to access it but is nice for quickly trying out an app without installing it. I originally wanted to symlink the app's MacOS dir to bin, but that's not sufficient for the binary to locate the app bundle. |
|
Something like this should make |
I think the approach that would work is a script that runs |
|
Rebasing and applying wesnoth/wesnoth#10102 right now |
24a03e6 to
385a58a
Compare
385a58a to
5b585f4
Compare
Added, but without the realpath as the app bundle itself is no symlink |
5b585f4 to
4e87096
Compare
The additional dependency has been removed as upstream now automatically uses either When 1.20 is out, the patches can be removed entirely as upstream's 1.19 branch already includes all required fixes. |
4e87096 to
87efe40
Compare
|
Rebased because of the tree-wide removal of obsolete darwin frameworks in #398707 |
LLVM 19 removed support for types not officially supported by
std::char_traits: https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removalsWesnoth relies on this previously supported non-standard behavior for some types that should either have been a vector or span: wesnoth/wesnoth#9546
Unfortunately we can't just usestd::spanas that requires C++20, and making Wesnoth C++20 compatible is a non-trivial problem.As a workaround, we make use of gsl-lite, which includes a lightweight implementation of span.
I've applied the relevant commits from 1.19 that wrap
boost::span, and kept my own patch for fixing the lightmap (see comment above the patch).Furthermore, while this package built on darwin before Clang 19 landed, it didn't run, as Wesnoth requires the binary to be contained in a macOS app bundle to function. This is also fixed in this PR by manually creating the app bundle using the upstream resources and
Info.plist.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.