git: 91a4c28de9dc - main - misc/bb: fix building on non-x86

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Fri, 22 Oct 2021 12:09:19 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=91a4c28de9dc90927ba0acc201c6c1577f4fde0c

commit 91a4c28de9dc90927ba0acc201c6c1577f4fde0c
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-10-22 11:42:44 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-10-22 11:42:44 +0000

    misc/bb: fix building on non-x86
    
    regparm is strictly i386, but clang allows it on amd64.
    
    Building on other architectures fails with:
    In file included from zoom.c:56:
    In file included from ./zoom.h:30:
    ./formulas.h:53:63: error: 'regparm' is not valid on this platform
        int (*calculate) (number_t, number_t, number_t, number_t) REGISTERS(3);
                                                                  ^         ~
    ./config.h:42:38: note: expanded from macro 'REGISTERS'
    
    GCC builts in just fine.
---
 misc/bb/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/misc/bb/Makefile b/misc/bb/Makefile
index 91a4fb01cfaa..e938b862d9ae 100644
--- a/misc/bb/Makefile
+++ b/misc/bb/Makefile
@@ -15,11 +15,6 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 LIB_DEPENDS=	libaa.so:graphics/aalib \
 		libmikmod.so:audio/libmikmod
 
-BROKEN_aarch64=		fails to build: regparm is not valid on this platform
-BROKEN_armv6=		fails to build: regparm is not valid on this platform
-BROKEN_armv7=		fails to build: regparm is not valid on this platform
-BROKEN_riscv64=		fails to build: regparm is not valid on this platform
-
 GNU_CONFIGURE=	yes
 WRKSRC=		${WRKDIR}/bb-1.3.0
 PORTDOCS=	README
@@ -28,6 +23,12 @@ PLIST_FILES=	bin/bb man/man1/bb.1.gz share/bb/bb.s3m share/bb/bb2.s3m \
 
 OPTIONS_DEFINE=	DOCS
 
+.include <bsd.port.options.mk>
+
+.if ${ARCH} != amd64 && ${ARCH} != i386
+USES+=		compiler:gcc-c++11-lib
+.endif
+
 pre-patch:
 	@${FIND} ${WRKSRC} -type f | ${XARGS} ${REINPLACE_CMD} -E -e "s@#include +<malloc.h>@#include <stdlib.h>@g" \
 		-e 's, REGISTERS \(3\),,g'