···2121 icu,
2222 lua,
2323 curl,
2424+ fetchpatch,
2425}:
25262627stdenv.mkDerivation rec {
···3334 repo = "wesnoth";
3435 hash = "sha256-c3BoTFnSUqtp71QeSCsC2teVuzsQwV8hOJtIcZdP+1E=";
3536 };
3737+3838+ # LLVM 19 removed support for types not officially supported by `std::char_traits`:
3939+ # https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
4040+ # Wesnoth <1.19 relies on this previously supported non-standard behavior for
4141+ # some types that should either have been a vector or span:
4242+ # https://github.com/wesnoth/wesnoth/issues/9546
4343+ # Wesnoth moved to a `std::span` wrapper for byte views in the 1.19 branch, which we apply as
4444+ # patches until 1.20 is released.
4545+ patches = lib.optionals (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "19") [
4646+ # The next two patches are cherry-picked from https://github.com/wesnoth/wesnoth/pull/10102,
4747+ # which is already included in the 1.19 branch.
4848+ # Introduces the `std::span` wrapper based on `boost::span`.
4949+ (fetchpatch {
5050+ url = "https://github.com/wesnoth/wesnoth/commit/63266cc2c88fefa7e0792ac59d14c14e3711440c.patch";
5151+ hash = "sha256-3Zi/njG7Kovmyd7yiKUoeu4u0QPQxxw+uLz+k9isOLU=";
5252+ })
5353+ # Replace all string views with spans.
5454+ (fetchpatch {
5555+ url = "https://github.com/wesnoth/wesnoth/commit/d3daa161eb2c02670b5ffbcf86cd0ec787f6b9ee.patch";
5656+ hash = "sha256-9DCeZQZKE6fN91T5DCpNJsKGXbv5ihZC8UpuNkiA9zc=";
5757+ })
5858+ # Wesnoth <1.19 uses `std::basic_string` for lightmap computations, which is not standard compliant
5959+ # and incompatible to LLVM 19.
6060+ # While this was fixed in https://github.com/wesnoth/wesnoth/pull/10128, the fix is not
6161+ # trivially backportable to 1.18 so we apply a simpler fix instead.
6262+ ./llvm19-lightmap.patch
6363+ ];
36643765 nativeBuildInputs = [
3866 cmake