blob: 9e3e3b46f80551d4ed22ee1324aec130c602259b [file] [log] [blame]
Nicolas Noble524d7ed2016-02-05 16:35:48 -08001#!/bin/bash
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002# Copyright 2015 gRPC authors.
Nicolas Noble524d7ed2016-02-05 16:35:48 -08003#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004# 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 Noble524d7ed2016-02-05 16:35:48 -08007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Nicolas Noble524d7ed2016-02-05 16:35:48 -08009#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010# 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 Noble524d7ed2016-02-05 16:35:48 -080015
16set -ex
17
Nicolas "Pixel" Nobleff2e76e2016-02-06 03:36:18 +010018rm -rf ~/.rake-compiler
19
Mehrdad Afshari8f32e722018-01-11 18:26:50 -080020CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX)
Nicolas Noble524d7ed2016-02-05 16:35:48 -080021
Mehrdad Afshari8f32e722018-01-11 18:26:50 -080022curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY"
Nicolas Noble524d7ed2016-02-05 16:35:48 -080023
Jan Tattermusch4c64dc92017-09-27 16:53:47 +020024# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details
Mehrdad Afshari8f32e722018-01-11 18:26:50 -080025patch "$CROSS_RUBY" << EOF
Alex Polcyndb647e22018-04-10 11:42:04 -070026--- 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 Noble524d7ed2016-02-05 16:35:48 -080029 "--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 Polcyndb647e22018-04-10 11:42:04 -070036+ '--without-gmp',
Jan Tattermusch4c64dc92017-09-27 16:53:47 +020037 '--with-ext='
38 ]
Alex Polcyndb647e22018-04-10 11:42:04 -070039
40@@ -151,6 +153,7 @@
Jan Tattermusch4c64dc92017-09-27 16:53:47 +020041 # 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 Noble524d7ed2016-02-05 16:35:48 -080048EOF
49
50MAKE="make -j8"
51
Alexander Polcyn522df162018-01-05 10:33:57 -080052for v in 2.5.0 2.4.0 2.3.0 2.2.2 2.1.6 2.0.0-p645 ; do
Alexander Polcynd490a9e2017-02-08 19:31:45 -080053 ccache -c
Mehrdad Afshari8f32e722018-01-11 18:26:50 -080054 rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
Nicolas Noble524d7ed2016-02-05 16:35:48 -080055done
56
Mehrdad Afshari8f32e722018-01-11 18:26:50 -080057sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY"
58mv "$CROSS_RUBY" ~/.rake-compiler/config.yml
59