mirror of https://github.com/grpc/grpc.git
With rake-compiler-dock-1.0.1 there's no need to use a derived Dockerfile. The standard RCD image can be used instead. The only issue is with conflicting declarations of gettimeofday(), which can be easily worked around by patching win32.h before the build. Fixes #21514pull/22039/head
parent
64fb7d4745
commit
4c667476a0
9 changed files with 41 additions and 117 deletions
@ -1,22 +0,0 @@ |
||||
FROM larskanis/rake-compiler-dock-mri:0.7.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 |
||||
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 apt-get install -y g++-multilib |
||||
|
||||
# Make the system to have GLIBC 2.12 instead of 2.23 so that |
||||
# generated ruby package can run on CentOS 6 with GLIBC 2.12 |
||||
RUN sed -i 's/__GLIBC_MINOR__\t23/__GLIBC_MINOR__\t12/' /usr/include/features.h |
||||
|
||||
# Use posix pthread for mingw so that C++ standard library for thread could be |
||||
# available such as std::thread, std::mutex, so on. |
||||
# https://sourceware.org/pthreads-win32/ |
||||
RUN printf "1\n" | update-alternatives --config x86_64-w64-mingw32-gcc && \ |
||||
printf "1\n" | update-alternatives --config x86_64-w64-mingw32-g++ && \ |
||||
printf "1\n" | update-alternatives --config i686-w64-mingw32-gcc && \ |
||||
printf "1\n" | update-alternatives --config i686-w64-mingw32-g++ |
||||
|
||||
CMD bash |
@ -1,22 +0,0 @@ |
||||
Copyright (c) 2015 Lars Kanis |
||||
|
||||
MIT License |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining |
||||
a copy of this software and associated documentation files (the |
||||
"Software"), to deal in the Software without restriction, including |
||||
without limitation the rights to use, copy, modify, merge, publish, |
||||
distribute, sublicense, and/or sell copies of the Software, and to |
||||
permit persons to whom the Software is furnished to do so, subject to |
||||
the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be |
||||
included in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -1 +0,0 @@ |
||||
This is a modified Dockerfile taken from [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) for the purpose of building gRPC's ruby gem. |
@ -1,56 +0,0 @@ |
||||
#!/usr/bin/env ruby |
||||
# Copyright 2016 gRPC authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
def grpc_root() |
||||
File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) |
||||
end |
||||
|
||||
def docker_for_windows_image() |
||||
require 'digest' |
||||
|
||||
dockerfile = File.join(grpc_root, 'third_party', 'rake-compiler-dock', 'Dockerfile') |
||||
dockerpath = File.dirname(dockerfile) |
||||
version = Digest::SHA1.file(dockerfile).hexdigest |
||||
image_name = 'rake-compiler-dock_' + version |
||||
# if "DOCKERHUB_ORGANIZATION" env is set, we try to pull the pre-built |
||||
# rake-compiler-dock image from dockerhub rather then building from scratch. |
||||
if ENV.has_key?('DOCKERHUB_ORGANIZATION') |
||||
image_name = ENV['DOCKERHUB_ORGANIZATION'] + '/' + image_name |
||||
cmd = "docker pull #{image_name}" |
||||
puts cmd |
||||
system cmd |
||||
raise "Failed to pull the docker image." unless $? == 0 |
||||
else |
||||
cmd = "docker build -t #{image_name} --file #{dockerfile} #{dockerpath}" |
||||
puts cmd |
||||
system cmd |
||||
raise "Failed to build the docker image." unless $? == 0 |
||||
end |
||||
image_name |
||||
end |
||||
|
||||
def docker_for_windows(args) |
||||
require 'rake_compiler_dock' |
||||
|
||||
args = 'bash -l' if args.empty? |
||||
|
||||
ENV['RAKE_COMPILER_DOCK_IMAGE'] = docker_for_windows_image |
||||
|
||||
RakeCompilerDock.sh args |
||||
end |
||||
|
||||
if __FILE__ == $0 |
||||
docker_for_windows $*.join(' ') |
||||
end |
Loading…
Reference in new issue