• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2015 gRPC authors.
3#
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
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
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.
15
16set -ex
17
18rm -rf ~/.rake-compiler
19
20CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX)
21
22curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY"
23
24# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details
25patch "$CROSS_RUBY" << EOF
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 @@
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',
36+    '--without-gmp',
37     '--with-ext='
38   ]
39 
40@@ -151,6 +153,7 @@
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
48EOF
49
50MAKE="make -j8"
51
52for v in 2.5.0 2.4.0 2.3.0 2.2.2 2.1.6 2.0.0-p645 ; do
53  ccache -c
54  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
55done
56
57sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY"
58mv "$CROSS_RUBY" ~/.rake-compiler/config.yml
59
60