Skip to contentSkip to conversation

package/mono: allow to select which folders to install to target

PATCH In review Giulio Benetti 4 participants 12 messages Oct 18, 2022 – Nov 1, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/mono: allow to select which folders to install to target

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

---
 package/mono/Config.in | 16 ++++++++++++++++
 package/mono/mono.mk   | 12 ++++++++++++
 2 files changed, 28 insertions(+)
package/mono/Config.in +16 -0
index 76178bcf9b..8690ee68ef 100644
@@ -23,6 +23,22 @@ config BR2_PACKAGE_MONO
 
 	  http://download.mono-project.com/sources/mono/
 
+config BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+	bool "Specify folders to install to target"
+	help
+	  Allow to specify which Mono folder to install to target
+
+if BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+
+config BR2_PACKAGE_MONO_FOLDERS_TO_INSTALL
+	string "Mono folders to install to target"
+	help
+	  Paths to Mono folders to install to target /usr/lib/mono/.
+	  Only these folders will be copied to the target and not all
+	  the built ones. You can provide a list of folders separated by
+	  by spaces.
+
+endif
 comment "mono needs a toolchain w/ C++, NPTL, dynamic library"
 	depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS
 	depends on !BR2_INSTALL_LIBSTDCPP || \
package/mono/mono.mk +12 -0
index 219effc5d3..8036d23205 100644
@@ -30,10 +30,22 @@ MONO_CONF_OPTS = $(MONO_COMMON_CONF_OPTS) --disable-mcs-build
 
 # The libraries have been built by the host-mono build. Since they are
 # architecture-independent, we simply copy them to the target.
+ifeq ($(BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL),y)
+# Copy only selected folders
+define MONO_INSTALL_LIBS
+	mkdir -p $(TARGET_DIR)/usr/lib/mono
+	(for dir in $(call qstrip,$(BR2_PACKAGE_MONO_FOLDERS_TO_INSTALL)); do \
+		rsync -av --exclude=*.so --exclude=*.mdb \
+		$(HOST_DIR)/lib/mono/$${dir} $(TARGET_DIR)/usr/lib/mono; \
+	done)
+endef
+else
+# Copy all folders
 define MONO_INSTALL_LIBS
 	rsync -av --exclude=*.so --exclude=*.mdb \
 		$(HOST_DIR)/lib/mono $(TARGET_DIR)/usr/lib/
 endef
+endif
 
 MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS
 
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Giulio Benetti

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Quoted 2 lines

---

Looks good to me, even if I'm not sure how much this will be used. Mono is usually run on beefy hardware where you have plenty of space. It's a nice addition anyway.

 package/mono/Config.in | 16 ++++++++++++++++
Quoted 67 lines
 package/mono/mono.mk   | 12 ++++++++++++
 2 files changed, 28 insertions(+)
package/mono/Config.in +16 -0
index 76178bcf9b..8690ee68ef 100644
@@ -23,6 +23,22 @@ config BR2_PACKAGE_MONO
 
          http://download.mono-project.com/sources/mono/
 
+config BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+       bool "Specify folders to install to target"
+       help
+         Allow to specify which Mono folder to install to target
+
+if BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+
+config BR2_PACKAGE_MONO_FOLDERS_TO_INSTALL
+       string "Mono folders to install to target"
+       help
+         Paths to Mono folders to install to target /usr/lib/mono/.
+         Only these folders will be copied to the target and not all
+         the built ones. You can provide a list of folders separated by
+         by spaces.
+
+endif
 comment "mono needs a toolchain w/ C++, NPTL, dynamic library"
        depends on BR2_PACKAGE_MONO_ARCH_SUPPORTS
        depends on !BR2_INSTALL_LIBSTDCPP || \
package/mono/mono.mk +12 -2
index 219effc5d3..8036d23205 100644
@@ -30,10 +30,22 @@ MONO_CONF_OPTS = $(MONO_COMMON_CONF_OPTS)
--disable-mcs-build
 
 # The libraries have been built by the host-mono build. Since they are
 # architecture-independent, we simply copy them to the target.
