I managed to compiled emulators/mame in an rpi4.

Some thoughts about the port:

In patch-makefile

 ifeq ($(OS),windows)
 ifeq (posix,$(SHELLTYPE))
-GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> 
/dev/null)
-CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head 
-n 1 | grep clang | sed 
"s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
+GCC_VERSION      := $(shell cc -dumpversion 2> /dev/null)
+CLANG_VERSION    := $(shell cc --version 2> /dev/null | head -n 1 | grep -e 
'version [0-9]\.[0-9]\.[0-9]' -o | sed -e 's,version ,,' | tail -n 1)
 PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo 
python)
 GIT_AVAILABLE    := $(shell git --version > /dev/null 2>&1 && echo git)
 else

This doesn't make any sense, this part is only processed on windows.
But you'd need 'grep clang' anyway or CLANG_VERSION would be set
even if the compiler is gcc. Note that if this weren't the case,
you could just use -dumpversion.

CC ends up defined to gcc by default by makefile, but using OVERRIDE_CC
isn't sufficient because CLANG_VERSION is left out of the conditional
code:

[...]
ifdef OVERRIDE_CC
GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(OVERRIDE_CC)) -dumpversion 
2> /dev/null)
else
GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> 
/dev/null)
endif
ifeq ($(findstring emcc,$(CC)),emcc)
CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  -v  2>&1 >/dev/null 
| grep 'clang version' | head -n 1 | grep -e 'version [0-9]\+\.[0-9]\+
\(\.[0-9]\+\)\?' -o | grep -e '[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | tail -n 1)
else
CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  --version  2> 
/dev/null | head -n 1 | grep -e 'version [0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o
 | grep -e '[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | tail -n 1)
endif
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
endif

ifeq ($(CLANG_VERSION),)
$(info GCC $(GCC_VERSION) detected)
else
$(info Clang $(CLANG_VERSION) detected)
ifneq ($(TARGETOS),asmjs)
ifeq ($(ARCHITECTURE),_x64)
ARCHITECTURE := _x64_clang
else
ifneq ($(filter arm64%,$(UNAME_M)),)
ARCHITECTURE := _arm64_clang
else
ARCHITECTURE := _x86_clang
endif
endif
endif
endif
[...]

Even correcting this, CLANG_VERSION is not detected because grep
is using gnu basic regular expression syntax, in openbsd BRE there
is no + nor ? [re_format(7)].

Here is a diff only tested on arm64.

I left out emcc of the ifdef OVERRIDE_CC statement, add it if you
think it will be of any use in the future.

Regards,
adr

=========================================================================
Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/mame/Makefile,v
retrieving revision 1.57
diff -u -p -r1.57 Makefile
--- Makefile    1 Dec 2021 14:55:20 -0000       1.57
+++ Makefile    27 Feb 2022 10:49:37 -0000
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.57 2021/12/01 14:55:20 fcambus Exp $

 BROKEN-i386 =  broken on 32-bit; enum in src/frontend/mame/ui/videoopt.h 
starting at 0x80000000
-ONLY_FOR_ARCHS = amd64 i386
+ONLY_FOR_ARCHS = amd64 i386 arm64
 DPB_PROPERTIES = parallel

 USE_WXNEEDED = Yes
Index: patches/patch-makefile
===================================================================
RCS file: /cvs/ports/emulators/mame/patches/patch-makefile,v
retrieving revision 1.20
diff -u -p -r1.20 patch-makefile
--- patches/patch-makefile      1 Oct 2021 12:13:51 -0000       1.20
+++ patches/patch-makefile      27 Feb 2022 10:49:37 -0000
@@ -27,14 +27,51 @@ Index: makefile
  # set the symbols level
  ifdef SYMBOLS
  PARAMS += --SYMBOLS='$(SYMBOLS)'
