···21 icu,
22 lua,
23 curl,
24+ fetchpatch,
25}:
2627stdenv.mkDerivation rec {
···34 repo = "wesnoth";
35 hash = "sha256-c3BoTFnSUqtp71QeSCsC2teVuzsQwV8hOJtIcZdP+1E=";
36 };
37+38+ # LLVM 19 removed support for types not officially supported by `std::char_traits`:
39+ # https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
40+ # Wesnoth <1.19 relies on this previously supported non-standard behavior for
41+ # some types that should either have been a vector or span:
42+ # https://github.com/wesnoth/wesnoth/issues/9546
43+ # Wesnoth moved to a `std::span` wrapper for byte views in the 1.19 branch, which we apply as
44+ # patches until 1.20 is released.
45+ patches = lib.optionals (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "19") [
46+ # The next two patches are cherry-picked from https://github.com/wesnoth/wesnoth/pull/10102,
47+ # which is already included in the 1.19 branch.
48+ # Introduces the `std::span` wrapper based on `boost::span`.
49+ (fetchpatch {
50+ url = "https://github.com/wesnoth/wesnoth/commit/63266cc2c88fefa7e0792ac59d14c14e3711440c.patch";
51+ hash = "sha256-3Zi/njG7Kovmyd7yiKUoeu4u0QPQxxw+uLz+k9isOLU=";
52+ })
53+ # Replace all string views with spans.
54+ (fetchpatch {
55+ url = "https://github.com/wesnoth/wesnoth/commit/d3daa161eb2c02670b5ffbcf86cd0ec787f6b9ee.patch";
56+ hash = "sha256-9DCeZQZKE6fN91T5DCpNJsKGXbv5ihZC8UpuNkiA9zc=";
57+ })
58+ # Wesnoth <1.19 uses `std::basic_string` for lightmap computations, which is not standard compliant
59+ # and incompatible to LLVM 19.
60+ # While this was fixed in https://github.com/wesnoth/wesnoth/pull/10128, the fix is not
61+ # trivially backportable to 1.18 so we apply a simpler fix instead.
62+ ./llvm19-lightmap.patch
63+ ];
6465 nativeBuildInputs = [
66 cmake