+ifeq ($(BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL),y)
+# Copy only selected folders
+define MONO_INSTALL_LIBS
+       mkdir -p $(TARGET_DIR)/usr/lib/mono
+       (for dir in $(call qstrip,$(BR2_PACKAGE_MONO_FOLDERS_TO_INSTALL));
 do \
+               rsync -av --exclude=*.so --exclude=*.mdb \
+               $(HOST_DIR)/lib/mono/$${dir} $(TARGET_DIR)/usr/lib/mono; \
+       done)
+endef
+else
+# Copy all folders
 define MONO_INSTALL_LIBS
        rsync -av --exclude=*.so --exclude=*.mdb \
                $(HOST_DIR)/lib/mono $(TARGET_DIR)/usr/lib/
 endef
+endif
 
 MONO_POST_INSTALL_TARGET_HOOKS += MONO_INSTALL_LIBS
 
--

2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Signature · 15 lines
Angelo Compagnucci

Software Engineer

[email protected]
__________________________________
Amarula Solutions SRL

Via le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 (0)42 243 5310
[email protected]

www.amarulasolutions.com
[`as] https://www.amarulasolutions.com|

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Giulio Benetti

Hello Giulio,

Quoted 5 lines · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Thanks for proposing this.

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

Here, I have these ones:

drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 2.0-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 3.5-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 4.0
drwxr-xr-x   2 thomas thomas 12288 oct.  25 22:58 4.0-api
drwxr-xr-x   4 thomas thomas 16384 oct.  25 22:58 4.5
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.8-api
drwxr-xr-x 145 thomas thomas 12288 oct.  25 22:56 gac
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 lldb
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 mono-configuration-crypto
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 monodoc
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 msbuild
drwxr-xr-x   6 thomas thomas  4096 oct.  25 22:56 xbuild
drwxr-xr-x   4 thomas thomas  4096 oct.  25 22:56 xbuild-frameworks

package/mono/Config.in config BR2_PACKAGE_MONO · line 29

Quoted 4 lines
package/mono/Config.in +4 -0
+config BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+	bool "Specify folders to install to target"
+	help
+	  Allow to specify which Mono folder to install to target

I don't really have a very good suggestion, but I don't like the name of the option. We rarely have option names that are "sentences", i.e "specify folders to install" is a sentence.

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

The other obvious question is whether this shouldn't simply be left as something to do in a post-build script. Even though I admit that reducing 190 MB down to something reasonable can be seen as something that is almost mandatory.

Or alternatively, do we have a better way, where we could automate this selection of which folders are needed?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Giulio, Thomas, All,

On 2022-10-31 13:25 +0100, Thomas Petazzoni via buildroot spake thusly:

Quoted 9 lines
Quoted 5 lines · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

Yes, can you provide a rationale for when only a subset of APIs is needed?

Quoted 16 lines

Here, I have these ones:

drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 2.0-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 3.5-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 4.0
drwxr-xr-x   2 thomas thomas 12288 oct.  25 22:58 4.0-api
drwxr-xr-x   4 thomas thomas 16384 oct.  25 22:58 4.5
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7-api
Quoted 8 lines
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.8-api
drwxr-xr-x 145 thomas thomas 12288 oct.  25 22:56 gac
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 lldb
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 mono-configuration-crypto
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 monodoc
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 msbuild
drwxr-xr-x   6 thomas thomas  4096 oct.  25 22:56 xbuild
drwxr-xr-x   4 thomas thomas  4096 oct.  25 22:56 xbuild-frameworks

It looks like we have three sets of directories here;
- version-based dirs: from 2.0-api up to 4.8-api
- gac/: big number of subdirs in there...
- the rest

Your change trat them all on the same level, but are they all really superfluous? Is there a set that absolutely needs to be there, or can we really do with just one (or even none, see below)?

Note: can we unconditionally get rid of monodoc/? Of msbuild/? Of lldb/?

Quoted 9 lines

package/mono/Config.in config BR2_PACKAGE_MONO · line 29

Quoted 4 lines
package/mono/Config.in +4 -0
+config BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+	bool "Specify folders to install to target"
+	help
+	  Allow to specify which Mono folder to install to target

I don't really have a very good suggestion, but I don't like the name of the option. We rarely have option names that are "sentences", i.e "specify folders to install" is a sentence.

Quoted 4 lines

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

Agreed. I expect that having no API level installed would yield a non-working system, so:

config BR2_PACKAGE_MONO_API_VERSIONS
string "API versions to install"
help
Keep empty to install all.

Quoted 7 lines

The other obvious question is whether this shouldn't simply be left as something to do in a post-build script. Even though I admit that reducing 190 MB down to something reasonable can be seen as something that is almost mandatory.

Or alternatively, do we have a better way, where we could automate this selection of which folders are needed?

I would prefer we avoid carrying the list of versionned APIs (and the rest, see above).

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Hi Yann,

Quoted 9 lines · Yann E. MORIN

Giulio, Thomas, All,

On 2022-10-31 13:25 +0100, Thomas Petazzoni via buildroot spake thusly:

Quoted 6 lines
Quoted 4 lines · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

Yes, can you provide a rationale for when only a subset of APIs is needed?

I've answered on previous e-mail. I've realized only now that I could answer to your e-mail for both.

Quoted 30 lines
Quoted 16 lines

Here, I have these ones:

drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 2.0-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 3.5-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 4.0
drwxr-xr-x   2 thomas thomas 12288 oct.  25 22:58 4.0-api
drwxr-xr-x   4 thomas thomas 16384 oct.  25 22:58 4.5
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7-api
Quoted 8 lines
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.8-api
drwxr-xr-x 145 thomas thomas 12288 oct.  25 22:56 gac
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 lldb
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 mono-configuration-crypto
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 monodoc
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 msbuild
drwxr-xr-x   6 thomas thomas  4096 oct.  25 22:56 xbuild
drwxr-xr-x   4 thomas thomas  4096 oct.  25 22:56 xbuild-frameworks

It looks like we have three sets of directories here;
- version-based dirs: from 2.0-api up to 4.8-api
- gac/: big number of subdirs in there...
- the rest

Quoted 5 lines

Your change trat them all on the same level, but are they all really superfluous? Is there a set that absolutely needs to be there, or can we really do with just one (or even none, see below)?

Note: can we unconditionally get rid of monodoc/? Of msbuild/? Of lldb/?

To tell the truth I'm not expert in this. I know that my customer's application only needed the files in those folders.
So I can't find at the moment something that clarifies this, that's why I've given a very open solution. Of course this can give problems in runtime. But the mono application should fail immediately if someone skip some folder.

Quoted 14 lines
Quoted 9 lines

package/mono/Config.in config BR2_PACKAGE_MONO · line 29

Quoted 4 lines
package/mono/Config.in +4 -0
+config BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+	bool "Specify folders to install to target"
+	help
+	  Allow to specify which Mono folder to install to target

I don't really have a very good suggestion, but I don't like the name of the option. We rarely have option names that are "sentences", i.e "specify folders to install" is a sentence.

Quoted 4 lines

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

Quoted 7 lines

Agreed. I expect that having no API level installed would yield a non-working system, so:

config BR2_PACKAGE_MONO_API_VERSIONS
string "API versions to install"
help
Keep empty to install all.

Ok, I go with that then!

Quoted 10 lines
Quoted 7 lines

The other obvious question is whether this shouldn't simply be left as something to do in a post-build script. Even though I admit that reducing 190 MB down to something reasonable can be seen as something that is almost mandatory.

Or alternatively, do we have a better way, where we could automate this selection of which folders are needed?

I would prefer we avoid carrying the list of versionned APIs (and the rest, see above).

Yes I agree, otherwise the list would be pretty long.

Best regards

Signature · 6 lines
Giulio Benetti
CEO/CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Giulio, All,

On 2022-11-01 03:27 +0100, Giulio Benetti spake thusly:

Quoted 8 lines · Yann E. MORIN
Quoted 7 lines

On 2022-10-31 13:25 +0100, Thomas Petazzoni via buildroot spake thusly:

Quoted 6 lines
Quoted 4 lines · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

Yes, can you provide a rationale for when only a subset of APIs is needed?

I've answered on previous e-mail. I've realized only now that I could answer to your e-mail for both.

Hey, what you answered Thomas is not a rationale, it is an example. ;-) A rationale is "an explanation of controlling principles of opinion, belief, practice, or phenomena", or "an underlying reason". [0]

As a rationale, I would have expected something that explains the reason why there are so many directories, and so why, under some circumstances, we can get rid of them (or not). It needs not be too long, but just provide an overview. For example, here is a totally made up blurb:

mono provides support for a lot of legacy APIs for backward compatibility for existing applications, way back from the first stable API, 2.0 and up to the current version. The set of APIs are split in two categories: version-based APIs, and the rest (gac, the FooBar set of common Baz; monodoc, which renders documentation while riding a unicycle...).

For a custom application, the set of required versioned APIs is limited; most often only the latest or the very few latest are needed. Only gac is always required, and monodoc is never used on the target as we never render the documentation there.

[0] https://www.merriam-webster.com/dictionary/rationale

[--SNIP--]

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

Agreed. I expect that having no API level installed would yield a non-working system, so:
config BR2_PACKAGE_MONO_API_VERSIONS
string "API versions to install"
help
Keep empty to install all.

Ok, I go with that then!

ACK.

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Il mar 1 nov 2022, 09:32 Yann E. MORIN <[email protected]> ha scritto:

Quoted 54 lines

Giulio, All,

On 2022-11-01 03:27 +0100, Giulio Benetti spake thusly:

Quoted 5 lines · Yann E. MORIN
Quoted 4 lines

On 2022-10-31 13:25 +0100, Thomas Petazzoni via buildroot spake thusly:

Quoted 3 lines
Quoted 1 line · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the

size of

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

Yes, can you provide a rationale for when only a subset of APIs is needed?

I've answered on previous e-mail. I've realized only now that I could answer to your e-mail for both.

Hey, what you answered Thomas is not a rationale, it is an example. ;-) A rationale is "an explanation of controlling principles of opinion, belief, practice, or phenomena", or "an underlying reason". [0]

As a rationale, I would have expected something that explains the reason why there are so many directories, and so why, under some circumstances, we can get rid of them (or not). It needs not be too long, but just provide an overview. For example, here is a totally made up blurb:

mono provides support for a lot of legacy APIs for backward compatibility for existing applications, way back from the first stable API, 2.0 and up to the current version. The set of APIs are split in two categories: version-based APIs, and the rest (gac, the FooBar set of common Baz; monodoc, which renders documentation while riding a unicycle...).

For a custom application, the set of required versioned APIs is limited; most often only the latest or the very few latest are needed. Only gac is always required, and monodoc is never used on the target as we never render the documentation there.

[0] https://www.merriam-webster.com/dictionary/rationale

[--SNIP--]

Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

Agreed. I expect that having no API level installed would yield a non-working system, so:
config BR2_PACKAGE_MONO_API_VERSIONS
string "API versions to install"
help
Keep empty to install all.

Quoted 4 lines
Quoted 1 line

Ok, I go with that then!

ACK.

My two cents. Historically, the mono configure was offering some options to enable only some versions of the API which was lately removed So, removing older compatibility API folders should be perfectly fine. We cannot remove the Global Assembly Cache (GAC).

For the rest, it would be nice if Giulio could do some testing (I can try it too) to understand at what extent we can remove any other folder.

Quoted 15 lines

Regards,
Yann E. MORIN.

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |
Quoted 6 lines

'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

Angelo, All,

On 2022-11-01 10:19 +0100, Angelo Compagnucci spake thusly:
[--SNIP--]

Quoted 5 lines

My two cents. Historically, the mono configure was offering some options to enable only some versions of the API which was lately removed
So, removing older compatibility API folders should be perfectly fine.

Thanks for the confirmation! :-)

My understanding, though, would be that we may need more than one such versionned API. For example, I would (hypothetically!) develope my app agaings current version, say 4.8-api, so I am using APIs from that version. Then I update to a newer mono, and I start using the new APIs, e.g. 5.3-api, in the new parts of my app, but the existing parts are still using 4.8-api, so I need both.

Is that sensible, or did I mis-understood?

If correct, then we need to be able to select more than one versioned API.

Quoted 1 line

We cannot remove the Global Assembly Cache (GAC).

So, we an' rely on it being listed by the user; we must explicitly install it.

    MONO_INSTALL_DIRS = \
        gac \
        $(fitler-out gac,$(call qstrip,$(BR2_PACKAGE_MONO_API_DIRS)))

    $(foreach dir,$(MONO_INSTALL_DIRS),copy the $(d) dir)
Quoted 3 lines

For the rest, it would be nice if Giulio could do some testing (I can try it too) to understand at what extent we can remove any other folder.

That would be awesome, thanks!

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw
Quoted 20 lines · Yann E. MORIN

Angelo, All,

On 2022-11-01 10:19 +0100, Angelo Compagnucci spake thusly:
[--SNIP--]

Quoted 5 lines

My two cents. Historically, the mono configure was offering some options to enable only some versions of the API which was lately removed
So, removing older compatibility API folders should be perfectly fine.

Thanks for the confirmation! :-)

My understanding, though, would be that we may need more than one such versionned API. For example, I would (hypothetically!) develope my app agaings current version, say 4.8-api, so I am using APIs from that version. Then I update to a newer mono, and I start using the new APIs, e.g. 5.3-api, in the new parts of my app, but the existing parts are still using 4.8-api, so I need both.

Quoted 5 lines

Is that sensible, or did I mis-understood?

If correct, then we need to be able to select more than one versioned API.

Last time I worked on a mono project was several years ago, so I'm a bit rusty,

Not really sure you can mix and match assemblies from different versions, never tried really.

Usually a developer updates the API target version in the application manifest then rebuilds everything for the newer version.

From what I know, the various API versions are used to run a compiled application against any mono installation. Usually a mono application is distributed in binary form and so it needs the right assemblies for the same version the application was compiled against.

Quoted 12 lines
Quoted 1 line

We cannot remove the Global Assembly Cache (GAC).

So, we an' rely on it being listed by the user; we must explicitly install it.

    MONO_INSTALL_DIRS = \
        gac \
        $(fitler-out gac,$(call qstrip,$(BR2_PACKAGE_MONO_API_DIRS)))

    $(foreach dir,$(MONO_INSTALL_DIRS),copy the $(d) dir)

I would say this looks right to me.

Quoted 23 lines

For the rest, it would be nice if Giulio could do some testing (I can

Quoted 2 lines

try it too) to understand at what extent we can remove any other folder.

That would be awesome, thanks!

Regards,
Yann E. MORIN.

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Signature · 15 lines
Angelo Compagnucci

Software Engineer

[email protected]
__________________________________
Amarula Solutions SRL

Via le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 (0)42 243 5310
[email protected]

www.amarulasolutions.com
[`as] https://www.amarulasolutions.com|

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#10 lore raw
In reply to Yann E. MORIN
Quoted 38 lines

