Let irrlamb build on non-x86 archs

Sync ode/odeconfig.h with upstream ode, with more #ifdef goo to cater
for non-x86 archs.

Keep using SSE on amd64, and also on i386 where the speedup would make
sense for this port, as hinted by sthen@.

Maintainer timeout, ok sthen@ op@
This commit is contained in:
jca 2022-04-18 23:34:06 +00:00
parent 11f36733ca
commit 283001ebfa
3 changed files with 74 additions and 4 deletions

View File

@ -1,6 +1,3 @@
BROKEN-sparc64 = uses sse, but fails an assert even without sse
ONLY_FOR_ARCHS = amd64 i386 # build configuration forces sse
V = 1.0.1
COMMENT = third person, 3D physics game
DISTNAME = irrlamb-$Vr613-src
@ -31,6 +28,13 @@ WRKDIST = ${WRKDIR}/irrlamb-$Vr613
NO_TEST = Yes
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
SSE_FLAGS = -msse -mfpmath=sse
.else
SSE_FLAGS =
.endif
SUBST_VARS += SSE_FLAGS
post-extract:
rm -rf ${WRKSRC}/src/irrlicht

View File

@ -1,7 +1,7 @@
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -29,7 +29,6 @@ if(WIN32)
@@ -29,11 +29,10 @@ if(WIN32)
elseif(UNIX)
add_definitions(-DPLATFORM=0)
add_definitions(-DLUA_USE_LINUX)
@ -9,6 +9,11 @@ Index: CMakeLists.txt
endif()
# compiler flags
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations -pedantic -std=gnu++11 -msse -mfpmath=sse")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations -pedantic -std=gnu++11 ${SSE_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DdNODEBUG -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DdNODEBUG -s")
@@ -72,7 +71,7 @@ find_package(Threads REQUIRED)
# include paths

View File

@ -0,0 +1,61 @@
$OpenBSD: patch-src_ode_odeconfig_h,v 1.1 2022/04/18 23:34:06 jca Exp $
Sync this file with upstream, up to commit 92362ac.
https://bitbucket.org/odedevs/ode/src/92362ac1e6cf3a12343493f67807780505253e1c/include/ode/odeconfig.h
Lets this build on riscv64 and friends.
Index: src/ode/odeconfig.h
--- src/ode/odeconfig.h.orig
+++ src/ode/odeconfig.h
@@ -80,8 +80,12 @@
#endif // #if !defined(__GNUC__)
-/* Well-defined common data types...need to define for 64 bit systems */
-#if defined(__aarch64__)
+/* Well-defined common data types...need to be defined for 64 bit systems */
+#if defined(__aarch64__) || defined(__alpha__) || defined(__ppc64__) \
+ || defined(__s390__) || defined(__s390x__) || defined(__zarch__) \
+ || defined(__mips__) || defined(__powerpc64__) || defined(__riscv) \
+ || defined(__loongarch64) \
+ || (defined(__sparc__) && defined(__arch64__))
#include <stdint.h>
typedef int64_t dint64;
typedef uint64_t duint64;
@@ -97,13 +101,13 @@
typedef ptrdiff_t ddiffint;
typedef size_t dsizeint;
-#elif defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)
+#elif (defined(_M_IA64) || defined(__ia64__) || defined(_M_AMD64) || defined(__x86_64__)) && !defined(__ILP32__) && !defined(_ILP32)
#define X86_64_SYSTEM 1
#if defined(_MSC_VER)
typedef __int64 dint64;
typedef unsigned __int64 duint64;
#else
-#if defined(_LP64)
+#if defined(_LP64) || defined(__LP64__)
typedef long dint64;
typedef unsigned long duint64;
#else
@@ -210,6 +214,20 @@ typedef unsigned long duint64;
#define _ode_nextafterf(x, y) nextafterf(x, y)
#define _ode_nextafter(x, y) nextafter(x, y)
#endif
+
+
+#if defined(_MSC_VER) && _MSC_VER < 1700 // Also mind similar defines in ccd/vec3.h
+/* Define fmin, fmax, fminf, fmaxf which are missing from MSVC (up to VS2008 at least) */
+ static __inline double _ode_fmin(double x, double y) { return __min(x, y); }
+ static __inline double _ode_fmax(double x, double y) { return __max(x, y); }
+ static __inline float _ode_fminf(float x, float y) { return __min(x, y); }
+ static __inline float _ode_fmaxf(float x, float y) { return __max(x, y); }
+#else // #if !defined(_MSC_VER) || _MSC_VER >= 1700
+ #define _ode_fmin(x, y) fmin(x, y)
+ #define _ode_fmax(x, y) fmax(x, y)
+ #define _ode_fminf(x, y) fminf(x, y)
+ #define _ode_fmaxf(x, y) fmaxf(x, y)
+#endif // #if !defined(_MSC_VER) || _MSC_VER >= 1700
#endif