git: 84ba2383e7be - main - games/openenroth: unbreak the port's build in pre-C++20 environments

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Sat, 04 Feb 2023 15:11:13 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=84ba2383e7be058b5e4f799fbe3fafeefcfb3761

commit 84ba2383e7be058b5e4f799fbe3fafeefcfb3761
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-02-04 15:10:00 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-02-04 15:10:00 +0000

    games/openenroth: unbreak the port's build in pre-C++20 environments
    
    Pull Clang 13 when it's not available in the base (via USES+=llvm:13)
    and use Boost's ``unordered_map'' implementation while the system one
    is insufficient; avoid ``std::u8string'' for the same reason.
    
    Set LLD_UNSAFE to unbreak linking against OpenAL on i386 (ld: error:
    cannot preempt symbol: alGetError).
    
    While here, slightly wordsmith the installation message.
    
    Reported by:    pkg-fallout
---
 games/openenroth/Makefile             | 19 +++++++++++++++++++
 games/openenroth/files/pkg-message.in |  6 +++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/games/openenroth/Makefile b/games/openenroth/Makefile
index 11d8fd314767..7074cc1e72bd 100644
--- a/games/openenroth/Makefile
+++ b/games/openenroth/Makefile
@@ -28,6 +28,18 @@ GH_SUBDIR=	thirdparty/cli11:cli11 thirdparty/fast_float:ff \
 		thirdparty/magic_enum:me thirdparty/mini:mini \
 		thirdparty/nlohmann_json:nj
 
+.include <bsd.port.options.mk>
+
+.if !exists(/usr/include/c++/v1/concepts)
+BUILD_DEPENDS+=	${LOCALBASE}/include/boost/unordered_map.hpp:devel/boost-libs
+USES+=		llvm:13
+CXX=		${LLVM_PREFIX}/bin/clang++
+.endif
+
+.if ${ARCH} == i386
+LLD_UNSAFE=	yes
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} -e '/CMAKE_CXX_STANDARD/s,23,20,' \
 		${WRKSRC}/CMakeLists.txt
@@ -40,6 +52,13 @@ post-patch:
 		${WRKSRC}/src/Utility/CMakeLists.txt
 	@${REINPLACE_CMD} -e 's, c++abi,,' \
 		${WRKSRC}/thirdparty/luajit/cmake/src/CMakeLists.txt
+.if !exists(/usr/include/c++/v1/concepts)
+	@${REINPLACE_CMD} -e '/#include/s,unordered_map,boost/&.hpp,' \
+	    -e 's,std::unordered_map,boost::unordered_map,' \
+		${WRKSRC}/src/Library/Serialization/EnumSerializer.h
+	@${REINPLACE_CMD} -e '/#ifdef/s,ANDROID,${OPSYS},' \
+		${WRKSRC}/src/Utility/FileSystem.cpp
+.endif
 
 do-install:
 	${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/OpenEnroth \
diff --git a/games/openenroth/files/pkg-message.in b/games/openenroth/files/pkg-message.in
index d0d13d57a170..ac65d1724090 100644
--- a/games/openenroth/files/pkg-message.in
+++ b/games/openenroth/files/pkg-message.in
@@ -1,12 +1,12 @@
 [
 { type: install
   message: <<EOM
-OpenEnroth requires original or GoG version of Might and Magic VII
+OpenEnroth requires original or GOG version of Might and Magic VII
 game assets available in the current directory or the path pointed
 by the OPENENROTH_MM7_PATH environment variable.
 
-Additionally, then you would have to copy (or create symbolic link
-to) the `%%DATADIR%%/shaders' directory there.
+Additionally, you would have to copy (or create a symbolic link to)
+the `%%DATADIR%%/shaders' directory there.
 EOM
 }
 ]