git: 85d08af5eaa4 - main - games/openmw: unbreak build on i386 (+)

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Tue, 13 Aug 2024 07:38:01 UTC
The branch main has been updated by fluffy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=85d08af5eaa43ab141d6905bdac616ddb300274f

commit 85d08af5eaa43ab141d6905bdac616ddb300274f
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2024-08-13 07:36:25 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2024-08-13 07:37:53 +0000

    games/openmw: unbreak build on i386 (+)
    
    While here, unbreak build with GCC14+
    
    Reported by:    pkg-fallout
---
 games/openmw/Makefile                                 | 19 +++++++++++++++++--
 .../patch-apps_openmw_mwstate_charactermanager.hpp    | 11 +++++++++++
 games/openmw/files/patch-components_bsa_bsa__file.cpp | 10 ++++++++++
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/games/openmw/Makefile b/games/openmw/Makefile
index fbb43aa0aa90..6999dd3042ca 100644
--- a/games/openmw/Makefile
+++ b/games/openmw/Makefile
@@ -41,16 +41,31 @@ CMAKE_ARGS=	-DDESIRED_QT_VERSION=5 \
 		-DMORROWIND_DATA_FILES="${DATADIR}/data" \
 		-DOPENMW_RESOURCE_FILES="${DATADIR}/resources"
 
+# passed from openal to prevent linker errors
+LDFLAGS+=	-Wl,--as-needed
+LDFLAGS_i386=	-Wl,-z,notext
+
 OPTIONS_DEFINE=	DOCS
 
 DOCS_CMAKE_BOOL=	BUILD_DOCS
+DOCS_BINARY_ALIAS=	sphinx-build=sphinx-build-${PYTHON_VER}
 DOCS_BUILD_DEPENDS=	doxygen>0:devel/doxygen \
-			sphinx-build:textproc/py-sphinx@${PY_FLAVOR}
+			${PYTHON_PKGNAMEPREFIX}sphinx>=0,1:textproc/py-sphinx@${PY_FLAVOR}
 DOCS_USES=		python:build
 
 PORTDOCS=	*
 
+.include <bsd.port.pre.mk>
+
+# The following is actually meant for lld 15.0 and later, but the ports
+# framework does not support LINKER_TYPE and LINKER_VERSION yet.
+.if ${COMPILER_TYPE} == "clang"
+# Turn off checking of dynamic relocations, to avoid lld diagnostics about
+# possibly incorrect addend values.
+LDFLAGS_i386+=	-Wl,--no-check-dynamic-relocations
+.endif
+
 post-install:
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/*
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/games/openmw/files/patch-apps_openmw_mwstate_charactermanager.hpp b/games/openmw/files/patch-apps_openmw_mwstate_charactermanager.hpp
new file mode 100644
index 000000000000..fe61c1fc661e
--- /dev/null
+++ b/games/openmw/files/patch-apps_openmw_mwstate_charactermanager.hpp
@@ -0,0 +1,11 @@
+--- apps/openmw/mwstate/charactermanager.hpp.orig	2023-08-08 09:23:20 UTC
++++ apps/openmw/mwstate/charactermanager.hpp
+@@ -1,6 +1,8 @@
+ #ifndef GAME_STATE_CHARACTERMANAGER_H
+ #define GAME_STATE_CHARACTERMANAGER_H
+ 
++#include <list>
++
+ #include <boost/filesystem/path.hpp>
+ 
+ #include "character.hpp"
diff --git a/games/openmw/files/patch-components_bsa_bsa__file.cpp b/games/openmw/files/patch-components_bsa_bsa__file.cpp
new file mode 100644
index 000000000000..0dcb26d6581f
--- /dev/null
+++ b/games/openmw/files/patch-components_bsa_bsa__file.cpp
@@ -0,0 +1,10 @@
+--- components/bsa/bsa_file.cpp.orig	2023-08-08 09:23:20 UTC
++++ components/bsa/bsa_file.cpp
+@@ -26,6 +26,7 @@
+ #include <components/files/constrainedfilestream.hpp>
+ 
+ #include <cassert>
++#include <algorithm>
+ 
+ #include <boost/filesystem/path.hpp>
+ #include <boost/filesystem/fstream.hpp>