Il giorno 1 nov 2022, alle ore 09:32, Yann E. MORIN <[email protected]> ha scritto:

Giulio, All,

On 2022-11-01 03:27 +0100, Giulio Benetti spake thusly:

Quoted 8 lines
Quoted 8 lines · Yann E. MORIN

On 2022-10-31 13:25 +0100, Thomas Petazzoni via buildroot spake thusly:

Quoted 6 lines
Quoted 4 lines · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

Yes, can you provide a rationale for when only a subset of APIs is needed?

I've answered on previous e-mail. I've realized only now that I could answer to your e-mail for both.

Hey, what you answered Thomas is not a rationale, it is an example. ;-) A rationale is "an explanation of controlling principles of opinion, belief, practice, or phenomena", or "an underlying reason". [0]

As a rationale, I would have expected something that explains the reason why there are so many directories, and so why, under some circumstances, we can get rid of them (or not). It needs not be too long, but just provide an overview. For example, here is a totally made up blurb:

mono provides support for a lot of legacy APIs for backward compatibility for existing applications, way back from the first stable API, 2.0 and up to the current version. The set of APIs are split in two categories: version-based APIs, and the rest (gac, the FooBar set of common Baz; monodoc, which renders documentation while riding a unicycle...).

Quoted 4 lines

