ruby_build_environment.sh 1.9 KB

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