truffleruby
truffleruby copied to clipboard
Add build installation option
I'm looking to add the ability to build TruffleRuby from source with a custom ruby-build definition. To make that simpler, I've added a new --install option to jt build. Normally, if jt build detects a standard rbenv or chruby installation directory it establishes a symlink to the latest build there. The symlink approach doesn't work well for ruby-build since it does all of its compilation in a temporary directory. The newly added --install directs jt build to install the final artifact at the specified directory rather than establish a symlink.
It is possible to achieve what I'm looking for without adding the new option. E.g., the truffleruby-dev-builder builds releases without jt build. But, this --install option makes things a lot simpler in my opinion.
I chose the name --install to match the convention of having a make task named install. I could rename it to --prefix if preferred since that's the term often used to specify the make install target. As an another option, we could use the existing --name option and if the name looks like a path use that to trigger a move rather than symlink. If we want to do something like that to reduce the number of options that's fine.
I think that should be done manually, like:
jt --env ENV build
graalvm=$(jt mx --env ENV graalvm-home)
mv "$graalvm" DEST
Mostly because the graalvm layout is soon to be deprecated with unchained, and so using mx standalone-home --type=jvm|native ruby will be preferred. It's also a much smaller build for both native and jvm than the whole GraalVM.
With https://github.com/oracle/truffleruby/pull/3218 the JVM standalones are also built for all jvm* env files by default.
So basically from the upcoming release the graalvm layout will be deprecated and we'll use jvm/native standalones for everything (gates are not migrated yet though).
I was thinking the mv of the graalvm-home/standalone-home might cause issues with mx, but that seems to work fine, i.e. jt build after the mv does recreate the graalvm/standalone.
It's fine to add an option or env var to disable the symlinking behavior into Ruby switcher.