From 2bc107f74c477c1127a316df6f62cc75e59b8674 Mon Sep 17 00:00:00 2001
From: Nicolas Noble <nicolas@nobis-crew.org>
Date: Tue, 2 Feb 2016 23:15:22 -0800
Subject: [PATCH] Making the ruby gem for MacOS work again.

---
 src/ruby/ext/grpc/extconf.rb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb
index f6f78f7810..426a6e67a0 100644
--- a/src/ruby/ext/grpc/extconf.rb
+++ b/src/ruby/ext/grpc/extconf.rb
@@ -67,14 +67,15 @@ else
 end
 
 unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) or windows
-  for var in %w( CC AR ) do
-    ENV[var] = RbConfig::CONFIG[var]
-  end
-
+  ENV['AR'] = RbConfig::CONFIG['AR'] + ' rcs'
+  ENV['CC'] = RbConfig::CONFIG['CC']
   ENV['LD'] = ENV['CC']
 
+  ENV['AR'] = 'libtool -o' if RUBY_PLATFORM =~ /darwin/
+
   ENV['EMBED_OPENSSL'] = 'true'
   ENV['EMBED_ZLIB'] = 'true'
+  ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/
 
   output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
   grpc_lib_dir = File.join(output_dir, 'libs', grpc_config)
@@ -107,6 +108,7 @@ puts 'Generating Makefile for ' + output
 create_makefile(output)
 
 strip_tool = RbConfig::CONFIG['STRIP']
+strip_tool = 'strip -x' if RUBY_PLATFORM =~ /darwin/
 
 if grpc_config == 'opt'
   File.open('Makefile.new', 'w') do |o|
-- 
GitLab