From patchwork Sat Oct 11 10:32:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 398829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 38713140145 for ; Sat, 11 Oct 2014 21:32:48 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 20C8E3343E; Sat, 11 Oct 2014 10:32:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BkLFkkz-hhL3; Sat, 11 Oct 2014 10:32:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 64C5033404; Sat, 11 Oct 2014 10:32:44 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 509531C1F8B for ; Sat, 11 Oct 2014 10:32:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 49D6692A5B for ; Sat, 11 Oct 2014 10:32:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mefu60v0y-vK for ; Sat, 11 Oct 2014 10:32:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by whitealder.osuosl.org (Postfix) with ESMTP id 53EB792A4F for ; Sat, 11 Oct 2014 10:32:41 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 34FE87A8; Sat, 11 Oct 2014 12:32:41 +0200 (CEST) Received: from localhost (dsdf-4db5a493.pool.mediaWays.net [77.181.164.147]) by mail.free-electrons.com (Postfix) with ESMTPSA id 890E13C0; Sat, 11 Oct 2014 12:32:40 +0200 (CEST) Date: Sat, 11 Oct 2014 12:32:36 +0200 From: Thomas Petazzoni To: Angelo Compagnucci Message-ID: <20141011123236.3c9d4cc9@free-electrons.com> In-Reply-To: References: <1412951017-6769-1-git-send-email-angelo.compagnucci@gmail.com> <20141010204840.4ec4d5d3@free-electrons.com> Organization: Free Electrons X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Cc: buildroot Subject: Re: [Buildroot] [PATCH v3] package/mono: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Dear Angelo Compagnucci, On Fri, 10 Oct 2014 21:36:33 +0200, Angelo Compagnucci wrote: > Another thing. I'm using this patch as a training to understand better > how to write good buildroot packages. I hope to contribute more in the > future! I really appreciate any hint and I prefer to write the patch > myself! > So I will be really grateful if you can review this patch and point me > to the right direction, step by step, if it's not to much a hassle for > you! Here are improved patches: * One patch adding the host-monolite package, so that Mono doesn't download Monolite on its own. * One patch adding the mono and host-mono packages. It's still using the old Mono version, so you'll have to update that and check that it continues to work. Best regards, Thomas From 7c7d42bf62b4e3204ed9685573c4623f6d987a7c Mon Sep 17 00:00:00 2001 From: Angelo Compagnucci Date: Thu, 9 Oct 2014 15:45:41 +0200 Subject: [PATCH 2/2] mono: new package This patch adds the complete Mono implementation. This patch builds both the native and managed parts. [Thomas: - Merge mono-managed and mono-native as a single package. The mono-managed stuff is done by the host variant of the mono package, while the mono-native stuff is done as the target variant of the mono package. - Introduce a BR2_PACKAGE_MONO_ARCH_SUPPORTS blind Config.in option to make sure the IPv6 related comment is not displayed when the architecture being used anyway doesn't support Mono. - Add a patch to Mono to fix the C library path when uClibc and Musl is used. This is a better approach than the POST_INSTALL_TARGET_HOOKS because this approach can potentially be submitted upstreamed, which ultimately allows to simplify the Buildroot package. - Depend on a 'monolite' package, and use it instead of letting Mono download Monolite by itself, which circumvents Buildroot's download infrastructure. - Move the installation of Mono libraries to the target Mono package, as a POST_INSTALL_TARGET_HOOKS.] Signed-off-by: Thomas Petazzoni --- package/Config.in | 1 + package/mono/Config.in | 19 ++++++++++ package/mono/mono-001-fix-uclibc.patch | 14 ++++++++ package/mono/mono-002-support-uclibc-musl.patch | 25 +++++++++++++ package/mono/mono.mk | 48 +++++++++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 package/mono/Config.in create mode 100644 package/mono/mono-001-fix-uclibc.patch create mode 100644 package/mono/mono-002-support-uclibc-musl.patch create mode 100644 package/mono/mono.mk diff --git a/package/Config.in b/package/Config.in index ea89c96..92cf4b8 100644 --- a/package/Config.in +++ b/package/Config.in @@ -433,6 +433,7 @@ menu "Lua libraries/modules" source "package/xavante/Config.in" endmenu endif + source "package/mono/Config.in" source "package/nodejs/Config.in" source "package/perl/Config.in" if BR2_PACKAGE_PERL diff --git a/package/mono/Config.in b/package/mono/Config.in new file mode 100644 index 0000000..e49ce98 --- /dev/null +++ b/package/mono/Config.in @@ -0,0 +1,19 @@ +config BR2_PACKAGE_MONO_ARCH_SUPPORTS + bool + default y if (BR2_arm || BR2_armeb || BR2_i386 || BR2_mips || \ + BR2_mipsel || BR2_powerpc || BR2_sparc || BR2_x86_64) + +config BR2_PACKAGE_MONO + bool "mono" + select BR2_STRIP_none + depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS + depends on BR2_INET_IPV6 + help + An open source, cross-platform, implementation of C# and the + CLR that is binary compatible with Microsoft.NET. + + http://download.mono-project.com/sources/mono/ + +comment "mono needs a toolchain w/ IPv6" + depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS + depends on !BR2_INET_IPV6 diff --git a/package/mono/mono-001-fix-uclibc.patch b/package/mono/mono-001-fix-uclibc.patch new file mode 100644 index 0000000..c82f24b --- /dev/null +++ b/package/mono/mono-001-fix-uclibc.patch @@ -0,0 +1,14 @@ +Signed-off-by: Angelo Compagnucci + +diff -purN mono-native-3.8.0.orig/libgc/include/gc.h mono-native-3.8.0/libgc/include/gc.h +--- mono-native-3.8.0.orig/libgc/include/gc.h 2014-10-07 15:00:21.259466731 +0200 ++++ mono-native-3.8.0/libgc/include/gc.h 2014-10-07 15:05:25.560975681 +0200 +@@ -500,7 +500,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_of + #ifdef __linux__ + # include + # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ +- && !defined(__ia64__) ++ && !defined(__ia64__) && !defined(__UCLIBC__) + # ifndef GC_HAVE_BUILTIN_BACKTRACE + # define GC_HAVE_BUILTIN_BACKTRACE + # endif diff --git a/package/mono/mono-002-support-uclibc-musl.patch b/package/mono/mono-002-support-uclibc-musl.patch new file mode 100644 index 0000000..48a3493 --- /dev/null +++ b/package/mono/mono-002-support-uclibc-musl.patch @@ -0,0 +1,25 @@ +Adjust libc.so path depending on C library being used + +By default, on Linux systems, Mono assumes that the C library is +libc.so.6. While this is true for glibc, it is not true for uClibc and +Musl based systems. This patch adds support for such systems. + +Signed-off-by: Thomas Petazzoni + +Index: b/configure.ac +=================================================================== +--- a/configure.ac ++++ b/configure.ac +@@ -2973,6 +2973,12 @@ + SQLITE="libsqlite.so" + SQLITE3="libsqlite3.so" + ;; ++ *-*-*uclibc*) ++ LIBC="libc.so.0" ++ ;; ++ *-*-*musl*) ++ LIBC="libc.so" ++ ;; + *-*-*linux*) + AC_PATH_X + dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh` diff --git a/package/mono/mono.mk b/package/mono/mono.mk new file mode 100644 index 0000000..8b78eb9 --- /dev/null +++ b/package/mono/mono.mk @@ -0,0 +1,48 @@ +############################################################# +# +# mono +# +############################################################# + +MONO_VERSION = 3.8.0 +MONO_SITE = http://download.mono-project.com/sources/mono/ +MONO_SOURCE = mono-$(MONO_VERSION).tar.bz2 +MONO_LICENSE = +MONO_LICENSE_FILES = +MONO_INSTALL_STAGING = YES + +# patching configure.ac +MONO_AUTORECONF = YES + +MONO_CONF_OPTS = \ + --disable-gtk-doc \ + --with-mcs-docs=no \ + --with-moonlight=no \ + --disable-mcs-build + +MONO_DEPENDENCIES = host-mono + +define MONO_INSTALL_LIBS + rsync -av --exclude=*.so $(HOST_DIR)/usr/lib/mono $(TARGET_DIR)/usr/lib/ +endef + +MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS + +HOST_MONO_CONF_OPTS = \ + --disable-gtk-doc \ + --with-mcs-docs=no \ + --with-moonlight=no \ + --enable-static \ + --enable-minimal=aot,profiler + +HOST_MONO_DEPENDENCIES = host-monolite + +define HOST_MONO_SETUP_MONOLITE + rm -rf $(@D)/mcs/class/lib/monolite + (cd $(@D)/mcs/class/lib; ln -s $(HOST_DIR)/usr/lib/monolite monolite) +endef + +HOST_MONO_POST_CONFIGURE_HOOKS += HOST_MONO_SETUP_MONOLITE + +$(eval $(autotools-package)) +$(eval $(host-autotools-package)) -- 2.0.0