-@@ -995,8 +990,8 @@ endif
- - ifeq ($(OS),windows)
- ifeq (posix,$(SHELLTYPE))
--GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> 
/dev/null)
--CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head 
-n 1 | grep clang | sed 
"s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
-+GCC_VERSION      := $(shell cc -dumpversion 2> /dev/null)
-+CLANG_VERSION    := $(shell cc --version 2> /dev/null | head -n 1 | grep -e 
'version [0-9]\.[0-9]\.[0-9]' -o | sed -e 's,version ,,' | tail -n 1)
- PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo 
python)
- GIT_AVAILABLE    := $(shell git --version > /dev/null 2>&1 && echo git)
+@@ -1024,14 +1019,15 @@ endif
+ else
+ ifdef OVERRIDE_CC
+ GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(OVERRIDE_CC)) -dumpversion 
2> /dev/null)
++CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(OVERRIDE_CC))  --version  
2> /dev/null | head -n 1 | grep -Ee 'version [0-9]+\.[0-9]+(\.[0-9]+)?' -o | 
grep -Ee '[0-9]+\.[0-9]+(\.[0-9]+)?' -o | tail -n 1)
  else
+ GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> 
/dev/null)
+-endif
+ ifeq ($(findstring emcc,$(CC)),emcc)
+-CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  -v  2>&1 
>/dev/null | grep 'clang version' | head -n 1 | grep -e 'version 
[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | grep -e '[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | tail 
-n 1)
++CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  -v  2>&1 
>/dev/null | grep 'clang version' | head -n 1 | grep -Ee 'version 
[0-9]+\.[0-9]+(\.[0-9]+)?' -o | grep -Ee '[0-9]+\.[0-9]+(\.[0-9]+)?' -o | tail -n 1)
+ else
+-CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  --version  2> 
/dev/null | head -n 1 | grep -e 'version [0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | 
grep -e '[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | tail -n 1)
++CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  --version  2> 
/dev/null | head -n 1 | grep -Ee 'version [0-9]+\.[0-9]+(\.[0-9]+)?' -o | grep -Ee 
'[0-9]+\.[0-9]+(\.[0-9]+)?' -o | tail -n 1)
+ endif
++endif
+ PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo 
python)
+ GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
+ endif
+@@ -1483,6 +1479,28 @@ openbsd: openbsd_x86
+ openbsd_x86: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd/Makefile
+       $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd 
config=$(CONFIG)32 precompile
+       $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd 
config=$(CONFIG)32
++
++#-------------------------------------------------
++# gmake-openbsd-clang
++#-------------------------------------------------
++
++$(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile: makefile $(SCRIPTS) $(GENIE)
++      $(SILENT) $(GENIE) $(PARAMS) $(TARGET_PARAMS) --gcc=openbsd-clang 
--gcc_version=$(CLANG_VERSION) $(MAKETYPE)
++
++.PHONY: openbsd_x64_clang
++openbsd_x64_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
++      $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang 
config=$(CONFIG)64 precompile
++      $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang 
config=$(CONFIG)64
++
++.PHONY: openbsd_x32_clang
++openbsd_x32_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
++      $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang 
config=$(CONFIG)32 precompile
++      $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang 
config=$(CONFIG)32
++
++.PHONY: openbsd_arm64_clang
++openbsd_arm64_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
++      $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang 
config=$(CONFIG) precompile
++      $(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang 
config=$(CONFIG)
+ + #-------------------------------------------------
+ # Clean/bootstrap
Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/mame/Makefile,v
retrieving revision 1.57
diff -u -p -r1.57 Makefile
--- Makefile	1 Dec 2021 14:55:20 -0000	1.57
+++ Makefile	27 Feb 2022 10:49:37 -0000
@@ -1,7 +1,7 @@
 # $OpenBSD: Makefile,v 1.57 2021/12/01 14:55:20 fcambus Exp $
 
 BROKEN-i386 =	broken on 32-bit; enum in src/frontend/mame/ui/videoopt.h starting at 0x80000000
-ONLY_FOR_ARCHS = amd64 i386
+ONLY_FOR_ARCHS = amd64 i386 arm64
 DPB_PROPERTIES = parallel
 
 USE_WXNEEDED =	Yes
Index: patches/patch-makefile
===================================================================
RCS file: /cvs/ports/emulators/mame/patches/patch-makefile,v
retrieving revision 1.20
diff -u -p -r1.20 patch-makefile
--- patches/patch-makefile	1 Oct 2021 12:13:51 -0000	1.20
+++ patches/patch-makefile	27 Feb 2022 10:49:37 -0000
@@ -27,14 +27,51 @@ Index: makefile
  # set the symbols level
  ifdef SYMBOLS
  PARAMS += --SYMBOLS='$(SYMBOLS)'
-@@ -995,8 +990,8 @@ endif
- 
- ifeq ($(OS),windows)
- ifeq (posix,$(SHELLTYPE))
--GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
--CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
-+GCC_VERSION      := $(shell cc -dumpversion 2> /dev/null)
-+CLANG_VERSION    := $(shell cc --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\.[0-9]' -o | sed -e 's,version ,,' | tail -n 1)
- PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
- GIT_AVAILABLE    := $(shell git --version > /dev/null 2>&1 && echo git)
+@@ -1024,14 +1019,15 @@ endif
+ else
+ ifdef OVERRIDE_CC
+ GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(OVERRIDE_CC)) -dumpversion 2> /dev/null)
++CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(OVERRIDE_CC))  --version  2> /dev/null | head -n 1 | grep -Ee 'version [0-9]+\.[0-9]+(\.[0-9]+)?' -o | grep -Ee '[0-9]+\.[0-9]+(\.[0-9]+)?' -o | tail -n 1)
  else
+ GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
+-endif
+ ifeq ($(findstring emcc,$(CC)),emcc)
+-CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  -v  2>&1 >/dev/null | grep 'clang version' | head -n 1 | grep -e 'version [0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | grep -e '[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | tail -n 1)
++CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  -v  2>&1 >/dev/null | grep 'clang version' | head -n 1 | grep -Ee 'version [0-9]+\.[0-9]+(\.[0-9]+)?' -o | grep -Ee '[0-9]+\.[0-9]+(\.[0-9]+)?' -o | tail -n 1)
+ else
+-CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  --version  2> /dev/null | head -n 1 | grep -e 'version [0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | grep -e '[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?' -o | tail -n 1)
++CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC))  --version  2> /dev/null | head -n 1 | grep -Ee 'version [0-9]+\.[0-9]+(\.[0-9]+)?' -o | grep -Ee '[0-9]+\.[0-9]+(\.[0-9]+)?' -o | tail -n 1)
+ endif
++endif
+ PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
+ GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
+ endif
+@@ -1483,6 +1479,28 @@ openbsd: openbsd_x86
+ openbsd_x86: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd/Makefile
+ 	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd config=$(CONFIG)32 precompile
+ 	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd config=$(CONFIG)32
++
++#-------------------------------------------------
++# gmake-openbsd-clang
++#-------------------------------------------------
++
++$(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile: makefile $(SCRIPTS) $(GENIE)
++	$(SILENT) $(GENIE) $(PARAMS) $(TARGET_PARAMS) --gcc=openbsd-clang --gcc_version=$(CLANG_VERSION) $(MAKETYPE)
++
++.PHONY: openbsd_x64_clang
++openbsd_x64_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
++	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang config=$(CONFIG)64 precompile
++	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang config=$(CONFIG)64
++
++.PHONY: openbsd_x32_clang
++openbsd_x32_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
++	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang config=$(CONFIG)32 precompile
++	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang config=$(CONFIG)32
++
++.PHONY: openbsd_arm64_clang
++openbsd_arm64_clang: generate $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang/Makefile
++	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang config=$(CONFIG) precompile
++	$(SILENT) $(MAKE) -C $(PROJECTDIR)/$(MAKETYPE)-openbsd-clang config=$(CONFIG)
+ 
+ #-------------------------------------------------
+ # Clean/bootstrap

Reply via email to