Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 2021 16:22:05 +0000 (UTC)
From:      Mikael Urankar <mikael@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r560789 - in head/lang/mono5.20: . files
Message-ID:  <202101081622.108GM5DO036079@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mikael
Date: Fri Jan  8 16:22:05 2021
New Revision: 560789
URL: https://svnweb.freebsd.org/changeset/ports/560789

Log:
  lang/mono5.20: fix build on aarch64
  
  PR:		229710
  Submitted by:	Greg V greg@unrelenting.technology
  Approved by:	portmgr (tier-2 blanket)

Added:
  head/lang/mono5.20/files/extra-patch-aarch64-race-workaround   (contents, props changed)
  head/lang/mono5.20/files/patch-configure.ac   (contents, props changed)
  head/lang/mono5.20/files/patch-external_boringssl_crypto_cpu-aarch64-linux.c   (contents, props changed)
  head/lang/mono5.20/files/patch-mono_sgen_sgen-archdep.h   (contents, props changed)
  head/lang/mono5.20/files/patch-mono_utils_mono-sigcontext.h   (contents, props changed)
Modified:
  head/lang/mono5.20/Makefile
  head/lang/mono5.20/pkg-plist

Modified: head/lang/mono5.20/Makefile
==============================================================================
--- head/lang/mono5.20/Makefile	Fri Jan  8 15:52:26 2021	(r560788)
+++ head/lang/mono5.20/Makefile	Fri Jan  8 16:22:05 2021	(r560789)
@@ -14,7 +14,7 @@ COMMENT=	Open source implementation of .NET Developmen
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-ONLY_FOR_ARCHS=		amd64 armv6 armv7 i386 powerpc
+ONLY_FOR_ARCHS=		aarch64 amd64 armv6 armv7 i386 powerpc
 
 BUILD_DEPENDS=	p5-XML-Parser>=0:textproc/p5-XML-Parser \
 		bash:shells/bash \
@@ -66,6 +66,15 @@ PORTSCOUT=	limit:^\d+\.\d+\.[1-9]\d*
 OPTIONS_SLAVE=	MONOLITE
 .endif
 
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "aarch64"
+EXTRA_PATCHES=	${FILESDIR}/extra-patch-aarch64-race-workaround
+PLIST_SUB+=	BOEHM="@comment "
+.else
+PLIST_SUB+=	BOEHM=""
+.endif
+
 post-extract-MONOLITE-on:
 	${MKDIR} ${WRKSRC}/mcs/class/lib/monolite-linux
 	${MV} ${WRKDIR}/monolite-linux-${MONOLITE_VERSION}-latest ${WRKSRC}/mcs/class/lib/monolite-linux/${MONOLITE_VERSION}
@@ -94,4 +103,4 @@ post-configure:
 post-install:
 	${MKDIR} ${STAGEDIR}${PREFIX}/mono
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>

Added: head/lang/mono5.20/files/extra-patch-aarch64-race-workaround
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/mono5.20/files/extra-patch-aarch64-race-workaround	Fri Jan  8 16:22:05 2021	(r560789)
@@ -0,0 +1,24 @@
+Workaround for Roslyn crash: https://github.com/mono/mono/issues/7017
+
+--- mcs/build/profiles/basic.make.orig	2018-07-12 00:08:27 UTC
++++ mcs/build/profiles/basic.make
+@@ -47,7 +47,7 @@ LIBRARY_COMPILE = $(BOOT_COMPILE)
+ #
+ # Copy from rules.make because I don't know how to unset MCS_FLAGS
+ #
+-USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
++USE_MCS_FLAGS = /codepage:$(CODEPAGE) /parallel- /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
+
+ .PHONY: profile-check do-profile-check
+ profile-check:
+--- mcs/build/rules.make.orig	2018-07-12 00:09:18.508196000 +0000
++++ mcs/build/rules.make	2018-07-12 00:12:13.875877000 +0000
+@@ -34,7 +34,7 @@
+ endif
+ endif
+
+-USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
++USE_MCS_FLAGS = /codepage:$(CODEPAGE) /parallel- /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
+ USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
+ USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) $(CPPFLAGS)
+ CSCOMPILE = $(Q_MCS) $(MCS) $(USE_MCS_FLAGS)

Added: head/lang/mono5.20/files/patch-configure.ac
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/mono5.20/files/patch-configure.ac	Fri Jan  8 16:22:05 2021	(r560789)
@@ -0,0 +1,15 @@
+--- configure.ac.orig	2021-01-07 15:31:48 UTC
++++ configure.ac
+@@ -203,6 +203,12 @@ case "$host" in
+ 		libdl=
+ 		libgc_threads=pthreads
+ 		use_sigposix=yes
++		case "$host" in
++		aarch64-*)
++			support_boehm=no
++			with_gc=sgen
++			;;
++		esac
+ 		has_dtrace=yes
+ 		with_sgen_default_concurrent=yes
+ 		;;

Added: head/lang/mono5.20/files/patch-external_boringssl_crypto_cpu-aarch64-linux.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/mono5.20/files/patch-external_boringssl_crypto_cpu-aarch64-linux.c	Fri Jan  8 16:22:05 2021	(r560789)
@@ -0,0 +1,42 @@
+--- external/boringssl/crypto/cpu-aarch64-linux.c.orig	2018-08-24 17:17:16 UTC
++++ external/boringssl/crypto/cpu-aarch64-linux.c
+@@ -25,7 +25,32 @@
+ 
+ extern uint32_t OPENSSL_armcap_P;
+ 
++#if defined(__FreeBSD__)
++#include <sys/types.h>
++#include <machine/armreg.h>
++
+ void OPENSSL_cpuid_setup(void) {
++  uint64_t id_aa64isar0;
++
++  id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
++
++  OPENSSL_armcap_P |= ARMV7_NEON;
++
++  if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) == ID_AA64ISAR0_AES_BASE) {
++    OPENSSL_armcap_P |= ARMV8_AES;
++  }
++  if (ID_AA64ISAR0_AES_VAL(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) {
++    OPENSSL_armcap_P |= ARMV8_PMULL;
++  }
++  if (ID_AA64ISAR0_SHA1_VAL(id_aa64isar0) == ID_AA64ISAR0_SHA1_BASE) {
++    OPENSSL_armcap_P |= ARMV8_SHA1;
++  }
++  if(ID_AA64ISAR0_SHA2_VAL(id_aa64isar0) == ID_AA64ISAR0_SHA2_BASE) {
++    OPENSSL_armcap_P |= ARMV8_SHA256;
++  }
++}
++#else // linux
++void OPENSSL_cpuid_setup(void) {
+   unsigned long hwcap = getauxval(AT_HWCAP);
+ 
+   /* See /usr/include/asm/hwcap.h on an aarch64 installation for the source of
+@@ -57,5 +82,6 @@ void OPENSSL_cpuid_setup(void) {
+     OPENSSL_armcap_P |= ARMV8_SHA256;
+   }
+ }
++#endif
+ 
+ #endif /* OPENSSL_AARCH64 && !OPENSSL_STATIC_ARMCAP */

Added: head/lang/mono5.20/files/patch-mono_sgen_sgen-archdep.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/mono5.20/files/patch-mono_sgen_sgen-archdep.h	Fri Jan  8 16:22:05 2021	(r560789)
@@ -0,0 +1,11 @@
+--- mono/sgen/sgen-archdep.h.orig	2018-07-11 23:55:34 UTC
++++ mono/sgen/sgen-archdep.h
+@@ -45,7 +45,7 @@
+
+ #elif defined(TARGET_ARM64)
+
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD__)
+ #define REDZONE_SIZE    0
+ #elif defined(__APPLE__)
+ #define REDZONE_SIZE	128

