diff --git a/Rakefile b/Rakefile index 3a30920feaed3..704069694773a 100755 --- a/Rakefile +++ b/Rakefile @@ -23,7 +23,15 @@ Rake::ExtensionTask.new('grpc_c', spec) do |ext| ext.ext_dir = File.join('src', 'ruby', 'ext', 'grpc') ext.lib_dir = File.join('src', 'ruby', 'lib', 'grpc') ext.cross_compile = true - ext.cross_platform = ['x86-mingw32', 'x64-mingw32'] + 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' + ] ext.cross_compiling do |spec| spec.files = %w( etc/roots.pem grpc_c.32.ruby grpc_c.64.ruby ) spec.files += Dir.glob('src/ruby/bin/**/*') @@ -91,8 +99,8 @@ task 'dlls' do end -desc 'Build the gem file under rake_compiler_dock' -task 'gem:windows' do +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}" @@ -105,7 +113,7 @@ task 'suite:bidi' => 'suite:wrapper' task 'suite:server' => 'suite:wrapper' task 'suite:pb' => 'suite:server' -task 'gem:windows' => 'dlls' +task 'gem:native' => 'dlls' desc 'Compiles the gRPC extension then runs all the tests' task all: ['suite:idiomatic', 'suite:bidi', 'suite:pb', 'suite:server'] diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 426a6e67a0892..503403392da3c 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -75,6 +75,7 @@ ENV['EMBED_OPENSSL'] = 'true' ENV['EMBED_ZLIB'] = 'true' + ENV['ARCH_FLAGS'] = RbConfig::CONFIG['ARCH_FLAG'] ENV['ARCH_FLAGS'] = '-arch i386 -arch x86_64' if RUBY_PLATFORM =~ /darwin/ output_dir = File.expand_path(RbConfig::CONFIG['topdir']) diff --git a/third_party/rake-compiler-dock/Dockerfile b/third_party/rake-compiler-dock/Dockerfile index 28623c30280a2..be73e2d8f4966 100644 --- a/third_party/rake-compiler-dock/Dockerfile +++ b/third_party/rake-compiler-dock/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:14.04 RUN apt-get -y update && \ - apt-get install -y curl git-core mingw-w64 xz-utils build-essential wget unzip + apt-get install -y curl git-core mingw-w64 xz-utils build-essential gcc-multilib wget unzip RUN mkdir -p /opt/mingw && \ curl -SL http://downloads.sourceforge.net/mingw-w64/i686-w64-mingw32-gcc-4.7.2-release-linux64_rubenvb.tar.xz | \ @@ -103,12 +103,25 @@ RUN bash -c "rvm use 2.3.0 --default && \ export MAKE=\"make -j`nproc`\" CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \ rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-w64-mingw32 && \ rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-w64-mingw32 && \ + rake-compiler cross-ruby VERSION=2.3.0 HOST=x86_64-linux-gnu && \ rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-w64-mingw32 && \ rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-w64-mingw32 && \ + rake-compiler cross-ruby VERSION=2.2.2 HOST=x86_64-linux-gnu && \ rake-compiler cross-ruby VERSION=2.1.6 HOST=i686-w64-mingw32 && \ rake-compiler cross-ruby VERSION=2.1.6 HOST=x86_64-w64-mingw32 && \ + rake-compiler cross-ruby VERSION=2.1.6 HOST=x86_64-linux-gnu && \ rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-w64-mingw32 && \ rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-w64-mingw32 && \ + rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=x86_64-linux-gnu && \ + rm -rf ~/.rake-compiler/tmp/builds ~/.rake-compiler/sources && \ + find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw " + +RUN bash -c "rvm use 2.3.0 --default && \ + export MAKE=\"make -j`nproc`\" CFLAGS='-m32 -s -O1 -fno-omit-frame-pointer -fno-fast-math' LDFLAGS='-m32' && \ + rake-compiler cross-ruby VERSION=2.3.0 HOST=i686-linux-gnu && \ + rake-compiler cross-ruby VERSION=2.2.2 HOST=i686-linux-gnu && \ + rake-compiler cross-ruby VERSION=2.1.6 HOST=i686-linux-gnu && \ + rake-compiler cross-ruby VERSION=2.0.0-p645 HOST=i686-linux-gnu && \ rm -rf ~/.rake-compiler/tmp/builds ~/.rake-compiler/sources && \ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "