Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 63 lines (54 sloc) 2.792 kb
6757c65 @thewoolleyman add shebang
authored
1 #!/bin/bash
7878668 @thewoolleyman work on support for multiple interpreters
authored
2 # This script is tested on Ubuntu Linux, but it should run on most Debian distros
15dee89 @thewoolleyman initial ccrb checkin
authored
3
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
4 # Install build prerequisites
5f84ac3 @thewoolleyman updates
authored
5 sudo aptitude update
1f16c3e @thewoolleyman install build-essential
authored
6 sudo aptitude install -y build-essential
5f84ac3 @thewoolleyman updates
authored
7 sudo aptitude install -y zlib1g zlib1g-dev
8 sudo aptitude install -y libssl-dev openssl
5c11bd9 @thewoolleyman install openssh-server, openssh-client, and wget. May not be present…
authored
9 sudo aptitude install -y openssh-server openssh-client
10 sudo aptitude install -y wget
15dee89 @thewoolleyman initial ccrb checkin
authored
11
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
12 # Set default options with allowed overrides
7878668 @thewoolleyman work on support for multiple interpreters
authored
13 DEFAULT_RUBY_VERSION=1.8.6-p287
14 if [ -z $RUBY_VERSION ]; then RUBY_VERSION=$DEFAULT_RUBY_VERSION; fi
15 RUBY_MINOR_VERSION=${RUBY_VERSION:0:3}
16 RUBY_TEENY_VERSION=${RUBY_VERSION:0:5}
17 if [ -z $RUBY_PREFIX ]; then RUBY_PREFIX=/usr/local/lib/ruby$RUBY_TEENY_VERSION; fi
18 if [ -z $RUBY_PROGRAM_SUFFIX ]; then RUBY_PROGRAM_SUFFIX=$RUBY_TEENY_VERSION; fi
19 if [ -z $BUILD_DIR ]; then export BUILD_DIR=~/.cinabox; fi
20
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
21 # Download and unpack Ruby distribution
7878668 @thewoolleyman work on support for multiple interpreters
authored
22 mkdir -p $BUILD_DIR
15dee89 @thewoolleyman initial ccrb checkin
authored
23 cd $BUILD_DIR
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
24 rm -rf ruby-$RUBY_VERSION.tar.gz
7878668 @thewoolleyman work on support for multiple interpreters
authored
25 wget ftp://ftp.ruby-lang.org/pub/ruby/$RUBY_MINOR_VERSION/ruby-$RUBY_VERSION.tar.gz
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
26 rm -rf ruby-$RUBY_VERSION
5f84ac3 @thewoolleyman updates
authored
27 tar -zxvf ruby-$RUBY_VERSION.tar.gz
15dee89 @thewoolleyman initial ccrb checkin
authored
28
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
29 # Update extensions Setup by deleting “Win” lines (Win32API and win32ole) and uncommenting all other lines
7878668 @thewoolleyman work on support for multiple interpreters
authored
30 if [ ! -e ruby-$RUBY_VERSION/ext/Setup.orig ]; then cp ruby-$RUBY_VERSION/ext/Setup ruby-$RUBY_VERSION/ext/Setup.orig; fi
5f84ac3 @thewoolleyman updates
authored
31 cat ruby-$RUBY_VERSION/ext/Setup.orig | grep -iv 'win' | sed -n -e 's/#\(.*\)/\1/p' > /tmp/Setup.new
32 cp /tmp/Setup.new ruby-$RUBY_VERSION/ext/Setup
15dee89 @thewoolleyman initial ccrb checkin
authored
33
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
34 # Configure, make, and install
5f84ac3 @thewoolleyman updates
authored
35 cd $BUILD_DIR/ruby-$RUBY_VERSION
7878668 @thewoolleyman work on support for multiple interpreters
authored
36 ./configure --disable-pthreads --prefix=$RUBY_PREFIX --program-suffix=$RUBY_PROGRAM_SUFFIX
15dee89 @thewoolleyman initial ccrb checkin
authored
37 make
38 sudo make install
39
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
40 # Download and install RubyGems
41 if [ -z $RUBYGEMS_MIRROR_ID ]; then RUBYGEMS_MIRROR_ID=45905; fi
42 if [ -z $RUBYGEMS_VERSION ]; then RUBYGEMS_VERSION=1.3.1; fi
43 cd $BUILD_DIR
44 rm -rf rubygems-$RUBYGEMS_VERSION.tgz
45 wget http://rubyforge.org/frs/download.php/$RUBYGEMS_MIRROR_ID/rubygems-$RUBYGEMS_VERSION.tgz
46 rm -rf rubygems-$RUBYGEMS_VERSION
47 tar -zxvf rubygems-$RUBYGEMS_VERSION.tgz
48 cd $BUILD_DIR/rubygems-$RUBYGEMS_VERSION
49 sudo $RUBY_PREFIX/bin/ruby$RUBY_PROGRAM_SUFFIX setup.rb
50
4eb0d56 @thewoolleyman multiple ruby - add support for alternatives
authored
51 # Make symlinks for all executables
6a4f951 @thewoolleyman add rubygems support to bootstrap_ruby.sh
authored
52 sudo ln -sf `cd $RUBY_PREFIX && pwd`/bin/* /usr/local/bin
4eb0d56 @thewoolleyman multiple ruby - add support for alternatives
authored
53
54 # Set up alternatives entry
55 sudo update-alternatives --install \
56 /usr/local/bin/ruby ruby $RUBY_PREFIX/bin/ruby$RUBY_PROGRAM_SUFFIX 100 \
57 --slave /usr/local/bin/erb erb $RUBY_PREFIX/bin/erb$RUBY_PROGRAM_SUFFIX \
58 --slave /usr/local/bin/gem gem $RUBY_PREFIX/bin/gem$RUBY_PROGRAM_SUFFIX \
59 --slave /usr/local/bin/irb irb $RUBY_PREFIX/bin/irb$RUBY_PROGRAM_SUFFIX \
60 --slave /usr/local/bin/rdoc rdoc $RUBY_PREFIX/bin/rdoc$RUBY_PROGRAM_SUFFIX \
61 --slave /usr/local/bin/ri ri $RUBY_PREFIX/bin/ri$RUBY_PROGRAM_SUFFIX \
62 --slave /usr/local/bin/testrb testrb $RUBY_PREFIX/bin/testrb$RUBY_PROGRAM_SUFFIX
Something went wrong with that request. Please try again.