For a custom application, the set of required versioned APIs is limited; most often only the latest or the very few latest are needed. Only gac is always required, and monodoc is never used on the target as we never render the documentation there.

Oh, thank you Yann, my English has some gap, I didn’t know that. And thanks for the example too. So you’ve given already a rationale here.

I’ll come up with a V2 patch then!

Best regards
Giulio

Quoted 14 lines

[0] https://www.merriam-webster.com/dictionary/rationale

[--SNIP--]

Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

Agreed. I expect that having no API level installed would yield a non-working system, so:
config BR2_PACKAGE_MONO_API_VERSIONS
string "API versions to install"
help
Keep empty to install all.

Quoted 14 lines
Quoted 1 line

Ok, I go with that then!

ACK.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#11 lore raw
In reply to Thomas Petazzoni via buildroot

Hello Thomas,

Quoted 9 lines · Thomas Petazzoni

Hello Giulio,

Quoted 4 lines · On Wed, 19 Oct 2022 01:46:17 +0200 Giulio Benetti…

At the moment all APIs folders are copied to target increasing the size of rootfs of ~190MB. Allow to select which API folders we want to copy to target to shrink rootfs down.

Quoted 6 lines
Quoted 1 line

Thanks for proposing this.

Practically speaking, could you describe which folders are needed in a typical scenario you've had?

