On Tue, Apr 05 2022, Stuart Henderson <s...@spacehopper.org> wrote:
> On 2022/04/05 20:13, Jeremie Courreges-Anglas wrote:
>> 
>> (post-7.1)
>> 
>> On Mon, Jan 03 2022, Jeremie Courreges-Anglas <j...@wxcvbn.org> wrote:
>> > On Thu, Dec 30 2021, Pascal Stumpf <pas...@stumpf.co> wrote:
>> >> Here's an update for games/irrlamb, which now no longer uses
>> >> devel/bullet.  It has an internal copy of Irrlicht, but working around
>> >> this to use the version from ports seems to not create any issues.
>> >
>> > This breaks on !(amd64) for various reasons.
>> >
>> > 1. -msse -mfpmath=sse should only be used on amd64, see Makefile and
>> >   patches/patch-CMakeLists_txt below.
>> >
>> > 2. src/ode/odeconfig.h is a pile of ifdef kludges.  I added a hack in the
>> >   second part of the diff below but I really suggest not using it as is.
>> >   Maybe this should only be built on amd64.  And arm64.  *argh*.
>> 
>> Updated diff that builds on sparc64 and riscv64, and probably all our
>> architectures.  Since the package seems currently built with SSE i386,
>> either the diff lacks a bump or I could tweak the conditional to keep
>> using SSE on i386.
>> 
>> Aren't we supposed to disable SSE on i386?  Or is it done on
>> a case-by-case basis?
>
> Case-by-case for ports. Probably makes sense to keep sse for this. There
> are many things which just don't make any sense to run on an i386 that's
> so old it doesn't even have SSE (that is very old..) Especially if it
> means making it worse on slightly newer machines which can run it but
> only barely.

Thanks for confirming.  With this in mind, ok?  (post-lock)


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/games/irrlamb/Makefile,v
retrieving revision 1.16
diff -u -p -r1.16 Makefile
--- Makefile    24 Mar 2022 07:57:06 -0000      1.16
+++ Makefile    5 Apr 2022 21:09:56 -0000
@@ -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
@@ -30,6 +27,13 @@ RUN_DEPENDS =        devel/desktop-file-utils
 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
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /home/cvs/ports/games/irrlamb/patches/patch-CMakeLists_txt,v
retrieving revision 1.2
diff -u -p -r1.2 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt        11 Mar 2022 19:04:34 -0000      1.2
+++ patches/patch-CMakeLists_txt        5 Apr 2022 21:09:30 -0000
@@ -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
Index: patches/patch-src_ode_odeconfig_h
===================================================================
RCS file: patches/patch-src_ode_odeconfig_h
diff -N patches/patch-src_ode_odeconfig_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_ode_odeconfig_h   5 Apr 2022 21:09:30 -0000
@@ -0,0 +1,61 @@
+$OpenBSD$
+
+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

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to