Skip to content

Instantly share code, notes, and snippets.

@mazur
Created June 1, 2011 19:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mazur/1003052 to your computer and use it in GitHub Desktop.
Save mazur/1003052 to your computer and use it in GitHub Desktop.
Build IronRuby on mono OSX/Ubuntu
#!/bin/bash
shopt -s extglob #Enables extglob
# OS: OSX 10.6.7 and Ubuntu 11.04
# Mono: 2.10.1
# Mono 2.10 is required since we need C# 4.0 support to compile IronRuby.
# C# 4.0 support can either be found in mono 2.10 or 2.6 compiled with special
# flags.
# Installing mono 2.10 depends on your system. Best way is to try downloading
# pre-compiled binaries from:
# http://www.go-mono.com/mono-downloads/download.html
# Mono build instructions for Ubuntu:
# http://www.integratedwebsystems.com/2011/05/install-mono-2-10-2-and-monodevelop-2-6-beta-3-on-ubuntu-or-fedora-with-a-bash-script/
# We should check for the following files in the users path:
# mono, xbuild, dmcs
# These instructions work for head, v1.1.3, v1.1.2.
# They won't work with older versions since the build
# process seam to have changed.
# Just setting some arbitrary path to show how it works
INSTALL_PATH=$HOME/.ironruby
mkdir -p $INSTALL_PATH
cd $INSTALL_PATH
# Build binaries
git clone git://github.com/IronLanguages/main.git src
cd src
# git checkout v1.1.3 # for specific version
xbuild /p:Configuration=Release Solutions/Ruby.sln
# IronRuby binaries are put into bin/Release
# Copy binaries to output folder
mkdir -p $INSTALL_PATH/bin
cp bin/Release/* $INSTALL_PATH/bin
# Copy standard libraries
mkdir -p $INSTALL_PATH/lib
cp -R Languages/Ruby/StdLib/* $INSTALL_PATH/lib
# Copy binaries, it's these binaries we will be generating scripts for later
cd Languages/Ruby/Scripts/bin/
cp !(*.bat) $INSTALL_PATH/bin
# Change configuration
cd $INSTALL_PATH/bin
sed -i '' -e 's#\(<set language="Ruby" option="StandardLibrary" value="\).*\("/>\)#\1'..\\\\lib'\2#g' ir.exe.config
# Create scripts
# This should be 'ruby' in rvm case I think
echo "#!/bin/sh
exec `which mono` $INSTALL_PATH/bin/ir.exe \$@" > "$INSTALL_PATH/bin/ir"
# This should be 'irb' in rvm case I think
echo "#!/bin/sh
exec $INSTALL_PATH/bin/ir $INSTALL_PATH/bin/irb \$@" > "$INSTALL_PATH/bin/iirb"
# This should be 'gem' in rvm case I think
echo "#!/bin/sh
exec $INSTALL_PATH/bin/ir $INSTALL_PATH/bin/gem \$@" > "$INSTALL_PATH/bin/igem"
# This should be 'ri' in rvm case I think
echo "#!/bin/sh
exec $INSTALL_PATH/bin/ir $INSTALL_PATH/bin/ri \$@" > "$INSTALL_PATH/bin/iri"
# This should be 'rdoc' in rvm case I think
echo "#!/bin/sh
exec $INSTALL_PATH/bin/ir $INSTALL_PATH/bin/rdoc \$@" > "$INSTALL_PATH/bin/irdoc"
# Make scripts executable
chmod ug+x "$INSTALL_PATH/bin/ir" "$INSTALL_PATH/bin/iirb" "$INSTALL_PATH/bin/igem" "$INSTALL_PATH/bin/iri" "$INSTALL_PATH/bin/irdoc"
@FredrikL
Copy link

FredrikL commented Jun 2, 2011

For Ubuntu you need to build mono 2.10, following these instructions: http://www.integratedwebsystems.com/2011/05/install-mono-2-10-2-and-monodevelop-2-6-beta-3-on-ubuntu-or-fedora-with-a-bash-script/

And then change path to use the 2.10 mono binaries (export PATH=/opt/mono-2.10/bin:$PATH)

Since Ubuntu ships with mono 2.6.7 (LTS version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment