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 --default 10gem install rake-compiler --no-ri --no-doc 11gem install bundler --no-ri --no-doc 12rvm osx-ssl-certs status all 13rvm osx-ssl-certs update all 14set -ex 15 16rm -rf ~/.rake-compiler 17 18CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX) 19 20curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY" 21 22# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details 23patch "$CROSS_RUBY" << EOF 24--- cross-ruby.rake 2018-04-10 11:32:16.000000000 -0700 25+++ patched 2018-04-10 11:40:25.000000000 -0700 26@@ -133,8 +133,10 @@ 27 "--host=#{MINGW_HOST}", 28 "--target=#{MINGW_TARGET}", 29 "--build=#{RUBY_BUILD}", 30- '--enable-shared', 31+ '--enable-static', 32+ '--disable-shared', 33 '--disable-install-doc', 34+ '--without-gmp', 35 '--with-ext=' 36 ] 37 38@@ -151,6 +153,7 @@ 39 # make 40 file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t| 41 chdir File.dirname(t.prerequisites.first) do 42+ sh "test -s verconf.h || rm -f verconf.h" # if verconf.h has size 0, make sure it gets re-built by make 43 sh MAKE 44 end 45 end 46EOF 47 48MAKE="make -j8" 49 50for v in 2.6.0 2.5.1 2.4.0 2.3.0 ; do 51 ccache -c 52 rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE" 53done 54 55sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY" 56mv "$CROSS_RUBY" ~/.rake-compiler/config.yml 57 58