Last active
April 5, 2019 14:16
-
-
Save madwork/d35013fa1c109fd2350fc79453430c6e to your computer and use it in GitHub Desktop.
Compile Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
!.gitignore | |
!ruby-build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export LDFLAGS='-L/usr/local/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/curl/lib -L/usr/local/opt/libiconv/lib -L/usr/local/opt/[email protected]/lib' | |
export CPPFLAGS='-I/usr/local/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/curl/include -I/usr/local/opt/libiconv/include -I/usr/local/opt/[email protected]/include' | |
export ARCHFLAGS='-arch x86_64' | |
export CFLAGS='-g -O2' | |
read -p 'RUBY_VERSION: ' RUBY_VERSION | |
read -p 'RUBY_SHA256: ' RUBY_SHA256 | |
cd $HOME/code/ruby-build | |
curl -L -O -C - https://cache.ruby-lang.org/pub/ruby/${RUBY_VERSION:0:3}/ruby-${RUBY_VERSION}.tar.gz | |
echo "${RUBY_SHA256} ruby-${RUBY_VERSION}.tar.gz" > ruby-${RUBY_VERSION}.tar.gz.sha256 | |
if ! shasum -c ruby-${RUBY_VERSION}.tar.gz.sha256; then | |
exit 1 | |
fi | |
rm -rf ruby-${RUBY_VERSION} | |
tar zxf ruby-${RUBY_VERSION}.tar.gz | |
cd ruby-${RUBY_VERSION} | |
./configure --disable-install-doc --enable-shared --prefix=$HOME/.rubies/ruby-${RUBY_VERSION} | |
make | |
make install | |
echo ruby-${RUBY_VERSION} | |
/usr/local/bin/chruby-exec ruby-${RUBY_VERSION} -- gem update --system --no-document | |
/usr/local/bin/chruby-exec ruby-${RUBY_VERSION} -- gem install bundler pry awesome_print --no-document |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment