Get your own Tail-call Optimized Ruby with this one weird ruby-install command.
CONFIGURE_OPTS="--disable-install-rdoc" ruby-install -p https://gist.githubusercontent.com/plexus/11201946/raw/517cc64511146454f7a066eb40132a6e898241c0/enable_tco.diff -p https://gist.githubusercontent.com/plexus/10021256/raw/9d9edf8d4f03643c7dce4d52c576ad40f2a01760/ruby-2.1.1-readline.patch -i ~/.rubies/ruby-2.1.1-tco ruby 2.1
I had to disable rdoc generation because for whatever reason it segfaulted, you might be able to leave off that CONFIGURE_OPTS. The first patch enables TCO, and is nothing more than
diff --git i/vm_opts.h w/vm_opts.h
index b67e254..3e3935a 100644
--- i/vm_opts.h
+++ w/vm_opts.h
@@ -18,8 +18,8 @@
* Following definitions are default values.
*/
-#define OPT_TRACE_INSTRUCTION 1
-#define OPT_TAILCALL_OPTIMIZATION 0
+#define OPT_TRACE_INSTRUCTION 0
+#define OPT_TAILCALL_OPTIMIZATION 1
#define OPT_PEEPHOLE_OPTIMIZATION 1
#define OPT_SPECIALISED_INSTRUCTION 1
#define OPT_INLINE_CONST_CACHE 1
The second patch is a workaround to make Ruby compile against a newer Readline than is currently supported. This is needed on Ubuntu 14.04, you might be able to do without.
A small correction,
CONFIGURE_OPTS
is for ruby-build. The command should be: