Use rake-compiler-dock's Dockerfile as a base in grpc's fork of it

pull/13910/head
Alexander Polcyn 7 years ago
parent 2b0ab320c1
commit 8065a5e73c
  1. 4
      Rakefile
  2. 200
      third_party/rake-compiler-dock/Dockerfile
  3. 7
      third_party/rake-compiler-dock/build.sh
  4. 105
      third_party/rake-compiler-dock/build/patches/rake-compiler-0.9.5/compat-with-bundler.diff
  5. 14
      third_party/rake-compiler-dock/build/patches/rake-compiler-0.9.5/without-exts.diff
  6. 2
      third_party/rake-compiler-dock/build/patches/ruby-1.8.7-p374/nop.patch
  7. 13
      third_party/rake-compiler-dock/build/patches/ruby-1.9.3/no_sendfile.patch
  8. 2
      third_party/rake-compiler-dock/build/patches/ruby-1.9.3/nop.patch
  9. 12
      third_party/rake-compiler-dock/build/patches/ruby-2.3.0/no_sendfile.patch
  10. 12
      third_party/rake-compiler-dock/build/patches/ruby-2.4.0/no_sendfile.patch
  11. 12
      third_party/rake-compiler-dock/build/runas
  12. 43
      third_party/rake-compiler-dock/build/sigfw.c
  13. 30
      third_party/rake-compiler-dock/build/strip_wrapper
  14. 1
      third_party/rake-compiler-dock/build/sudoers

@ -113,10 +113,10 @@ task 'gem:native' do
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.4.0:2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
system "rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
else
Rake::Task['dlls'].execute
docker_for_windows "gem update --system && bundle && rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
docker_for_windows "gem update --system && bundle && rake cross native gem RUBY_CC_VERSION=2.5.0:2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
end
end

