Skip to content

Commit

Permalink
Fixing Mac build for Ruby.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble committed Feb 5, 2016
1 parent 5219c6d commit 86cbe30
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
18 changes: 10 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require 'rake/extensiontask'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'bundler/gem_tasks'
require 'fileutils'

load 'tools/distrib/docker_for_windows.rb'

Expand All @@ -26,11 +27,7 @@ Rake::ExtensionTask.new('grpc_c', spec) do |ext|
ext.cross_platform = [
'x86-mingw32', 'x64-mingw32',
'x86_64-linux', 'x86-linux',
'x86_64-darwin-11',
'x86_64-darwin-12',
'x86_64-darwin-13',
'x86_64-darwin-14',
'x86_64-darwin-15'
'universal-darwin'
]
ext.cross_compiling do |spec|
spec.files = %w( etc/roots.pem grpc_c.32.ruby grpc_c.64.ruby )
Expand Down Expand Up @@ -103,7 +100,14 @@ desc 'Build the native gem file under rake_compiler_dock'
task 'gem:native' do
verbose = ENV['V'] || '0'

docker_for_windows "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose}"
if RUBY_PLATFORM =~ /darwin/
FileUtils.touch 'grpc_c.32.ruby'
FileUtils.touch 'grpc_c.64.ruby'
system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose}"
else
Rake::Task['dlls'].execute
docker_for_windows "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose}"
end
end

# Define dependencies between the suites.
Expand All @@ -113,8 +117,6 @@ task 'suite:bidi' => 'suite:wrapper'
task 'suite:server' => 'suite:wrapper'
task 'suite:pb' => 'suite:server'

task 'gem:native' => 'dlls'

desc 'Compiles the gRPC extension then runs all the tests'
task all: ['suite:idiomatic', 'suite:bidi', 'suite:pb', 'suite:server']
task default: :all
2 changes: 2 additions & 0 deletions src/ruby/ext/grpc/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
grpc_lib_dir = File.join(grpc_root, 'libs', grpc_config)
end

ENV['MACOSX_DEPLOYMENT_TARGET'] = '10.7'

unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) or windows
ENV['AR'] = RbConfig::CONFIG['AR'] + ' rcs'
ENV['CC'] = RbConfig::CONFIG['CC']
Expand Down
2 changes: 1 addition & 1 deletion src/ruby/ext/grpc/rb_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self,
}
grpc_channel_watch_connectivity_state(
ch,
NUM2LONG(last_state),
(grpc_connectivity_state)NUM2LONG(last_state),
grpc_rb_time_timeval(deadline, /* absolute time */ 0),
cq,
ROBJECT(tag));
Expand Down
2 changes: 1 addition & 1 deletion src/ruby/ext/grpc/rb_server_credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs,
VALUE key = Qnil;
VALUE key_cert = Qnil;
int auth_client = 0;
int num_key_certs = 0;
long num_key_certs = 0;
int i;

if (NIL_P(force_client_auth) ||
Expand Down

0 comments on commit 86cbe30

Please sign in to comment.