Added: head/lang/mono5.20/files/patch-mono_utils_mono-sigcontext.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/mono5.20/files/patch-mono_utils_mono-sigcontext.h	Fri Jan  8 16:22:05 2021	(r560789)
@@ -0,0 +1,16 @@
+--- mono/utils/mono-sigcontext.h.orig	2018-07-11 23:51:16 UTC
++++ mono/utils/mono-sigcontext.h
+@@ -460,6 +460,13 @@ typedef struct ucontext {
+	#define UCONTEXT_REG_SP(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__sp)
+	#define UCONTEXT_REG_R0(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__x [ARMREG_R0])
+	#define UCONTEXT_GREGS(ctx) (&(((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__x))
++#elif defined(__FreeBSD__)
++#include <ucontext.h>
++	/* https://lists.freebsd.org/pipermail/freebsd-arm/2017-February/015611.html */
++	#define UCONTEXT_REG_PC(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_elr)
++	#define UCONTEXT_REG_SP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_sp)
++	#define UCONTEXT_REG_R0(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_x [ARMREG_R0])
++	#define UCONTEXT_GREGS(ctx) (&(((ucontext_t*)(ctx))->uc_mcontext.mc_gpregs.gp_x))
+ #else
+ #include <ucontext.h>
+	#define UCONTEXT_REG_PC(ctx) (((ucontext_t*)(ctx))->uc_mcontext.pc)

Modified: head/lang/mono5.20/pkg-plist
==============================================================================
--- head/lang/mono5.20/pkg-plist	Fri Jan  8 15:52:26 2021	(r560788)
+++ head/lang/mono5.20/pkg-plist	Fri Jan  8 16:22:05 2021	(r560789)
@@ -43,7 +43,7 @@ bin/mod
 bin/mono
 bin/mono-api-html
 bin/mono-api-info
-bin/mono-boehm
+%%BOEHM%%bin/mono-boehm
 bin/mono-cil-strip
 bin/mono-configuration-crypto
 bin/mono-find-provides
@@ -172,10 +172,10 @@ lib/libmono-profiler-log.a
 lib/libmono-profiler-log.so
 lib/libmono-profiler-log.so.0
 lib/libmono-profiler-log.so.0.0.0
-lib/libmonoboehm-2.0.a
-lib/libmonoboehm-2.0.so
-lib/libmonoboehm-2.0.so.1
-lib/libmonoboehm-2.0.so.1.0.0
+%%BOEHM%%lib/libmonoboehm-2.0.a
+%%BOEHM%%lib/libmonoboehm-2.0.so
+%%BOEHM%%lib/libmonoboehm-2.0.so.1
+%%BOEHM%%lib/libmonoboehm-2.0.so.1.0.0
 lib/libmonosgen-2.0.a
 lib/libmonosgen-2.0.so
 lib/libmonosgen-2.0.so.1
@@ -3198,38 +3198,38 @@ man/man1/xbuild.1.gz
 man/man1/xsd.1.gz
 man/man5/mdoc.5.gz
 man/man5/mono-config.5.gz
-share/libgc-mono/README
-share/libgc-mono/README.DGUX386
-share/libgc-mono/README.Mac
-share/libgc-mono/README.MacOSX
-share/libgc-mono/README.OS2
-share/libgc-mono/README.amiga
-share/libgc-mono/README.arm.cross
-share/libgc-mono/README.autoconf
-share/libgc-mono/README.changes
-share/libgc-mono/README.contributors
-share/libgc-mono/README.cords
-share/libgc-mono/README.darwin
-share/libgc-mono/README.dj
-share/libgc-mono/README.environment
-share/libgc-mono/README.ews4800
-share/libgc-mono/README.hp
-share/libgc-mono/README.linux
-share/libgc-mono/README.macros
-share/libgc-mono/README.rs6000
-share/libgc-mono/README.sgi
-share/libgc-mono/README.solaris2
-share/libgc-mono/README.uts
-share/libgc-mono/README.win32
-share/libgc-mono/barrett_diagram
-share/libgc-mono/debugging.html
-share/libgc-mono/gc.man
-share/libgc-mono/gcdescr.html
-share/libgc-mono/gcinterface.html
-share/libgc-mono/leak.html
-share/libgc-mono/scale.html
-share/libgc-mono/simple_example.html
-share/libgc-mono/tree.html
+%%BOEHM%%share/libgc-mono/README
+%%BOEHM%%share/libgc-mono/README.DGUX386
+%%BOEHM%%share/libgc-mono/README.Mac
+%%BOEHM%%share/libgc-mono/README.MacOSX
+%%BOEHM%%share/libgc-mono/README.OS2
+%%BOEHM%%share/libgc-mono/README.amiga
+%%BOEHM%%share/libgc-mono/README.arm.cross
+%%BOEHM%%share/libgc-mono/README.autoconf
+%%BOEHM%%share/libgc-mono/README.changes
+%%BOEHM%%share/libgc-mono/README.contributors
+%%BOEHM%%share/libgc-mono/README.cords
+%%BOEHM%%share/libgc-mono/README.darwin
+%%BOEHM%%share/libgc-mono/README.dj
+%%BOEHM%%share/libgc-mono/README.environment
+%%BOEHM%%share/libgc-mono/README.ews4800
+%%BOEHM%%share/libgc-mono/README.hp
+%%BOEHM%%share/libgc-mono/README.linux
+%%BOEHM%%share/libgc-mono/README.macros
+%%BOEHM%%share/libgc-mono/README.rs6000
+%%BOEHM%%share/libgc-mono/README.sgi
+%%BOEHM%%share/libgc-mono/README.solaris2
+%%BOEHM%%share/libgc-mono/README.uts
+%%BOEHM%%share/libgc-mono/README.win32
+%%BOEHM%%share/libgc-mono/barrett_diagram
+%%BOEHM%%share/libgc-mono/debugging.html
+%%BOEHM%%share/libgc-mono/gc.man
+%%BOEHM%%share/libgc-mono/gcdescr.html
+%%BOEHM%%share/libgc-mono/gcinterface.html
+%%BOEHM%%share/libgc-mono/leak.html
+%%BOEHM%%share/libgc-mono/scale.html
+%%BOEHM%%share/libgc-mono/simple_example.html
+%%BOEHM%%share/libgc-mono/tree.html
 %%NLS%%share/locale/de/LC_MESSAGES/mcs.mo
 %%NLS%%share/locale/es/LC_MESSAGES/mcs.mo
 %%NLS%%share/locale/ja/LC_MESSAGES/mcs.mo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101081622.108GM5DO036079>