@ -1,182 +1,4 @@
FROM ubuntu:17.04
RUN apt-get -y update && \
apt-get install -y curl git-core xz-utils build-essential wget unzip sudo gpg dirmngr
# Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \
echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc
USER root
RUN apt-get -y update && \
apt-get install -y gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-x86-64 g++-mingw-w64-i686 \
gcc-multilib moreutils
USER rvm
# install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3 && \
(curl -L http://get.rvm.io | sudo bash -s stable) && \
bash -c " \
source /etc/rubybashrc && \
rvmsudo rvm cleanup all "
# Regenerate the following using build.sh if the build folder changes.
RUN echo \\
H4sIANslcFgAA+08a3fbxo75uvwVqOxTSbFIidTDVhKnTW0n8d28ju2ku6fO5R2RQ4kVRXJnSMve\
OPe3LzAk9fIrvk3UuylxUnk0DwADYDADzKiD1A/c5oNvCi2E7W7rgdlpdbe3Tfxumj2zpepzeGC2\
W+1Oy7TaZvcBNpvYHbrflq0MUpkwAfCAxVHgXIQ39uPhcB3srBsGSv8ydSMu5DeiQQrudW7Wv9Xq\
rejf6nZ7D6D1jfhZgr+4/ve5x9IgkZADD8/sMecxbO1CZZQksR2L6PwCqCjzsjerPdrbt1++PT6x\
j97/8t/2u1fPTp6/PXq9Uv3h4Oj48O0bVXv4+tmLA1DVe3tFS0X7s6Xw14Vs/Ys0ZN9q9d/t/zsd\
c3X9W1a3XP/rgI0fmgM/bA6YHGnaUERpzFwX9CFUNl8c7lfoz9Hb9+8q2mTs+gL0GJrJJG6OognX\
UsnFcm89xdJ7VXoB4mzSoI2FBlWwZjAfCvqEOh4fHFU07eXb1we7mzViAZ48eQIV7owi+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+d/XNnXt+u/8Wf7fsjC4zPI/5fvf\
tcCN+v9T/L9lYQfl/ztl/mctUPr/0v+7TZkIP7angsUxF1+dxh3+3zTN7ZXzX3sb3UC5/tcAGz+o\
/7MG3bxRMoM2AE3bgGMyiOyeLQrVm6YAvChw1cN2mVAiQT0m/uALejw9iM4huxbLeyGKJFKv64Gp\
9AouQF/CIB3OXxpMp1PjbDbeiMSwmfjOmCfNHdwRNG32ZiDhk5hYqc6r6Gua+IGsapoyXlzolY1P\
6qXHgOHyZxNe22zVPxs4s4qmqYfL2OfZ0YsPhuD00ODTpXcJ3u4/m3/Xm/DZmLBYvQhhYkhP1+hZ\
8y6c5JQN+qV7VRGqZo2GE0SSa9njkvfEieHE9Av8hmqlFynY+BuWG1T7UaNHIFr+dLRgJEsqLTMC\
W/kra2To02XSiC7pFRiig8+alobYIikNhjKpgWKoAQ8LtPT2hp+jKzetbUXQiVyOxDZ/Mqg6+6V5\
LgyDM2eUPZUhHiPhq3nPpyMmqnJ1isXssiHZtBRNovV9+cYSSiihhBJKKKGEEkoooYQSSiihhBJK\
KKGEEkoooYQSSiihhBJKKKGEEkoooYQSSiihhH9H+D9i0BbqAHgAAA==\
| base64 -d | tar xzC /tmp
# Import patch files for ruby and gems
RUN cp -r /tmp/build/patches /home/rvm/patches/
ENV BASH_ENV /etc/rubybashrc
# install rubies and fix permissions on
RUN bash -c " \
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
echo 'about to install patches for ruby 2.4.0 from:' && \
ls -r ~/patches && \
for v in 2.4.0 ; do \
rvm install \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
done && \
rvm cleanup all && \
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
# Install rake-compiler and typical gems in all Rubies
# do not generate documentation for gems
RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
bash -c " \
rvm all do gem install bundler rake-compiler hoe mini_portile rubygems-tasks && \
rvm 2.4.0 do gem install mini_portile2 && \
find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
RUN bash -c "gem env"
RUN bash -c "gem list rake-compiler"
# Install rake-compiler's cross rubies in global dir instead of /root
RUN sudo mkdir -p /usr/local/rake-compiler && \
sudo chown rvm.rvm /usr/local/rake-compiler && \
ln -s /usr/local/rake-compiler ~/.rake-compiler
# Patch rake-compiler to avoid build of ruby extensions
RUN cd /usr/local/rvm/gems/ruby-2.4.0/gems/rake-compiler-0.9.5 && git apply /home/rvm/patches/rake-compiler-0.9.5/*.diff ; \
true
RUN bash -c "rvm use 2.4.0 --default && \
export MAKE=\"make -j`nproc`\" CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
rake-compiler cross-ruby VERSION=2.4.0 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.4.0 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.4.0 HOST=x86_64-linux-gnu && \
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.5 HOST=i686-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.1.5 HOST=x86_64-w64-mingw32 && \
rake-compiler cross-ruby VERSION=2.1.5 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.4.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.4.0 HOST=i686-linux-gnu && \
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.5 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 "
RUN bash -c " \
rvm alias create 2.4 2.4.0 "
USER root
# Fix paths in rake-compiler/config.yml and add rvm and mingw-tools to the global bashrc
RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml && \
echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc && \
echo "export PATH=\$PATH:/opt/mingw/mingw32/bin" >> /etc/bash.bashrc && \
echo "export PATH=\$PATH:/opt/mingw/mingw64/bin" >> /etc/bash.bashrc
# Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
RUN cp /tmp/build/strip_wrapper /root/
RUN sudo chmod +rx /root/strip_wrapper
RUN mv /usr/bin/i686-w64-mingw32-strip /usr/bin/i686-w64-mingw32-strip.bin && \
mv /usr/bin/x86_64-w64-mingw32-strip /usr/bin/x86_64-w64-mingw32-strip.bin && \
ln /root/strip_wrapper /usr/bin/i686-w64-mingw32-strip && \
ln /root/strip_wrapper /usr/bin/x86_64-w64-mingw32-strip
FROM larskanis/rake-compiler-dock:0.6.2
RUN find / -name rbconfig.rb | while read f ; do sed -i 's/0x0501/0x0600/' $f ; done
RUN find / -name win32.h | while read f ; do sed -i 's/gettimeofday/rb_gettimeofday/' $f ; done
@ -184,26 +6,6 @@ RUN sed -i 's/defined.__MINGW64__.$/1/' /usr/local/rake-compiler/ruby/i686-w64-m
RUN find / -name libwinpthread.dll.a | xargs rm
RUN find / -name libwinpthread-1.dll | xargs rm
RUN find / -name *msvcrt-ruby*.dll.a | while read f ; do n=`echo $f | sed s/.dll//` ; mv $f $n ; done
RUN find /usr/local/rake-compiler/ruby -name libruby.so | xargs rm
RUN find /usr/local/rake-compiler/ruby -name libruby-static.a | while read f ; do ar t $f | xargs ar d $f ; done
RUN find /usr/local/rake-compiler/ruby -name libruby-static.a | while read f ; do mv $f `echo $f | sed s/-static//` ; done
# Install SIGINT forwarder
RUN cp /tmp/build/sigfw.c /root/
RUN gcc $HOME/sigfw.c -o /usr/local/bin/sigfw
# Install user mapper
RUN cp /tmp/build/runas /usr/local/bin/
# Install sudoers configuration
RUN cp /tmp/build/sudoers /etc/sudoers.d/rake-compiler-dock
# Fixup Ruby 2.4 'static' compilation issue.
RUN echo '!<arch>' > /usr/local/rake-compiler/ruby/x86_64-linux-gnu/ruby-2.4.0/lib/libruby.a
RUN echo '!<arch>' > /usr/local/rake-compiler/ruby/i686-linux-gnu/ruby-2.4.0/lib/libruby.a
ENV RUBY_CC_VERSION 2.4.0:2.3.0:2.2.2:2.1.5:2.0.0
RUN apt-get install -y g++-multilib
CMD bash

@ -1,7 +0,0 @@
#!/bin/sh
# Run this to produce the snipplet of data to insert in the Dockerfile.
echo 'RUN echo \\'
tar cz build | base64 | sed 's/$/\\/'
echo '| base64 -d | tar xzC /tmp'

@ -1,105 +0,0 @@
From 41f834449fc4323b2f995e8715aa5842d9fd9334 Mon Sep 17 00:00:00 2001
From: Lars Kanis <lars@greiz-reinsdorf.de>
Date: Sat, 30 Jan 2016 08:08:07 +0100
Subject: [PATCH] Change the fake mechanism to be compatible with bundler.
The previous fake mechanism worked by hooking onto the
"require 'rbconfig'" call.
This is problematic because bundler internally requires rbconfig, but doesn't
work corretly in a faked environment.
It then fails to load gems that are also part of the standard library, like
json and rdoc.
This results in issues like https://github.com/rake-compiler/rake-compiler-dock/issues/8
The fake mechanism is now changed to hook onto the "require 'mkrb'" call,
which is typically part of the extconf file, and it is where the faked platform
values are actually needed.
That way it is loaded after bundler/setup, so that the library paths are
set according to the Gemfile.lock, to the native Linux libraries, before
the fake environment is active.
Please note, that the build directory of a given gem needs to be cleared,
in order to get updated fake files. So do a "rm tmp pkg -rf".
---
lib/rake/extensiontask.rb | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb
index 030af96..f914919 100644
--- a/lib/rake/extensiontask.rb
+++ b/lib/rake/extensiontask.rb
@@ -169,8 +169,8 @@ Java extension should be preferred.
# now add the extconf script
cmd << abs_extconf.relative_path_from(abs_tmp_path)
- # rbconfig.rb will be present if we are cross compiling
- if t.prerequisites.include?("#{tmp_path}/rbconfig.rb") then
+ # fake.rb will be present if we are cross compiling
+ if t.prerequisites.include?("#{tmp_path}/fake.rb") then
options.push(*cross_config_options(platf))
end
@@ -365,39 +365,30 @@ Java extension should be preferred.
# define compilation tasks for cross platform!
define_compile_tasks(for_platform, ruby_ver)
- # chain fake.rb, rbconfig.rb and mkmf.rb to Makefile generation
+ # chain fake.rb and mkmf.rb to Makefile generation
file "#{tmp_path}/Makefile" => ["#{tmp_path}/fake.rb",
- "#{tmp_path}/rbconfig.rb",
"#{tmp_path}/mkmf.rb"]
- # copy the file from the cross-ruby location
- file "#{tmp_path}/rbconfig.rb" => [rbconfig_file] do |t|
+ # copy the rbconfig from the cross-ruby location and
+ # genearte fake.rb for different ruby versions
+ file "#{tmp_path}/fake.rb" => [rbconfig_file] do |t|
File.open(t.name, 'w') do |f|
- f.write "require 'fake.rb'\n\n"
+ f.write fake_rb(for_platform, ruby_ver)
f.write File.read(t.prerequisites.first)
end
end
# copy mkmf from cross-ruby location
file "#{tmp_path}/mkmf.rb" => [mkmf_file] do |t|
- cp t.prerequisites.first, t.name
- if ruby_ver < "1.9" && "1.9" <= RUBY_VERSION
- File.open(t.name, 'r+t') do |f|
- content = f.read
+ File.open(t.name, 'w') do |f|
+ content = File.read(t.prerequisites.first)
+ content.sub!(/^(require ')rbconfig(')$/, '\\1fake\\2')
+ if ruby_ver < "1.9" && "1.9" <= RUBY_VERSION
content.sub!(/^( break )\*(defaults)$/, '\\1\\2.first')
content.sub!(/^( return )\*(defaults)$/, '\\1\\2.first')
content.sub!(/^( mfile\.)print( configuration\(srcprefix\))$/, '\\1puts\\2')
- f.rewind
- f.write content
- f.truncate(f.tell)
end
- end
- end
-
- # genearte fake.rb for different ruby versions
- file "#{tmp_path}/fake.rb" do |t|
- File.open(t.name, 'w') do |f|
- f.write fake_rb(for_platform, ruby_ver)
+ f.write content
end
end
@@ -495,8 +486,10 @@ Java extension should be preferred.
# "cannot load such file -- win32/resolv" when it is required later on.
# See also: https://github.com/tjschuck/rake-compiler-dev-box/issues/5
require 'resolv'
+ require 'rbconfig'
class Object
+ remove_const :RbConfig
remove_const :RUBY_PLATFORM
remove_const :RUBY_VERSION
remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
--
2.5.0.windows.1

@ -1,14 +0,0 @@
diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
index 6acc816..6aa2a49 100644
--- a/tasks/bin/cross-ruby.rake
+++ b/tasks/bin/cross-ruby.rake
@@ -135,8 +135,7 @@ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER
"--build=#{RUBY_BUILD}",
'--enable-shared',
'--disable-install-doc',
- '--without-tk',
- '--without-tcl'
+ '--with-ext='
]
# Force Winsock2 for Ruby 1.8, 1.9 defaults to it

@ -1,2 +0,0 @@
diff --git a/configure b/configure
index 55157af..6630eba 100755

@ -1,13 +0,0 @@
diff --git a/configure b/configure
index 898730c..cfe6253 100755
--- a/configure
+++ b/configure
@@ -14695,7 +14695,7 @@ for ac_func in fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot ge
setsid telldir seekdir fchmod cosh sinh tanh log2 round\
setuid setgid daemon select_large_fdset setenv unsetenv\
mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
- pread sendfile shutdown sigaltstack dl_iterate_phdr
+ pread shutdown sigaltstack dl_iterate_phdr
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

@ -1,2 +0,0 @@
diff --git a/configure b/configure
index 55157af..6630eba 100755

@ -1,12 +0,0 @@
diff --git a/configure b/configure
index ebe3d8c..a336b73 100755
--- a/configure
+++ b/configure
@@ -18943,7 +18943,6 @@ do :
ac_fn_c_check_func "$LINENO" "sendfile" "ac_cv_func_sendfile"
if test "x$ac_cv_func_sendfile" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_SENDFILE 1
_ACEOF
fi

@ -1,12 +0,0 @@
diff --git a/configure b/configure
index ebe3d8c..a336b73 100755
--- a/configure
+++ b/configure
@@ -18943,7 +18943,6 @@ do :
ac_fn_c_check_func "$LINENO" "sendfile" "ac_cv_func_sendfile"
if test "x$ac_cv_func_sendfile" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_SENDFILE 1
_ACEOF
fi

@ -1,12 +0,0 @@
#!/bin/bash
groupadd -g "$GID" "$GROUP"
mkdir -p /tmp/home
useradd -g "$GID" -u "$UID" -G rvm,sudo -p "" -b /tmp/home -m "$USER"
HOME=$(bash <<< "echo ~$USER")
ln -s /usr/local/rake-compiler "$HOME"/.rake-compiler
sudo -u "$USER" --set-home \
BASH_ENV=/etc/rubybashrc \
-- "$@"

@ -1,43 +0,0 @@
/*
* This program handles SIGINT and forwards it to another process.
* It is intended to be run as PID 1.
*
* Docker starts processes with "docker run" as PID 1.
* On Linux, the default signal handler for PID 1 ignores any signals.
* Therefore Ctrl-C aka SIGINT is ignored per default.
*/
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
int pid = 0;
void
handle_sigint (int signum)
{
if(pid)
kill(pid, SIGINT);
}
int main(int argc, char *argv[]){
struct sigaction new_action;
int status = -1;
/* Set up the structure to specify the new action. */
new_action.sa_handler = handle_sigint;
sigemptyset (&new_action.sa_mask);
new_action.sa_flags = 0;
sigaction (SIGINT, &new_action, (void*)0);
pid = fork();
if(pid){
wait(&status);
return WEXITSTATUS(status);
}else{
status = execvp(argv[1], &argv[1]);
perror("exec");
return status;
}
}

@ -1,30 +0,0 @@
#!/usr/bin/env ruby
# Strip file on local folder instead of a Virtualbox shared folder
# to work around this bug: https://www.virtualbox.org/ticket/8463
require 'tempfile'
require 'fileutils'
strip = "#{File.basename($0)}.bin"
files = ARGV.reject{|f| f=~/^-/ }.map do |arg|
tmp = Tempfile.new 'strip'
tmp.close
FileUtils.cp arg, tmp.path
[tmp, arg]
end
options = ARGV.select{|f| f=~/^-/ } + files.map{|t,o| t.path }
unless system( strip, *options )
exit 127
end
code = $?.exitstatus
files.each do |tmp, orig|
FileUtils.rm orig
FileUtils.cp tmp.path, orig
end
exit code

@ -1 +0,0 @@
Defaults env_keep += "http_proxy https_proxy ftp_proxy RCD_HOST_RUBY_PLATFORM RCD_HOST_RUBY_VERSION RCD_IMAGE RUBY_CC_VERSION"
Loading…
Cancel
Save