JuliaLang/julia — pull request #7124 by staticfloat (2014-06-05 00:11:32+00:00)
Title: [WIP] Add Base.build_sysimg()

This is basically just a julia translation of the makefile targets for generating `sys.$(dlext)` from `sys.ji`. I'm sure there are border cases where this won't work, but I've tested it successfully on 64-bit Linux and OSX 10.9.

My thinking behind this is that we can then ship a `sys.ji` that has been created with `.setMCPU("x86")`, or `.setMCPU("core2")`, or whatever, but after we've started up, looked around, and decided that it is possible to regenerate the system image, we can build a native system image that should hopefully be faster.

@Keno (nice!), @vtjnash, @JeffBezanson what do you guys think of this? If this general approach is looked upon with favour, I will add on to this PR with commits to make the `.setMCPU()` calls a little more dynamic. As it stands now, if we distribute a `.setMCPU("i386")` binary, even if we rebuild the system image like this, we don't get any benefit, since the binary already has these restrictions baked in.

In the meantime, this branch can be tested out by installing Julia, (e.g. `make install prefix=/my/temp/prefix`), deleting `sys.{so,dll,dylib}`, and then opening Julia and running `Base.build_sysimg()`. This should "just work", or print out intelligent errors when something doesn't work. I think something like this would be much nicer for our "power users" than manually mucking around with system images and such, and even allows for users to play around with their `userimg.jl` to get package insta-loading, regardless of whether they built from source or not.