Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 1 | #!/bin/bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 3 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 9 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 15 | |
| 16 | set -ex |
| 17 | |
Nicolas "Pixel" Noble | ff2e76e | 2016-02-06 03:36:18 +0100 | [diff] [blame] | 18 | rm -rf ~/.rake-compiler |
| 19 | |
Mehrdad Afshari | 8f32e72 | 2018-01-11 18:26:50 -0800 | [diff] [blame] | 20 | CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX) |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 21 | |
Mehrdad Afshari | 8f32e72 | 2018-01-11 18:26:50 -0800 | [diff] [blame] | 22 | curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY" |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 23 | |
Jan Tattermusch | 4c64dc9 | 2017-09-27 16:53:47 +0200 | [diff] [blame] | 24 | # See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details |
Mehrdad Afshari | 8f32e72 | 2018-01-11 18:26:50 -0800 | [diff] [blame] | 25 | patch "$CROSS_RUBY" << EOF |
Alex Polcyn | db647e2 | 2018-04-10 11:42:04 -0700 | [diff] [blame] | 26 | --- cross-ruby.rake 2018-04-10 11:32:16.000000000 -0700 |
| 27 | +++ patched 2018-04-10 11:40:25.000000000 -0700 |
| 28 | @@ -133,8 +133,10 @@ |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 29 | "--host=#{MINGW_HOST}", |
| 30 | "--target=#{MINGW_TARGET}", |
| 31 | "--build=#{RUBY_BUILD}", |
| 32 | - '--enable-shared', |
| 33 | + '--enable-static', |
| 34 | + '--disable-shared', |
| 35 | '--disable-install-doc', |
Alex Polcyn | db647e2 | 2018-04-10 11:42:04 -0700 | [diff] [blame] | 36 | + '--without-gmp', |
Jan Tattermusch | 4c64dc9 | 2017-09-27 16:53:47 +0200 | [diff] [blame] | 37 | '--with-ext=' |
| 38 | ] |
Alex Polcyn | db647e2 | 2018-04-10 11:42:04 -0700 | [diff] [blame] | 39 | |
| 40 | @@ -151,6 +153,7 @@ |
Jan Tattermusch | 4c64dc9 | 2017-09-27 16:53:47 +0200 | [diff] [blame] | 41 | # make |
| 42 | file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t| |
| 43 | chdir File.dirname(t.prerequisites.first) do |
| 44 | + sh "test -s verconf.h || rm -f verconf.h" # if verconf.h has size 0, make sure it gets re-built by make |
| 45 | sh MAKE |
| 46 | end |
| 47 | end |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 48 | EOF |
| 49 | |
| 50 | MAKE="make -j8" |
| 51 | |
Alexander Polcyn | 522df16 | 2018-01-05 10:33:57 -0800 | [diff] [blame] | 52 | for v in 2.5.0 2.4.0 2.3.0 2.2.2 2.1.6 2.0.0-p645 ; do |
Alexander Polcyn | d490a9e | 2017-02-08 19:31:45 -0800 | [diff] [blame] | 53 | ccache -c |
Mehrdad Afshari | 8f32e72 | 2018-01-11 18:26:50 -0800 | [diff] [blame] | 54 | rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE" |
Nicolas Noble | 524d7ed | 2016-02-05 16:35:48 -0800 | [diff] [blame] | 55 | done |
| 56 | |
Mehrdad Afshari | 8f32e72 | 2018-01-11 18:26:50 -0800 | [diff] [blame] | 57 | sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY" |
| 58 | mv "$CROSS_RUBY" ~/.rake-compiler/config.yml |
| 59 | |