Message ID | 1413100208-12776-3-git-send-email-angelo.compagnucci@gmail.com |
---|---|
State | Superseded |
Headers | show |
Dear Angelo Compagnucci, On Sun, 12 Oct 2014 09:50:08 +0200, Angelo Compagnucci wrote: > +config BR2_PACKAGE_MONO > + bool "mono" > + select BR2_STRIP_none Why ? This is not acceptable in a package. > + 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/ > + > +if BR2_PACKAGE_MONO One empty new line here. > + config BR2_PACKAGE_MONO_20 No indentation here. > + bool "2.0 .Net Runtime" > + help > + Version 2.0 of Mono .Net runtime Empty new line here as well. > + config BR2_PACKAGE_MONO_35 > + bool "3.5 .Net Runtime" > + help > + Version 3.0 of Mono .Net runtime Help text doesn't match the prompt. > + config BR2_PACKAGE_MONO_40 > + bool "4.0 .Net Runtime" > + help > + Version 4.0 of Mono .Net runtime > + config BR2_PACKAGE_MONO_45 > + default y > + bool "4.5 .Net Runtime" > + help > + Version 4.5 of Mono .Net runtime The help texts are useless. So either remove them, or make them a little bit more useful, like "This option enables the installation of the 4.5 version of the Mono .Net runtime to the target". Also, please enable by default one of the runtime versions, so that at least by default, things work. > diff --git a/package/mono/mono-001-gc-fix-uclibc.patch b/package/mono/mono-001-gc-fix-uclibc.patch > new file mode 100644 > index 0000000..951d568 > --- /dev/null > +++ b/package/mono/mono-001-gc-fix-uclibc.patch > @@ -0,0 +1,16 @@ > +Disable backtrace on not supprted uclibc. Typo: supported > diff --git a/package/mono/mono.mk b/package/mono/mono.mk > new file mode 100644 > index 0000000..621ad96 > --- /dev/null > +++ b/package/mono/mono.mk > @@ -0,0 +1,74 @@ > +############################################################# > +# > +# mono > +# > +############################################################# > + > +MONO_VERSION = 3.10.0 > +MONO_SITE = http://download.mono-project.com/sources/mono/ > +MONO_SOURCE = mono-$(MONO_VERSION).tar.bz2 > +MONO_LICENSE = Dual license LGPL, commercial Which version of the LGPL ? Also, it should be: MONO_LICENSE = LGPLvX or commecial > +ifeq ($(BR2_PACKAGE_MONO_20),y) > + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/2.0 > +endif > + > +ifeq ($(BR2_PACKAGE_MONO_35),y) > + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/3.5 > +endif > + > +ifeq ($(BR2_PACKAGE_MONO_40),y) > + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/4.0 > +endif > + > +ifeq ($(BR2_PACKAGE_MONO_45),y) > + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/4.5 > +endif Using a variable like ASSEMBLY_INCLUDED is not good. Remember that the namespace of variables is global in Buildroot, so all variables defined by a package should *always* be prefixed by the package name. In this case MONO_. That being said, are you sure this dance is really needed? There are some configure options to Mono to enable or disable the various versions of the runtime. > +ifneq ($(ASSEMBLY_INCLUDED),) > +$(eval $(host-autotools-package)) > +endif Conditional not needed. I think we should ensure at least one runtime version is enabled. Thomas
Hi Thomas, > That being said, are you sure this dance is really needed? There are > some configure options to Mono to enable or disable the various > versions of the runtime. Yes, you are right, but changing runtime version means you have to recompile a lot of things. This way, you compile at first and simply removing .stap_target_installed, you can have free a new mono runtime version! If you think that it necessary to have them disabled at compile time, I'll do it! > >> +ifneq ($(ASSEMBLY_INCLUDED),) >> +$(eval $(host-autotools-package)) >> +endif > > Conditional not needed. I think we should ensure at least one runtime > version is enabled. That's not always true. There is ways in mono to "freeze" the assemblies your application requires, so only the mono vm is required. Moreover, you can write an application that ships required assemblies in your project folder and not using the system wide installed. I think that having an option to only compile the vm is good! Thank you again for your time! > > Thomas > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com
Hi Thomas, 2014-10-12 10:25 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>: > > Which version of the LGPL ? > > Also, it should be: > > MONO_LICENSE = LGPLvX or commecial Here an excerpt from mono license file: " This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation." License version is not expressed, probably this imply "or at any other version" clause, but I don't know well. Any hint? Thank you!
Dear Angelo Compagnucci, On Sun, 12 Oct 2014 10:44:21 +0200, Angelo Compagnucci wrote: > Yes, you are right, but changing runtime version means you have to > recompile a lot of things. This way, you compile at first and simply > removing .stap_target_installed, you can have free a new mono runtime > version! > If you think that it necessary to have them disabled at compile time, > I'll do it! Yes, please, that's how we do things for all packages: if a configure option is there to not build something that is actually disabled in the Buildroot configuration, then we use that. > >> +ifneq ($(ASSEMBLY_INCLUDED),) > >> +$(eval $(host-autotools-package)) > >> +endif > > > > Conditional not needed. I think we should ensure at least one runtime > > version is enabled. > > That's not always true. There is ways in mono to "freeze" the > assemblies your application requires, so only the mono vm is required. > Moreover, you can write an application that ships required assemblies > in your project folder and not using the system wide installed. > I think that having an option to only compile the vm is good! Then, the conditional shouldn't be here, but around the dependency of mono on host-mono. That being said, I would recommend you to keep things simple for now, and handle only this use case as a follow-up contribution. Thomas
Hi Thomas! 2014-10-12 11:02 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>: > Dear Angelo Compagnucci, > > Yes, please, that's how we do things for all packages: if a configure > option is there to not build something that is actually disabled in the > Buildroot configuration, then we use that. Ok! > Then, the conditional shouldn't be here, but around the dependency of > mono on host-mono. > > That being said, I would recommend you to keep things simple for now, > and handle only this use case as a follow-up contribution. It is already: ifneq ($(MONO_ASSEMBLY_INCLUDED),) define MONO_INSTALL_LIBS rsync -av --exclude=*.so --exclude=*.mdb --exclude=[0-9].[0-9] \ $(HOST_DIR)/usr/lib/mono $(TARGET_DIR)/usr/lib/ rsync -av --exclude=*.so --exclude=*.mdb $(MONO_ASSEMBLY_INCLUDED) \ $(TARGET_DIR)/usr/lib/mono/ endef MONO_DEPENDENCIES += host-mono MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS endif This way the dependency is met only when MONO_ASSEMBLY_INCLUDED. By the way, I'll remove this logic, make 4.5 as default version and if nothing selected, I'll default evenly on 4.5. Thank you for your time! > > Thomas > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com
Dear Angelo Compagnucci, On Sun, 12 Oct 2014 10:59:43 +0200, Angelo Compagnucci wrote: > Here an excerpt from mono license file: > > " This library is free software; you can redistribute it and/or > modify it under the terms of the GNU Library General Public > License as published by the Free Software Foundation." > > License version is not expressed, probably this imply "or at any other > version" clause, but I don't know well. Any hint? You need to look at the source files themselves to see which version of the license is used, and whether the "or later" option is used or not. Thomas
Dear Angelo Compagnucci, On Sun, 12 Oct 2014 11:21:20 +0200, Angelo Compagnucci wrote: > > Then, the conditional shouldn't be here, but around the dependency of > > mono on host-mono. > > > > That being said, I would recommend you to keep things simple for now, > > and handle only this use case as a follow-up contribution. > > It is already: > > ifneq ($(MONO_ASSEMBLY_INCLUDED),) > define MONO_INSTALL_LIBS > rsync -av --exclude=*.so --exclude=*.mdb --exclude=[0-9].[0-9] \ > $(HOST_DIR)/usr/lib/mono $(TARGET_DIR)/usr/lib/ > rsync -av --exclude=*.so --exclude=*.mdb $(MONO_ASSEMBLY_INCLUDED) \ > $(TARGET_DIR)/usr/lib/mono/ > endef > MONO_DEPENDENCIES += host-mono > MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS > endif > > This way the dependency is met only when MONO_ASSEMBLY_INCLUDED. > By the way, I'll remove this logic, make 4.5 as default version and if > nothing selected, I'll default evenly on 4.5. Ok, right. Then don't add a condition around the host-autotools-package call, this is useless. Thanks, Thomas
Hi Thomas! >> It is already: >> >> ifneq ($(MONO_ASSEMBLY_INCLUDED),) >> define MONO_INSTALL_LIBS >> rsync -av --exclude=*.so --exclude=*.mdb --exclude=[0-9].[0-9] \ >> $(HOST_DIR)/usr/lib/mono $(TARGET_DIR)/usr/lib/ >> rsync -av --exclude=*.so --exclude=*.mdb $(MONO_ASSEMBLY_INCLUDED) \ >> $(TARGET_DIR)/usr/lib/mono/ >> endef >> MONO_DEPENDENCIES += host-mono >> MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS >> endif >> >> This way the dependency is met only when MONO_ASSEMBLY_INCLUDED. >> By the way, I'll remove this logic, make 4.5 as default version and if >> nothing selected, I'll default evenly on 4.5. > > Ok, right. Then don't add a condition around the host-autotools-package > call, this is useless. OK! So it the end I can keep that logic? I think it's valuable! Obviously I can add a note on Config help. > > Thanks, > > Thomas > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com
Dear Angelo Compagnucci, On Sun, 12 Oct 2014 12:06:35 +0200, Angelo Compagnucci wrote: > >> This way the dependency is met only when MONO_ASSEMBLY_INCLUDED. > >> By the way, I'll remove this logic, make 4.5 as default version and if > >> nothing selected, I'll default evenly on 4.5. > > > > Ok, right. Then don't add a condition around the host-autotools-package > > call, this is useless. > > OK! So it the end I can keep that logic? I think it's valuable! > Obviously I can add a note on Config help. * You should make sure one of the Runtime version is enabled by default by adding a 'default y' * You should use the configure options of Mono to enable/disable the appropriate runtime versions, which will remove the need for this MONO_ASSEMBLY_INCLUDED variable. Thomas
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..de2d68b --- /dev/null +++ b/package/mono/Config.in @@ -0,0 +1,39 @@ +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/ + +if BR2_PACKAGE_MONO + config BR2_PACKAGE_MONO_20 + bool "2.0 .Net Runtime" + help + Version 2.0 of Mono .Net runtime + config BR2_PACKAGE_MONO_35 + bool "3.5 .Net Runtime" + help + Version 3.0 of Mono .Net runtime + config BR2_PACKAGE_MONO_40 + bool "4.0 .Net Runtime" + help + Version 4.0 of Mono .Net runtime + config BR2_PACKAGE_MONO_45 + default y + bool "4.5 .Net Runtime" + help + Version 4.5 of Mono .Net runtime + +endif + +comment "mono needs a toolchain w/ IPv6" + depends on !BR2_INET_IPV6 diff --git a/package/mono/mono-001-gc-fix-uclibc.patch b/package/mono/mono-001-gc-fix-uclibc.patch new file mode 100644 index 0000000..951d568 --- /dev/null +++ b/package/mono/mono-001-gc-fix-uclibc.patch @@ -0,0 +1,16 @@ +Disable backtrace on not supprted uclibc. + +Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> + +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 <features.h> + # 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 <thomas.petazzoni@free-electrons.com> + +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..621ad96 --- /dev/null +++ b/package/mono/mono.mk @@ -0,0 +1,74 @@ +############################################################# +# +# mono +# +############################################################# + +MONO_VERSION = 3.10.0 +MONO_SITE = http://download.mono-project.com/sources/mono/ +MONO_SOURCE = mono-$(MONO_VERSION).tar.bz2 +MONO_LICENSE = Dual license LGPL, commercial +MONO_LICENSE_FILES = LICENSE +MONO_INSTALL_STAGING = YES + +# patching configure.ac +MONO_AUTORECONF = YES + +# Disable managed code (mcs folder) from building +MONO_CONF_OPTS = --disable-gtk-doc \ + --with-mcs-docs=no \ + --with-moonlight=no \ + --disable-libraries \ + --with-ikvm-native=no \ + --enable-minimal=aot,profiler,debug \ + --disable-mcs-build + +ifeq ($(BR2_PACKAGE_MONO_20),y) + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/2.0 +endif + +ifeq ($(BR2_PACKAGE_MONO_35),y) + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/3.5 +endif + +ifeq ($(BR2_PACKAGE_MONO_40),y) + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/4.0 +endif + +ifeq ($(BR2_PACKAGE_MONO_45),y) + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/4.5 +endif + +ifneq ($(ASSEMBLY_INCLUDED),) +define MONO_INSTALL_LIBS + rsync -av --exclude=*.so --exclude=*.mdb --exclude=[0-9].[0-9] \ + $(HOST_DIR)/usr/lib/mono $(TARGET_DIR)/usr/lib/ + rsync -av --exclude=*.so --exclude=*.mdb $(ASSEMBLY_INCLUDED) \ + $(TARGET_DIR)/usr/lib/mono/ +endef +MONO_DEPENDENCIES += host-mono +MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS +endif + +HOST_MONO_CONF_OPTS = --disable-gtk-doc \ + --with-mcs-docs=no \ + --with-moonlight=no \ + --disable-libraries \ + --with-ikvm-native=no \ + --enable-minimal=aot,profiler,debug \ + --enable-static + +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)) + +ifneq ($(ASSEMBLY_INCLUDED),) +$(eval $(host-autotools-package)) +endif
This patch adds the complete Mono implementation. This patch builds both the native and managed parts. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> --- package/Config.in | 1 + package/mono/Config.in | 39 ++++++++++++ package/mono/mono-001-gc-fix-uclibc.patch | 16 +++++ package/mono/mono-002-support-uclibc-musl.patch | 25 ++++++++ package/mono/mono.mk | 74 +++++++++++++++++++++++ 5 files changed, 155 insertions(+) create mode 100644 package/mono/Config.in create mode 100644 package/mono/mono-001-gc-fix-uclibc.patch create mode 100644 package/mono/mono-002-support-uclibc-musl.patch create mode 100644 package/mono/mono.mk