Index | Thread | Search

From:
Rafael Sadowski <rafael@sizeofvoid.org>
Subject:
Re: unbreak games/openmw libc++19
To:
Nam Nguyen <namn@messagemode2.com>
Cc:
pascal@stumpf.co, ports@openbsd.org
Date:
Wed, 3 Sep 2025 07:14:36 +0200

Download raw body.

Thread
On Tue Sep 02, 2025 at 07:04:35PM -0700, Nam Nguyen wrote:
> Here is an inline diff to unbreak openmw with libc++19. I backported
> the fix from the new version 0.49.0, so it can be removed once
> openmw is updated. upstream decided to use span instead of
> basic_string_view.
> 
> some links of interest:
> https://gitlab.com/OpenMW/openmw/-/commit/e5ad1cd2144cfedf0418a30a125bf057734150f0
> https://reviews.llvm.org/D157058
> https://reviews.llvm.org/D138307
> 
> I was able to play. I did have to uninstall, remove the global
> defaults.bin and reinstall for it to launch successfully.
> 
> --8<---------------cut here---------------start------------->8---
> --- -openmw-0.48.0p2 -------------------
> You should also remove /etc/openmw/defaults.bin (which was modified)
> 
> Loading settings file: /etc/openmw/defaults.bin
> [18:46:01.116 E] Error: Trying to retrieve a non-existing setting: log buffer size.
> [18:46:01.116 E] Make sure the defaults.bin file was properly installed.
> --8<---------------cut here---------------end--------------->8---
> 
> Feedback and tests are welcome. OK?

OK rsadowski

> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/openmw/Makefile,v
> diff -u -p -r1.35 Makefile
> --- Makefile	2 Sep 2025 12:22:24 -0000	1.35
> +++ Makefile	3 Sep 2025 01:40:26 -0000
> @@ -1,4 +1,3 @@
> -BROKEN = implicit instantiation of undefined template 'std::char_traits<signed char>'
>  ONLY_FOR_ARCHS =	amd64 i386
>  
>  COMMENT =		open source implementation of TES III: Morrowind
> @@ -8,7 +7,7 @@ GH_ACCOUNT =		OpenMW
>  GH_PROJECT =		openmw
>  GH_TAGNAME =		openmw-$V
>  DISTNAME =		openmw-$V
> -REVISION =		1
> +REVISION =		2
>  
>  DISTFILES.a = 		e75adf86f91eb3082220085e42dda62679f9a3ea.zip
>  DIST_SUBDIR =		openmw
> Index: patches/patch-components_to_utf8_to_utf8_cpp
> ===================================================================
> RCS file: patches/patch-components_to_utf8_to_utf8_cpp
> diff -N patches/patch-components_to_utf8_to_utf8_cpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-components_to_utf8_to_utf8_cpp	3 Sep 2025 01:40:26 -0000
> @@ -0,0 +1,14 @@
> +Fix build with libc++19; backported from openmw-0.49.0
> +
> +Index: components/to_utf8/to_utf8.cpp
> +--- components/to_utf8/to_utf8.cpp.orig
> ++++ components/to_utf8/to_utf8.cpp
> +@@ -52,7 +52,7 @@ namespace
> +         return std::find_if(input.begin(), input.end(), [] (unsigned char v) { return v == 0 || v >= 128; });
> +     }
> + 
> +-    std::basic_string_view<signed char> getTranslationArray(FromType sourceEncoding)
> ++    std::span<const signed char> getTranslationArray(FromType sourceEncoding)
> +     {
> +         switch (sourceEncoding)
> +         {
> Index: patches/patch-components_to_utf8_to_utf8_hpp
> ===================================================================
> RCS file: patches/patch-components_to_utf8_to_utf8_hpp
> diff -N patches/patch-components_to_utf8_to_utf8_hpp
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-components_to_utf8_to_utf8_hpp	3 Sep 2025 01:40:26 -0000
> @@ -0,0 +1,22 @@
> +Fix build with libc++19; backported from openmw-0.49.0
> +
> +Index: components/to_utf8/to_utf8.hpp
> +--- components/to_utf8/to_utf8.hpp.orig
> ++++ components/to_utf8/to_utf8.hpp
> +@@ -3,6 +3,7 @@
> + 
> + #include <string>
> + #include <cstring>
> ++#include <span>
> + #include <vector>
> + #include <string_view>
> + 
> +@@ -46,7 +47,7 @@ namespace ToUTF8
> +             inline std::pair<std::size_t, bool> getLengthLegacyEnc(std::string_view input) const;
> +             inline void copyFromArrayLegacyEnc(std::string_view::iterator& chp, std::string_view::iterator end, char* &out) const;
> + 
> +-            const std::basic_string_view<signed char> mTranslationArray;
> ++            const std::span<const signed char> mTranslationArray;
> +     };
> + 
> +     class Utf8Encoder
>