From 1cf17d808a2dac46ba1209fbd752bd08f0213de4 Mon Sep 17 00:00:00 2001 From: Kiyoshi Aman Date: Sat, 14 Dec 2019 20:05:57 -0500 Subject: experimental/mono: new package --- experimental/mono/APKBUILD | 47 ++++++++++++++ experimental/mono/deadlock.patch | 40 ++++++++++++ experimental/mono/musl-ppc.patch | 33 ++++++++++ experimental/mono/ppc32.patch | 30 +++++++++ experimental/mono/python.patch | 131 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 281 insertions(+) create mode 100644 experimental/mono/APKBUILD create mode 100644 experimental/mono/deadlock.patch create mode 100644 experimental/mono/musl-ppc.patch create mode 100644 experimental/mono/ppc32.patch create mode 100644 experimental/mono/python.patch diff --git a/experimental/mono/APKBUILD b/experimental/mono/APKBUILD new file mode 100644 index 000000000..f08b0d52e --- /dev/null +++ b/experimental/mono/APKBUILD @@ -0,0 +1,47 @@ +# Contributor: +# Maintainer: +pkgname=mono +pkgver=6.8.0.123 +pkgrel=0 +pkgdesc="Free, open-source .NET implementation" +url="https://www.mono-project.com" +arch="all" +license="MIT AND BSD-3-Clause AND (Apache-2.0 OR MPL-2.0) AND GPL-2.0-only WITH Classpath-Exception-2.0 AND Apache-2.0 AND MPL-1.1 AND MS-PL AND Info-ZIP" +depends="" +makedepends="cmake python3 curl" +subpackages="$pkgname-dev $pkgname-doc" +source="https://download.mono-project.com/sources/mono/mono-$pkgver.tar.xz + https://distfiles.apkfission.net/src/mono-$pkgver-missing.tar.xz + musl-ppc.patch + ppc32.patch + deadlock.patch + python.patch" +builddir="$srcdir/mono-$pkgver" + +build() { + CFLAGS="-DMUSL" ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --disable-boehm \ + --without-sigaltstack + make +} + +check() { + make check +} + +package() { + make DESTDIR="$pkgdir" install +} + +sha512sums="f702d1ee3a7e8b1a028de02fe6f3ab78e1c5171a547c37db7e934c33533984f2847636476407ad46daeb150640136d6bb28c12c9482c1806997df2dfd7a839f1 mono-6.8.0.123.tar.xz +f83c3713ee5070f40d97cd99c67b52ac5f17e594da27ab15b31929216e22745b666553de27c3882b17ed29ee33adb76f8ca31c0b29e4c1138cd1c2a3daaa6673 mono-6.8.0.123-missing.tar.xz +fd042a4dcef2c5bb6e04799b7a6e6710b667d5cf37fa20f8562787c1f0aafc2a796f03464cb6df0ae2f2b0a14c39aa7cde887abdd2367bda0a11e371f0907606 musl-ppc.patch +f4021ce74581d7e30d07aede96125972d53c9b184de978bffbf4761fadb925761d2464d2dadc52c9ae7485567675d8093442cb45b2237b3ca8d095ed041c5b49 ppc32.patch +69add646494d0b041cce2eb3d1be479e14f917aa74ac284b3c0623969dd3103debe01484aabcf2367ebdd92e13841c2fd3bc0ab452629e8c6593e82c441eb698 deadlock.patch +5c31c52ee8496e188019c7f24b9797b6bdf3cd48b484d6b6c58496d71836d41e52d1ebfc627d135170b340b3e2791ca046ac22df0898599f0bb7ea00c24e746d python.patch" diff --git a/experimental/mono/deadlock.patch b/experimental/mono/deadlock.patch new file mode 100644 index 000000000..1d5d5f4f3 --- /dev/null +++ b/experimental/mono/deadlock.patch @@ -0,0 +1,40 @@ +From 7ea76f5bead1d7c8f80e09232351f243e9ab981d Mon Sep 17 00:00:00 2001 +From: Rickard Lyrenius +Date: Fri, 5 Jun 2020 00:05:32 +0200 +Subject: [PATCH] Avoid setting PTHREAD_PRIO_INHERIT on Alpine, since this + causes deadlocks + +--- + configure.ac | 5 +++++ + mono/utils/mono-os-mutex.h | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 6eb961f9dda0..ad29946527f1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -320,6 +320,11 @@ case "$host" in + # available during cross-compilation + mono_cv_uscore=no + fi ++ case "$host" in ++ *-musl) ++ AC_DEFINE(MUSL, 1, [musl libc]) ++ ;; ++ esac + case "$host" in + *-tizen-linux-*) + platform_tizen=yes +diff --git a/mono/utils/mono-os-mutex.h b/mono/utils/mono-os-mutex.h +index 8b2f530f108e..904974b0a083 100644 +--- a/mono/utils/mono-os-mutex.h ++++ b/mono/utils/mono-os-mutex.h +@@ -59,7 +59,7 @@ mono_os_mutex_init_type (mono_mutex_t *mutex, int type) + if (G_UNLIKELY (res != 0)) + g_error ("%s: pthread_mutexattr_settype failed with \"%s\" (%d)", __func__, g_strerror (res), res); + +-#if !defined(__HAIKU__) && defined (PTHREAD_PRIO_INHERIT) && HAVE_DECL_PTHREAD_MUTEXATTR_SETPROTOCOL ++#if !defined(__HAIKU__) && !defined(MUSL) && defined (PTHREAD_PRIO_INHERIT) && HAVE_DECL_PTHREAD_MUTEXATTR_SETPROTOCOL + /* use PTHREAD_PRIO_INHERIT if possible */ + res = pthread_mutexattr_setprotocol (&attr, PTHREAD_PRIO_INHERIT); + if (G_UNLIKELY (res != 0 && res != ENOTSUP)) diff --git a/experimental/mono/musl-ppc.patch b/experimental/mono/musl-ppc.patch new file mode 100644 index 000000000..79706fb9d --- /dev/null +++ b/experimental/mono/musl-ppc.patch @@ -0,0 +1,33 @@ +Musl does not include kernel headers. + +Also, fix context handling for ppc32/musl. + +--- mono.old/mono/utils/mono-sigcontext.h ++++ mono.new/mono/utils/mono-sigcontext.h +@@ -321,6 +321,8 @@ typedef struct ucontext { + + #elif defined(__mono_ppc__) + ++#include ++ + #if HAVE_UCONTEXT_H + #include + #endif +@@ -334,10 +336,17 @@ typedef struct ucontext { + #define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gp_regs [PT_NIP]) + #define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gp_regs [PT_LNK]) + #else ++#ifdef __GLIBC__ + #define UCONTEXT_REG_Rn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->gregs [(n)]) + #define UCONTEXT_REG_FPRn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->fpregs.fpregs [(n)]) + #define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->gregs [PT_NIP]) + #define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.uc_regs->gregs [PT_LNK]) ++#else ++ #define UCONTEXT_REG_Rn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.gregs [(n)]) ++ #define UCONTEXT_REG_FPRn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.fpregs.fpregs [(n)]) ++ #define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gregs [PT_NIP]) ++ #define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.gregs [PT_LNK]) ++#endif + #endif + #elif defined (__APPLE__) && defined (_STRUCT_MCONTEXT) + typedef struct __darwin_ucontext os_ucontext; diff --git a/experimental/mono/ppc32.patch b/experimental/mono/ppc32.patch new file mode 100644 index 000000000..818b9d43b --- /dev/null +++ b/experimental/mono/ppc32.patch @@ -0,0 +1,30 @@ +From 121928d29ac1e0aebb80531b3ebcca1a9ffcd618 Mon Sep 17 00:00:00 2001 +From: Bernhard Urban-Forster +Date: Fri, 6 Dec 2019 11:35:11 +0100 +Subject: [PATCH] [ppc32] delete leftover code from pre-monoctx area (#18072) + +Also update assert which doesn't make sense since we have moved over to MonoContext + +Some context: e7011c780f676914f559f14f25e76c192bb2b0b2 + +Fixes: https://github.com/mono/mono/issues/18064 +--- + mono/mini/exceptions-ppc.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/mono/mini/exceptions-ppc.c b/mono/mini/exceptions-ppc.c +index 44d09bcaba1d..d14f8383eba9 100644 +--- mono.old/mono/mini/exceptions-ppc.c ++++ mono.new/mono/mini/exceptions-ppc.c +@@ -692,10 +692,7 @@ mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *s + /* may need to adjust pointers in the new struct copy, depending on the OS */ + uc_copy = (MonoContext*)(sp + 16); + mono_sigctx_to_monoctx (uc, uc_copy); +-#if defined(__linux__) && !defined(__mono_ppc64__) +- uc_copy->uc_mcontext.uc_regs = (gpointer)((char*)uc_copy + ((char*)uc->uc_mcontext.uc_regs - (char*)uc)); +-#endif +- g_assert (mono_arch_ip_from_context (uc) == mono_arch_ip_from_context (uc_copy)); ++ g_assert (mono_arch_ip_from_context (uc) == MONO_CONTEXT_GET_IP (uc_copy)); + /* at the return form the signal handler execution starts in altstack_handle_and_restore() */ + UCONTEXT_REG_LNK(uc) = UCONTEXT_REG_NIP(uc); + #ifdef PPC_USES_FUNCTION_DESCRIPTOR diff --git a/experimental/mono/python.patch b/experimental/mono/python.patch new file mode 100644 index 000000000..692ddb42d --- /dev/null +++ b/experimental/mono/python.patch @@ -0,0 +1,131 @@ +diff -Nurd mono-6.6.0.161.old/mono/tests/Makefile.am mono-6.6.0.161/mono/tests/Makefile.am +--- mono-6.6.0.161.old/mono/tests/Makefile.am 2020-07-02 16:22:55.467038705 +0000 ++++ mono-6.6.0.161/mono/tests/Makefile.am 2020-07-02 16:31:31.637032664 +0000 +@@ -3142,7 +3142,7 @@ + # Tests for the Mono lldb plugin + EXTRA_DIST += test_lldb.py test-lldb.cs + test-lldb: test-lldb.exe +- python test_lldb.py $(JITTEST_PROG) ++ python3 test_lldb.py $(JITTEST_PROG) + + noinst_LTLIBRARIES = libtest.la + +diff -Nurd mono-6.6.0.161.old/mono/tests/Makefile.in mono-6.6.0.161/mono/tests/Makefile.in +--- mono-6.6.0.161.old/mono/tests/Makefile.in 2020-07-02 16:22:55.467038705 +0000 ++++ mono-6.6.0.161/mono/tests/Makefile.in 2020-07-02 16:31:20.937032789 +0000 +@@ -3509,7 +3509,7 @@ + coreclr-gcstress: + $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress + test-lldb: test-lldb.exe +- python test_lldb.py $(JITTEST_PROG) ++ python3 test_lldb.py $(JITTEST_PROG) + + test-internalsvisibleto: test-runner.exe $(INTERNALSVISIBLETO_TEST) $(INTERNALSVISIBLETO_TESTAOT) $(INTERNALSVISIBLETO_TESTAOT_LIBS) + $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ $(INTERNALSVISIBLETO_TEST) +diff -Nurd mono-6.6.0.161.old/mono/tests/gc-descriptors/gen-descriptor-tests.py mono-6.6.0.161/mono/tests/gc-descriptors/gen-descriptor-tests.py +--- mono-6.6.0.161.old/mono/tests/gc-descriptors/gen-descriptor-tests.py 2020-07-02 16:22:55.467038705 +0000 ++++ mono-6.6.0.161/mono/tests/gc-descriptors/gen-descriptor-tests.py 2020-07-02 16:32:05.947032262 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from __future__ import print_function + from optparse import OptionParser +diff -Nurd mono-6.6.0.161.old/mono/utils/jemalloc/Makefile.in mono-6.6.0.161/mono/utils/jemalloc/Makefile.in +--- mono-6.6.0.161.old/mono/utils/jemalloc/Makefile.in 2020-07-02 16:22:55.447038705 +0000 ++++ mono-6.6.0.161/mono/utils/jemalloc/Makefile.in 2020-07-02 16:30:54.457033099 +0000 +@@ -632,11 +632,11 @@ + + define ValidateVersionTemplate + #$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)")) +-#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1))) ++#$(eval DIRECTORY_$(2):=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1))) + #$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2)))) +-#$(eval MODULE_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1))) +-#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1))) +-#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1))) ++#$(eval MODULE_$(2):=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1))) ++#$(eval NEEDED_$(2)_VERSION:=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1))) ++#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1))) + + #$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD )) + +@@ -728,19 +728,19 @@ + + __bump-version-%: + @if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV="; exit 1; fi +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV) ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV) + @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + + __bump-branch-%: + @if [ "$(BRANCH)" = "" ]; then echo "Usage: make bump-branch-$* BRANCH= REMOTE_BRANCH="; exit 1; fi + @if [ "$(REMOTE_BRANCH)" == "" ]; then echo "Usage: make bump-branch-$* BRANCH= REMOTE_BRANCH="; exit 1; fi +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH) +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH) ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH) ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH) + @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + + __bump-current-version-%: + REV=$(shell cd $(ACCEPTANCE_TESTS_PATH)/$* && git log -1 --pretty=format:%H); \ +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \ ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \ + if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + + $(eval $(call ValidateVersionTemplate,jemalloc,JEMALLOC)) +diff -Nurd mono-6.6.0.161/mono/mini/Makefile.in mono-6.6.0.161.new/mono/mini/Makefile.in +--- mono-6.6.0.161/mono/mini/Makefile.in 2019-12-10 07:57:17.000000000 +0000 ++++ mono-6.6.0.161.new/mono/mini/Makefile.in 2020-07-02 16:37:51.297028220 +0000 +@@ -1287,7 +1287,7 @@ + libmonoinclude_HEADERS = jit.h + CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649,0618 + GENMDESC_OPTS = +-GENMDESC_PRG = python $(srcdir)/genmdesc.py $(target_define) $(srcdir) ++GENMDESC_PRG = python3 $(srcdir)/genmdesc.py $(target_define) $(srcdir) + LLVM_AOT_RUNTIME_OPTS = $(if $(LLVM),--llvm,) + @AMD64_FALSE@LLVM_AOT_COMPILER_OPTS = + @AMD64_TRUE@LLVM_AOT_COMPILER_OPTS = $(if $(LLVM),"=llvmllc=-mcpu=generic -mattr=+sse3",) +diff -Nurd mono-6.8.0.123/acceptance-tests/Makefile.in mono-6.8.0.123.new/acceptance-tests/Makefile.in +--- mono-6.8.0.123/acceptance-tests/Makefile.in 2020-05-11 18:05:40.000000000 +0000 ++++ mono-6.8.0.123.new/acceptance-tests/Makefile.in 2020-07-04 18:56:11.214908746 +0000 +@@ -5743,11 +5743,11 @@ + + define ValidateVersionTemplate + #$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)")) +-#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1))) ++#$(eval DIRECTORY_$(2):=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1))) + #$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2)))) +-#$(eval MODULE_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1))) +-#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1))) +-#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1))) ++#$(eval MODULE_$(2):=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1))) ++#$(eval NEEDED_$(2)_VERSION:=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1))) ++#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1))) + + #$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD )) + +@@ -5839,19 +5839,19 @@ + + __bump-version-%: + @if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV="; exit 1; fi +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV) ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV) + @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + + __bump-branch-%: + @if [ "$(BRANCH)" = "" ]; then echo "Usage: make bump-branch-$* BRANCH= REMOTE_BRANCH="; exit 1; fi + @if [ "$(REMOTE_BRANCH)" == "" ]; then echo "Usage: make bump-branch-$* BRANCH= REMOTE_BRANCH="; exit 1; fi +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH) +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH) ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH) ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH) + @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + + __bump-current-version-%: + REV=$(shell cd $(ACCEPTANCE_TESTS_PATH)/$* && git log -1 --pretty=format:%H); \ +- python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \ ++ python3 $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \ + if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + + $(eval $(call ValidateVersionTemplate,benchmarker,BENCHMARKER)) -- cgit v1.2.3-70-g09d2