On Fri, Feb 11, 2022 at 09:40:12PM -0700, Kurt Mosiejczuk wrote:
> http://build-failures.rhaalovely.net/sparc64/2022-02-09/emulators/openmsx.log

> eg++: error: unrecognized command line option '-fconstexpr-steps=2000000'; 
> did you mean '-fconstexpr-depth='?
> gmake: *** [build/main.mk:500: derived/sparc-openbsd-opt/obj/Autofire.cc.o] 
> Error 1

main.mk looks at CXX to decide whether it is clang or gcc, which does
not work since we (always?) pass CXX=c++ which is then the usual symlink
in ${WRKDIR}/bin/ to CHOSEN_COMPILER.

So to fix this, just pass our choice and use that to decide.
I've verified that on amd64 this takes the base-clang path which uses
`-fconstexpr-steps=2000000' while on sparc64 the ports-gcc path is used
with avoids that flag.

We set `COMPILER=base-clang ports-gcc' so other cases cannot happen,
thus drop the old hunk that merely set the standard to C++11.

amd64 builds fine, no PLIST change.
sparc64 now also builds fine, no PLIST change.

Zap default python version while here.

Feedback? Objections? OK?

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/emulators/openmsx/Makefile,v
retrieving revision 1.31
diff -u -p -r1.31 Makefile
--- Makefile    6 Aug 2021 08:02:10 -0000       1.31
+++ Makefile    12 Feb 2022 12:19:25 -0000
@@ -7,6 +7,7 @@ BROKEN-alpha =  OOM when building src/cpu
 COMMENT =      MSX home computer emulator
 
 V =            17.0
+REVISION =     0
 DISTNAME =     openmsx-$V
 
 CATEGORIES =   emulators
@@ -41,7 +42,6 @@ NO_TEST =     Yes
 
 MODULES =      lang/python \
                lang/tcl
-MODPY_VERSION =        ${MODPY_DEFAULT_VERSION_3}
 
 MODPY_RUNDEP = No
 MAKE_FILE =    GNUmakefile
@@ -51,6 +51,7 @@ MAKE_FLAGS =  CC="${CC}" \
                CXX="${CXX}" \
                CFLAGS="${CFLAGS}" \
                CXXFLAGS="${CXXFLAGS}" \
+               CHOSEN_COMPILER=${CHOSEN_COMPILER} \
                OPENMSX_STRIP=false \
                V=1
 
Index: patches/patch-build_main_mk
===================================================================
RCS file: /home/cvs/ports/emulators/openmsx/patches/patch-build_main_mk,v
retrieving revision 1.4
diff -u -p -r1.4 patch-build_main_mk
--- patches/patch-build_main_mk 6 Aug 2021 08:02:10 -0000       1.4
+++ patches/patch-build_main_mk 12 Feb 2022 12:14:04 -0000
@@ -1,4 +1,8 @@
 $OpenBSD: patch-build_main_mk,v 1.4 2021/08/06 08:02:10 mestre Exp $
+
+Fix compiler detection by using CHOSEN_COMPILER not CXX
+(ports-gcc does not know `-fconstexpr-steps`)
+
 Index: build/main.mk
 --- build/main.mk.orig
 +++ build/main.mk
@@ -7,16 +11,16 @@ Index: build/main.mk
  WINDRES?=windres
  DEPEND_FLAGS:=
 -ifneq ($(filter %clang++,$(CXX))$(filter clang++%,$(CXX)),)
-+ifneq ($(filter %clang++,$(CXX))$(filter clang++%,$(CXX))$(filter 
c++,$(CXX)),)
++ifeq ($(CHOSEN_COMPILER),base-clang)
    # Enable C++17 (for the most part supported since clang-5)
    COMPILE_FLAGS+=-std=c++17 -fconstexpr-steps=2000000
    COMPILE_FLAGS+=-Wall -Wextra -Wundef -Wno-invalid-offsetof -Wunused-macros 
-Wdouble-promotion -Wmissing-declarations -Wshadow -Wold-style-cast 
-Wzero-as-null-pointer-constant
-@@ -361,6 +361,8 @@ else
-   else
-     $(warning Unsupported compiler: $(CXX), please update Makefile)
-   endif
-+  # Enable C++11
-+  COMPILE_FLAGS+=-std=c++11
- endif
- endif
- 
+@@ -344,7 +344,7 @@ ifneq ($(filter %clang++,$(CXX))$(filter clang++%,$(CX
+   CC:=$(subst clang++,clang,$(CXX))
+   DEPEND_FLAGS+=-MP
+ else
+-ifneq ($(filter %g++,$(CXX))$(filter g++%,$(CXX))$(findstring /g++-,$(CXX)),)
++ifeq ($(CHOSEN_COMPILER),ports-gcc)
+   # Generic compilation flags.
+   COMPILE_FLAGS+=-pipe
+   # Enable C++17  (almost fully supported since gcc-7)

Reply via email to