One scenario I'm facing right now is:
drwxr-xr-x 4 giuliobenetti giuliobenetti 16384 ott 26 01:26 4.5
drwxr-xr-x 145 giuliobenetti giuliobenetti 12288 ott 26 01:20 gac
drwxr-xr-x 2 giuliobenetti giuliobenetti 4096 ott 26 01:22 lldb

And the total is 95MB big.
gac/ is ~56MB and that's mandatory in my case.
4.5/ is ~36MB
lldb/ is only 5K

While copying all directories is ~195MB so I was wrong, we don't save ~190MB, but anyway we save almost 100MB that for size costraint systems and most of all for production programming save time. The latter is why I need it most of all.

Quoted 34 lines

Here, I have these ones:

drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 2.0-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:58 3.5-api
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 4.0
drwxr-xr-x   2 thomas thomas 12288 oct.  25 22:58 4.0-api
drwxr-xr-x   4 thomas thomas 16384 oct.  25 22:58 4.5
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.5-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.6-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.1-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7.2-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.7-api
drwxr-xr-x   3 thomas thomas 12288 oct.  25 22:58 4.8-api
drwxr-xr-x 145 thomas thomas 12288 oct.  25 22:56 gac
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 lldb
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 mono-configuration-crypto
drwxr-xr-x   2 thomas thomas  4096 oct.  25 22:56 monodoc
drwxr-xr-x   3 thomas thomas  4096 oct.  25 22:56 msbuild
drwxr-xr-x   6 thomas thomas  4096 oct.  25 22:56 xbuild
drwxr-xr-x   4 thomas thomas  4096 oct.  25 22:56 xbuild-frameworks

