diff options
author | Michael Lumish <mlumish@google.com> | 2015-06-04 10:33:33 -0700 |
---|---|---|
committer | Michael Lumish <mlumish@google.com> | 2015-06-04 10:33:33 -0700 |
commit | 1b13c549c1fd8d5b9c80686e347f4e9b7584d62c (patch) | |
tree | 23dc0cea5f657b4c0f7c32b7e488d468e97d6b04 | |
parent | 491a67bc473655a960aed482787b1bcc2a773bba (diff) | |
parent | 1a2988df2b300f25fb0924b0f405c97dd89d1bc8 (diff) |
Merge pull request #1910 from tbetbetbe/grpc-ruby-fix-extconf-rb
Grpc ruby fix extconf rb
-rw-r--r-- | src/ruby/ext/grpc/extconf.rb | 47 | ||||
-rwxr-xr-x | src/ruby/grpc.gemspec | 2 | ||||
-rw-r--r-- | src/ruby/lib/grpc/version.rb | 2 |
3 files changed, 21 insertions, 30 deletions
diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 1b801edc8e..0ff8bb9aa7 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -32,29 +32,6 @@ require 'mkmf' LIBDIR = RbConfig::CONFIG['libdir'] INCLUDEDIR = RbConfig::CONFIG['includedir'] -if ENV.key? 'GRPC_ROOT' - GRPC_ROOT = ENV['GRPC_ROOT'] -else - grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - if File.exist?(File.join(grpc_root, 'include/grpc/grpc.h')) - GRPC_ROOT = grpc_root - else - GRPC_ROOT = nil - end -end - -if ENV.key? 'CONFIG' - GRPC_CONFIG = ENV['CONFIG'] -else - GRPC_CONFIG = 'opt' -end - -if (ENV.key? 'GRPC_LIB_DIR') && (!GRPC_ROOT.nil?) - GRPC_LIB_DIR = File.join(GRPC_ROOT, ENV['GRPC_LIB_DIR']) -else - GRPC_LIB_DIR = File.join(File.join(GRPC_ROOT, 'libs'), GRPC_CONFIG) -end - HEADER_DIRS = [ # Search /opt/local (Mac source install) '/opt/local/include', @@ -77,12 +54,26 @@ LIB_DIRS = [ LIBDIR ] -unless GRPC_ROOT.nil? - HEADER_DIRS.unshift File.join(GRPC_ROOT, 'include') - LIB_DIRS.unshift GRPC_LIB_DIR - unless File.exist?(File.join(GRPC_LIB_DIR, 'libgrpc.a')) - system("make -C #{GRPC_ROOT} static_c CONFIG=#{GRPC_CONFIG}") +# Check to see if GRPC_ROOT is defined or available +grpc_root = ENV['GRPC_ROOT'] +if grpc_root.nil? + r = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + grpc_root = r if File.exist?(File.join(r, 'include/grpc/grpc.h')) +end + +# When grpc_root is available attempt to build the grpc core. +unless grpc_root.nil? + grpc_config = ENV['GRPC_CONFIG'] || 'opt' + if ENV.key?('GRPC_LIB_DIR') + grpc_lib_dir = File.join(grpc_root, ENV['GRPC_LIB_DIR']) + else + grpc_lib_dir = File.join(File.join(grpc_root, 'libs'), grpc_config) + end + unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) + system("make -C #{grpc_root} static_c CONFIG=#{grpc_config}") end + HEADER_DIRS.unshift File.join(grpc_root, 'include') + LIB_DIRS.unshift grpc_lib_dir end def crash(msg) diff --git a/src/ruby/grpc.gemspec b/src/ruby/grpc.gemspec index 3ddb7fac18..319da9470a 100755 --- a/src/ruby/grpc.gemspec +++ b/src/ruby/grpc.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.license = 'BSD-3-Clause' s.required_ruby_version = '>= 2.0.0' - s.requirements << 'libgrpc ~> 0.6.0 needs to be installed' + s.requirements << 'libgrpc ~> 0.9.1 needs to be installed' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 8588bfd808..53265c792c 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '0.9.2' + VERSION = '0.9.3' end |