ext/grpc/extconf.rb in grpc-0.5.0 vs ext/grpc/extconf.rb in grpc-0.6.0

- old
+ new

@@ -30,10 +30,21 @@ require 'mkmf' LIBDIR = RbConfig::CONFIG['libdir'] INCLUDEDIR = RbConfig::CONFIG['includedir'] +if ENV.key? 'GRPC_ROOT' + GRPC_ROOT = ENV['GRPC_ROOT'] + if ENV.key? 'GRPC_LIB_DIR' + GRPC_LIB_DIR = ENV['GRPC_LIB_DIR'] + else + GRPC_LIB_DIR = 'libs/opt' + end +else + GRPC_ROOT = nil +end + HEADER_DIRS = [ # Search /opt/local (Mac source install) '/opt/local/include', # Search /usr/local (Source install) @@ -52,17 +63,21 @@ # Check the ruby install locations LIBDIR ] +unless GRPC_ROOT.nil? + HEADER_DIRS.unshift File.join(GRPC_ROOT, 'include') + LIB_DIRS.unshift File.join(GRPC_ROOT, GRPC_LIB_DIR) +end + def crash(msg) print(" extconf failure: #{msg}\n") exit 1 end dir_config('grpc', HEADER_DIRS, LIB_DIRS) -$CFLAGS << ' -std=c89 ' $CFLAGS << ' -Wno-implicit-function-declaration ' $CFLAGS << ' -Wno-pointer-sign ' $CFLAGS << ' -Wno-return-type ' $CFLAGS << ' -Wall ' $CFLAGS << ' -pedantic '