[Mono-osx] Bundling Mono for Dumbarton

Allan Hsu allan at counterpop.net
Mon Dec 4 19:41:20 EST 2006

	What Eoin describes is basically what we do to package Mono in the  
imeem client. The process isn't very portable and that's a big reason  
why this sort of functionality hasn't been committed to SVN. I would  
like to add some sample code or utility scripts to Dumbarton, but I'm  
currently very busy and won't have an opportunity to really look at  
doing this until the middle of January at the earliest.

	The most involved part of bundling is probably the dynamic library  
install_name rewriting that has to go on in order to make the linker  
happy. We accomplish this in imeem with a semi-sane script. It's more  
clean than Eoin's method, so I might try to post something to the  
list if I can find time in the next few days.

	As for bundling the GAC, we do this by copying the whole GAC into  
the application bundle and then selectively deleting portions that we  
don't use. This is entirely hand-tuned and non-portable. I think the  
proper way to do this would be to use the Mono linker or Cecil to  
write a single super-assembly that contains your assembly and all of  
the classes and methods from the GAC that it needs. This would ensure  
that only methods that get used would be shipped in your application  
bundle. This would eliminate the need to copy the GAC into your  
bundle at all.

If file size is an issue for you, you should also consider stripping  
the Mono dylibs. We use "strip -x". You can get another big reduction  
in file size by building your own version of Mono using the -Os  
optimization flag for Mono and its dependencies. The currently  
shipping universal builds of Mono contain an 11.2MB libmono dylib;  
the last universal version of imeem I built using -Os has a 4.4MB  
libmono dylib. Stripped, it comes down to 3.7MB. I briefly talked to  
Wade about changing this in the official builds at the Mono meeting,  
but I don't think anything has been done about it (and I'm not sure  
this would be something that's desirable in the official builds).

Allan Hsu <allan at counterpop dot net>
1E64 E20F 34D9 CBA7 1300  1457 AC37 CBBB 0E92 C779

More information about the Mono-osx mailing list