ruby_build_environment.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. set -ex
  3. set +ex # rvm script is very verbose and exits with errorcode
  4. source $HOME/.rvm/scripts/rvm
  5. set -e # rvm commands are very verbose
  6. time rvm install 2.5.0
  7. rvm use 2.5.0 --default
  8. gem install rake-compiler --no-ri --no-doc
  9. gem install bundler --no-ri --no-doc
  10. rvm osx-ssl-certs status all
  11. rvm osx-ssl-certs update all
  12. set -ex
  13. rm -rf ~/.rake-compiler
  14. CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX)
  15. curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY"
  16. # See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details
  17. patch "$CROSS_RUBY" << EOF
  18. --- cross-ruby.rake 2018-04-10 11:32:16.000000000 -0700
  19. +++ patched 2018-04-10 11:40:25.000000000 -0700
  20. @@ -133,8 +133,10 @@
  21. "--host=#{MINGW_HOST}",
  22. "--target=#{MINGW_TARGET}",
  23. "--build=#{RUBY_BUILD}",
  24. - '--enable-shared',
  25. + '--enable-static',
  26. + '--disable-shared',
  27. '--disable-install-doc',
  28. + '--without-gmp',
  29. '--with-ext='
  30. ]
  31. @@ -151,6 +153,7 @@
  32. # make
  33. file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t|
  34. chdir File.dirname(t.prerequisites.first) do
  35. + sh "test -s verconf.h || rm -f verconf.h" # if verconf.h has size 0, make sure it gets re-built by make
  36. sh MAKE
  37. end
  38. end
  39. EOF
  40. MAKE="make -j8"
  41. for v in 2.5.0 2.4.0 2.3.0 2.2.2 2.1.6 2.0.0-p645 ; do
  42. ccache -c
  43. rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
  44. done
  45. sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY"
  46. mv "$CROSS_RUBY" ~/.rake-compiler/config.yml