1#!/bin/bash 2 3set -ex 4 5set +ex # rvm script is very verbose and exits with errorcode 6source $HOME/.rvm/scripts/rvm 7set -e # rvm commands are very verbose 8time rvm install 2.5.0 9rvm use 2.5.0 10gem install rake-compiler --no-document 11gem install bundler --no-document 12time rvm install 2.7.0 13rvm use 2.7.0 --default 14gem install rake-compiler --no-document 15gem install bundler --no-document 16rvm osx-ssl-certs status all 17rvm osx-ssl-certs update all 18set -ex 19 20rm -rf ~/.rake-compiler 21 22CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX) 23 24curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.1.0/tasks/bin/cross-ruby.rake > "$CROSS_RUBY" 25 26# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details 27patch "$CROSS_RUBY" << EOF 28--- cross-ruby.rake 2018-04-10 11:32:16.000000000 -0700 29+++ patched 2018-04-10 11:40:25.000000000 -0700 30@@ -141,8 +141,10 @@ 31 "--host=#{MINGW_HOST}", 32 "--target=#{MINGW_TARGET}", 33 "--build=#{RUBY_BUILD}", 34- '--enable-shared', 35+ '--enable-static', 36+ '--disable-shared', 37 '--disable-install-doc', 38+ '--without-gmp', 39 '--with-ext=' 40 ] 41 42@@ -159,6 +161,7 @@ 43 # make 44 file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t| 45 chdir File.dirname(t.prerequisites.first) do 46+ sh "test -s verconf.h || rm -f verconf.h" # if verconf.h has size 0, make sure it gets re-built by make 47 sh MAKE 48 end 49 end 50EOF 51 52MAKE="make -j8" 53 54set +x # rvm commands are very verbose 55rvm use 2.7.0 56set -x 57ruby --version | grep 'ruby 2.7.0' 58for v in 2.7.0 ; do 59 ccache -c 60 rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE" 61done 62set +x 63rvm use 2.5.0 64set -x 65ruby --version | grep 'ruby 2.5.0' 66for v in 2.6.0 2.5.1 2.4.0 2.3.0; do 67 ccache -c 68 rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE" 69done 70set +x 71rvm use 2.7.0 72set -x 73 74sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY" 75mv "$CROSS_RUBY" ~/.rake-compiler/config.yml 76