Mono: new package
[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.
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.]
[Angelo:
- Bump to the latest Mono version 3.10.0
- Add selection for .Net runtime compilation and installation in target. If nothing is selected, only a minimal mono is built ]
PATCH 1/2 package/monolite: new package
This patch adds Monolite package. This package is a dependency of Mono package.
--- package/monolite/monolite.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 package/monolite/monolite.mk
package/monolite/monolite.mk new file +17 -0
@@ -0,0 +1,17 @@ +############################################################# +# +# monolite +# +############################################################# + +MONOLITE_VERSION = 111 +MONOLITE_SITE = http://storage.bos.xamarin.com/mono-dist-master/latest/ +MONOLITE_SOURCE = monolite-$(MONOLITE_VERSION)-latest.tar.gz +MONOLITE_LICENSE = Dual license LGPL, commercial + +define HOST_MONOLITE_INSTALL_CMDS + mkdir -p $(HOST_DIR)/usr/lib/monolite + cp $(@D)/* $(HOST_DIR)/usr/lib/monolite +endef + +$(eval $(host-generic-package))
Signature · 1 line
1.7.9.5
PATCH 2/2 package/mono: new package
In reply to Angelo CompagnucciThis patch adds the complete Mono implementation. This patch builds both the native and managed parts.
--- 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
package/Config.in +1 -0
@@ -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
package/mono/Config.in new file +39 -0
@@ -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
package/mono/mono-001-gc-fix-uclibc.patch new file +16 -0
@@ -0,0 +1,16 @@ +Disable backtrace on not supprted uclibc. + +Signed-off-by: Angelo Compagnucci <[email protected]> + +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
package/mono/mono-002-support-uclibc-musl.patch new file +25 -0
@@ -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 <[email protected]> + +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`
package/mono/mono.mk new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/2 package/mono: new package
Dear Angelo Compagnucci,
package/mono/Config.in line 8
Quoted 3 lines · Angelo Compagnucci
package/mono/Config.in new file +3
-0+config BR2_PACKAGE_MONO + bool "mono" + select BR2_STRIP_none
Why ? This is not acceptable in a package.
package/mono/Config.in line 17
Quoted 9 lines
package/mono/Config.in new file +9
-0+ 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.
package/mono/Config.in line 18
Quoted 1 line
package/mono/Config.in new file +1
-0+ config BR2_PACKAGE_MONO_20
No indentation here.
package/mono/Config.in line 21
Quoted 3 lines
package/mono/Config.in new file +3
-0+ bool "2.0 .Net Runtime" + help + Version 2.0 of Mono .Net runtime
Empty new line here as well.
package/mono/Config.in line 25
Quoted 4 lines
package/mono/Config.in new file +4
-0+ 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.
package/mono/Config.in line 34
Quoted 9 lines
package/mono/Config.in new file +9
-0+ 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.
package/mono/mono-001-gc-fix-uclibc.patch line 1
Quoted 7 lines
package/mono/mono-001-gc-fix-uclibc.patch new file +1
-0@@ -0,0 +1,16 @@ +Disable backtrace on not supprted uclibc.
Typo: supported
Quoted 6 lines
package/mono/mono.mk new file +0
-0
package/mono/mono.mk line 10
Quoted 10 lines
package/mono/mono.mk new file +10
-0@@ -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
Quoted 5 lines
package/mono/mono.mk new file +5
-0+ifeq ($(BR2_PACKAGE_MONO_20),y) + ASSEMBLY_INCLUDED += $(HOST_DIR)/usr/lib/mono/2.0 +endif + +ifeq ($(BR2_PACKAGE_MONO_35),y)
package/mono/mono.mk line 40
Quoted 10 lines
package/mono/mono.mk new file +10
-0+ 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.
package/mono/mono.mk line 74
Quoted 3 lines
package/mono/mono.mk new file +3
-0+ifneq ($(ASSEMBLY_INCLUDED),) +$(eval $(host-autotools-package)) +endif
Conditional not needed. I think we should ensure at least one runtime version is enabled.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/2 package/mono: new package
Hi Thomas,
Quoted 3 lines
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!
Quoted 7 lines
package/mono/mono.mk line 74
Quoted 4 lines
package/mono/mono.mk new file +3
-0+ifneq ($(ASSEMBLY_INCLUDED),) +$(eval $(host-autotools-package)) +endifConditional 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!
Quoted 6 lines
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo
PATCH 2/2 package/mono: new package
Dear Angelo Compagnucci,
Quoted 6 lines · Angelo Compagnucci
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.
Quoted 7 lines
Quoted 6 lines
package/mono/mono.mk line 74
Quoted 3 lines
package/mono/mono.mk new file +3
-0+ifneq ($(ASSEMBLY_INCLUDED),) +$(eval $(host-autotools-package)) +endifConditional not needed. I think we should ensure at least one runtime version is enabled.
Quoted 5 lines
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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/2 package/mono: new package
Hi Thomas!
2014-10-12 11:02 GMT+02:00 Thomas Petazzoni
<[email protected]>:
Quoted 5 lines
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!
Quoted 5 lines
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/
endefMONO_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!
Quoted 6 lines
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo
PATCH 2/2 package/mono: new package
Dear Angelo Compagnucci,
Quoted 19 lines · Angelo Compagnucci
Quoted 5 lines
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),)
defineMONO_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/
endefMONO_DEPENDENCIES+= host-monoMONO_POST_INSTALL_TARGET_HOOKS+=MONO_INSTALL_LIBS
endif
Quoted 3 lines
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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/2 package/mono: new package
Hi Thomas!
Quoted 13 lines
Quoted 13 lines
It is already:
ifneq ($(MONO_ASSEMBLY_INCLUDED),)
defineMONO_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/
endefMONO_DEPENDENCIES+= host-monoMONO_POST_INSTALL_TARGET_HOOKS+=MONO_INSTALL_LIBS
endif
Quoted 6 lines
Quoted 3 lines
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.
Quoted 8 lines
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo
PATCH 2/2 package/mono: new package
Dear Angelo Compagnucci,
Quoted 9 lines · Angelo Compagnucci
Quoted 6 lines
Quoted 3 lines
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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/2 package/mono: new package
In reply to Thomas PetazzoniHi Thomas,
2014-10-12 10:25 GMT+02:00 Thomas Petazzoni
<[email protected]>:
Quoted 6 lines
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!
Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo
PATCH 2/2 package/mono: new package
Dear Angelo Compagnucci,
Quoted 8 lines · Angelo Compagnucci
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
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com