package/mono/Config.in config BR2_PACKAGE_MONO · line 29

Quoted 4 lines
package/mono/Config.in +4 -0
+config BR2_PACKAGE_MONO_SPECIFY_FOLDERS_TO_INSTALL
+	bool "Specify folders to install to target"
+	help
+	  Allow to specify which Mono folder to install to target

I don't really have a very good suggestion, but I don't like the name of the option. We rarely have option names that are "sentences", i.e "specify folders to install" is a sentence.

Quoted 4 lines

Should we instead have a single string option BR2_PACKAGE_MONO_INSTALL_LIB_DIRS, which is empty by default. When empty, it means all folders are installed. Otherwise, only the specified folders are installed.

Yes, I can do like that.

Quoted 4 lines

The other obvious question is whether this shouldn't simply be left as something to do in a post-build script. Even though I admit that reducing 190 MB down to something reasonable can be seen as something that is almost mandatory.

~100MB after recalculating. Anyway it's a bit odd to create ad hoc script to remove 29 folders an keep only 3. Usually I expect a mono user to write an application using only 1 API version.

Quoted 2 lines

Or alternatively, do we have a better way, where we could automate this selection of which folders are needed?

In the beginning I thought that mono provided such possibility in its build system but it's not like that, check:
https://github.com/mono/reference-assemblies/blob/680013abda911528f6befca67eed5669d80c85d5/Makefile

That is why I've ended up with this solution. Honestly I wanted to avoid to even install these dll files to host/ but it's not possible. Otherwise I have to patch the Makefile and in the end having 100M on host I don't think is a problem.

Signature · 6 lines
Giulio Benetti
CEO/CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot