git: eccb97996d27 - main - lang/mono: port to powerpc64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Wed, 06 Oct 2021 21:07:24 UTC
The branch main has been updated by pkubaj:

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

commit eccb97996d2799c09c1dff6ba6421a6301c83a45
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2021-10-06 20:52:42 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2021-10-06 20:52:42 +0000

    lang/mono: port to powerpc64
---
 lang/mono/Makefile                         |  4 ++--
 lang/mono/files/patch-configure.ac         | 21 +++++++++++++++++----
 lang/mono/files/patch-mono_mini_mini-ppc.c | 20 ++++++++++++++++++++
 3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/lang/mono/Makefile b/lang/mono/Makefile
index 541b96c9dd10..4414273daadb 100644
--- a/lang/mono/Makefile
+++ b/lang/mono/Makefile
@@ -13,7 +13,7 @@ COMMENT=	Open source implementation of .NET Development Framework
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-ONLY_FOR_ARCHS=		amd64 armv6 armv7 i386 powerpc
+ONLY_FOR_ARCHS=		amd64 armv6 armv7 i386 powerpc powerpc64
 
 BUILD_DEPENDS=	p5-XML-Parser>=0:textproc/p5-XML-Parser \
 		bash:shells/bash \
@@ -65,7 +65,7 @@ OPTIONS_SLAVE=	MONOLITE
 
 .include <bsd.port.options.mk>
 
-.if ${ARCH} == powerpc
+.if ${ARCH:Mpowerpc*}
 PLIST+=	${.CURDIR}/pkg-plist.powerpc
 .else
 CONFIGURE_ARGS+=	--enable-btls
diff --git a/lang/mono/files/patch-configure.ac b/lang/mono/files/patch-configure.ac
index 280b4da2ddb1..acd3051f7d70 100644
--- a/lang/mono/files/patch-configure.ac
+++ b/lang/mono/files/patch-configure.ac
@@ -1,6 +1,6 @@
---- configure.ac.orig	2018-04-18 10:51:42.000000000 +0300
-+++ configure.ac	2018-06-24 02:38:19.860780000 +0300
-@@ -3271,6 +3271,8 @@
+--- configure.ac.orig	2018-08-24 15:19:14 UTC
++++ configure.ac
+@@ -3298,6 +3298,8 @@ case "$host" in
  			BTLS_PLATFORM=i386
  			;;
  		  openbsd*|freebsd*|kfreebsd-gnu*)
@@ -9,7 +9,7 @@
  		        ;;
  		esac
  		;;
-@@ -3295,6 +3297,8 @@
+@@ -3322,6 +3324,8 @@ case "$host" in
  			boehm_supported=false
  			;;
  		  openbsd*|freebsd*|kfreebsd-gnu*)
@@ -18,3 +18,16 @@
  			;;
  		  mingw*)
  			;;
+@@ -3355,11 +3359,10 @@ case "$host" in
+ 		INTL="intl"
+ 		;;
+ 	macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
+-        powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* | powerpc-*-freebsd* )
++        powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* | powerpc*-*-freebsd* )
+ 		if test "x$ac_cv_sizeof_void_p" = "x8"; then
+ 			TARGET=POWERPC64;
+ 			CPPFLAGS="$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__"
+-			CFLAGS="$CFLAGS -mminimal-toc"
+ 		else
+ 			TARGET=POWERPC;
+ 			CPPFLAGS="$CPPFLAGS -D__mono_ppc__"
diff --git a/lang/mono/files/patch-mono_mini_mini-ppc.c b/lang/mono/files/patch-mono_mini_mini-ppc.c
new file mode 100644
index 000000000000..bf021a40a395
--- /dev/null
+++ b/lang/mono/files/patch-mono_mini_mini-ppc.c
@@ -0,0 +1,20 @@
+--- mono/mini/mini-ppc.c.orig	2018-08-24 15:17:13 UTC
++++ mono/mini/mini-ppc.c
+@@ -4650,7 +4650,7 @@ mono_arch_register_lowlevel_calls (void)
+ }
+ 
+ #ifdef __mono_ppc64__
+-#ifdef _LITTLE_ENDIAN
++#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ #define patch_load_sequence(ip,val) do {\
+ 		guint16 *__load = (guint16*)(ip);	\
+ 		g_assert (sizeof (val) == sizeof (gsize)); \
+@@ -4659,7 +4659,7 @@ mono_arch_register_lowlevel_calls (void)
+ 		__load [6] = (((guint64)(gsize)(val)) >> 16) & 0xffff;	\
+ 		__load [8] =  ((guint64)(gsize)(val))        & 0xffff;	\
+ 	} while (0)
+-#elif defined _BIG_ENDIAN
++#elif G_BYTE_ORDER == G_BIG_ENDIAN
+ #define patch_load_sequence(ip,val) do {\
+ 		guint16 *__load = (guint16*)(ip);	\
+ 		g_assert (sizeof (val) == sizeof (gsize)); \