git: 322fe7fe9b70 - main - devel/gcc-arm-embedded: fix build on powerpc64*

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Fri, 01 Aug 2025 11:59:01 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=322fe7fe9b70f94af933d5fd1de53a3d3fbecdc3

commit 322fe7fe9b70f94af933d5fd1de53a3d3fbecdc3
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2025-08-01 11:31:21 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2025-08-01 11:54:45 +0000

    devel/gcc-arm-embedded: fix build on powerpc64*
    
    1. Fix gmp build, set ABI="mode64".
    2. Fix compiler detection for gmp - currently only
    powerpc64{,le}-unknown-freebsd$VERSION-gcc, gcc and gcc64 are looked for.
    3. Fix architecture detection - uname -p should be used on FreeBSD.
---
 devel/gcc-arm-embedded/Makefile                               |  8 ++++++++
 .../files/patch-gnu-devtools-for-arm_utilities.sh             | 11 +++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/devel/gcc-arm-embedded/Makefile b/devel/gcc-arm-embedded/Makefile
index bd7e485e463e..051092bcc592 100644
--- a/devel/gcc-arm-embedded/Makefile
+++ b/devel/gcc-arm-embedded/Makefile
@@ -71,6 +71,12 @@ PLIST_SUB+=	GCC_VERSION=${GCC_VERSION} FULL_VERSION=${FULL_VERSION} TARGET=${TAR
 
 .include <bsd.port.options.mk>
 
+.if ${ARCH:Mpowerpc64*}
+GMP_ABI=		ABI="mode64"
+.else
+GMP_ABI=
+.endif
+
 .if ${PORT_OPTIONS:MPYGDB}
 PYGDB_BUILD_OPT=	--enable-gdb-with-python=${PYTHON_CMD}
 .else
@@ -95,6 +101,8 @@ post-extract:
 	@${MV} ${WRKSRC}/gnu-devtools-for-arm-${GL_TAGNAME_tools} ${WRKSRC}/gnu-devtools-for-arm
 
 do-build:
+	${GMP_ABI}							\
+	CC="${CC}"							\
 	PATH=${WRKSRC}/gnu-devtools-for-arm:${PATH}			\
 	installdir=${WRKDIR}/${DIR_NAME}				\
 	LOCALBASE="${LOCALBASE}"					\
diff --git a/devel/gcc-arm-embedded/files/patch-gnu-devtools-for-arm_utilities.sh b/devel/gcc-arm-embedded/files/patch-gnu-devtools-for-arm_utilities.sh
index b89687372592..5a0692c0182b 100644
--- a/devel/gcc-arm-embedded/files/patch-gnu-devtools-for-arm_utilities.sh
+++ b/devel/gcc-arm-embedded/files/patch-gnu-devtools-for-arm_utilities.sh
@@ -1,4 +1,4 @@
---- gnu-devtools-for-arm/utilities.sh.orig	2025-03-31 10:59:01 UTC
+--- gnu-devtools-for-arm/utilities.sh.orig	2025-07-31 23:01:18 UTC
 +++ gnu-devtools-for-arm/utilities.sh
 @@ -33,6 +33,8 @@ number_of_cores()
      grep -c "^processor" /proc/cpuinfo
@@ -9,7 +9,14 @@
    else
      echo "1"
    fi
-@@ -56,6 +58,9 @@ find_build_triple ()
+@@ -50,12 +52,15 @@ find_build_triple ()
+ # Get the triple of the machine we're running on, i.e. the build machine.
+ find_build_triple ()
+ {
+-  machine=$(uname -m)
++  machine=$(uname -p)
+   plat=$(uname -s)
+   if [[ "$plat" == "Darwin" ]]; then
      echo "$machine-apple-darwin"    # e.g. x86_64-apple-darwin or arm64-apple-darwin
    elif [[ "$plat" == "Linux" ]]; then
      echo "$machine-none-linux-gnu"  # e.g. x86_64-none-linux-gnu