rake-compiler-dock 0.7.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +4 -0
  3. data/.github/workflows/ci.yml +168 -0
  4. data/.gitignore +14 -0
  5. data/Dockerfile.jruby +12 -7
  6. data/Dockerfile.mri.erb +271 -0
  7. data/History.md +63 -0
  8. data/README.md +138 -27
  9. data/Rakefile +71 -4
  10. data/{lib/rake_compiler_dock → build}/gem_helper.rb +0 -15
  11. data/build/parallel_docker_build.rb +106 -0
  12. data/build/patches/{ruby-2.5.3 → ruby-2.5.9}/no_sendfile.patch +1 -1
  13. data/build/patches/ruby-3.1.0/no_sendfile.patch +24 -0
  14. data/build/patches2/rake-compiler-1.1.6/0004-Enable-build-of-static-libruby.patch +28 -0
  15. data/build/rcd-env.sh +6 -0
  16. data/build/runas +1 -6
  17. data/build/sudoers +1 -1
  18. data/lib/rake_compiler_dock/docker_check.rb +12 -6
  19. data/lib/rake_compiler_dock/starter.rb +69 -53
  20. data/lib/rake_compiler_dock/version.rb +2 -2
  21. data/lib/rake_compiler_dock.rb +10 -0
  22. data/mingw64-ucrt/Dockerfile +62 -0
  23. data/mingw64-ucrt/binutils-mingw-w64-ignore-check-errors.patch +13 -0
  24. data/mingw64-ucrt/gcc-mingw-w64-only-c-c++.patch +13 -0
  25. data/mingw64-ucrt/mingw-w64-enable-ucrt.patch +22 -0
  26. data/rake-compiler-dock.gemspec +2 -2
  27. data/test/env/Dockerfile.alpine +17 -0
  28. data/test/env/Dockerfile.centos +17 -0
  29. data/test/env/Dockerfile.debian +24 -0
  30. data/test/rcd_test/Gemfile +11 -0
  31. data/test/rcd_test/Rakefile +74 -0
  32. data/test/rcd_test/ext/java/RcdTestExtService.java +19 -0
  33. data/test/rcd_test/ext/java/RubyRcdTest.java +16 -0
  34. data/test/rcd_test/ext/mri/extconf.rb +20 -0
  35. data/test/rcd_test/ext/mri/rcd_test_ext.c +35 -0
  36. data/test/rcd_test/ext/mri/rcd_test_ext.h +6 -0
  37. data/test/rcd_test/lib/rcd_test.rb +6 -0
  38. data/test/rcd_test/rcd_test.gemspec +27 -0
  39. data/test/rcd_test/test/test_basic.rb +22 -0
  40. data/test/test_environment_variables.rb +56 -31
  41. data/test/test_parallel_docker_build.rb +70 -0
  42. data.tar.gz.sig +1 -0
  43. metadata +83 -14
  44. metadata.gz.sig +0 -0
  45. data/Dockerfile.mri +0 -122
  46. data/build/patches/rake-compiler-1.0.7/enable-static.diff +0 -13
@@ -6,49 +6,74 @@ begin
6
6
  rescue LoadError
7
7
  end
8
8
 
9
- class TestEnvironmentVariables < Test::Unit::TestCase
10
- @@rcd_env = nil
9
+ class TestEnvironmentVariables
10
+ module Common
11
+ IMAGE_NAME = "larskanis/rake-compiler-dock-mri-x86-mingw32:#{RakeCompilerDock::IMAGE_VERSION}"
11
12
 
12
- def setup
13
- @@rcd_env ||= begin
14
- args = "bash -c 'set'"
15
- idir = File.join(File.dirname(__FILE__), '../lib')
16
- cmd = "#{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -I#{idir.inspect} bin/rake-compiler-dock #{args}"
17
- output = `#{cmd}`
13
+ def rcd_env
14
+ self.class.instance_variable_get("@rcd_env") || begin
15
+ command = "env"
16
+ output = %x(#{invocation(command)})
18
17
 
19
- output.split("\n").inject({}) do |hash, line|
20
- if line =~ /\A(\w+)=(.*)\z/
21
- hash[$1] = $2.chomp
18
+ env = output.split("\n").each_with_object({}) do |line, hash|
19
+ hash[Regexp.last_match(1)] = Regexp.last_match(2).chomp if line =~ /\A(\w+)=(.*)\z/
22
20
  end
23
- hash
21
+
22
+ self.class.instance_variable_set("@rcd_env", env)
24
23
  end
25
24
  end
26
- end
27
25
 
28
- def rcd_env
29
- @@rcd_env
30
- end
26
+ def test_RUBY_CC_VERSION
27
+ df = File.read(File.expand_path("../../Dockerfile.mri.erb", __FILE__))
28
+ df =~ /^ENV RUBY_CC_VERSION\s+(.*)\s+$/
29
+ assert_equal $1, rcd_env['RUBY_CC_VERSION']
30
+ end
31
31
 
32
- def test_IMAGE
33
- assert_equal "larskanis/rake-compiler-dock-mri:#{RakeCompilerDock::IMAGE_VERSION}", rcd_env['RCD_IMAGE']
34
- end
32
+ def test_RAKE_EXTENSION_TASK_NO_NATIVE
33
+ assert_equal "true", rcd_env['RAKE_EXTENSION_TASK_NO_NATIVE']
34
+ end
35
35
 
36
- def test_RUBY_CC_VERSION
37
- df = File.read(File.expand_path("../../Dockerfile.mri", __FILE__))
38
- df =~ /^ENV RUBY_CC_VERSION\s+(.*)\s+$/
39
- assert_equal $1, rcd_env['RUBY_CC_VERSION']
40
- end
36
+ def test_symlink_rake_compiler
37
+ cmd = invocation("if test -h $HOME/.rake-compiler ; then echo yes ; else echo no ; fi")
38
+ assert_equal("yes", %x(#{cmd}).strip)
39
+ end
41
40
 
42
- def test_HOST_RUBY_PLATFORM
43
- assert_equal RUBY_PLATFORM, rcd_env['RCD_HOST_RUBY_PLATFORM']
41
+ def test_gem_directory
42
+ cmd = invocation("if test -d $HOME/.gem ; then echo yes ; else echo no ; fi")
43
+ assert_equal("yes", %x(#{cmd}).strip)
44
+ end
44
45
  end
45
46
 
46
- def test_HOST_RUBY_VERSION
47
- assert_equal RUBY_VERSION, rcd_env['RCD_HOST_RUBY_VERSION']
48
- end
47
+ class UsingWrapper < Test::Unit::TestCase
48
+ include Common
49
+
50
+ def invocation(command)
51
+ idir = File.join(File.dirname(__FILE__), '../lib')
52
+ "#{RbConfig::CONFIG['RUBY_INSTALL_NAME']} -I#{idir.inspect} bin/rake-compiler-dock bash -c '#{command}'"
53
+ end
54
+
55
+ def test_HOST_RUBY_PLATFORM
56
+ assert_equal RUBY_PLATFORM, rcd_env['RCD_HOST_RUBY_PLATFORM']
57
+ end
58
+
59
+ def test_HOST_RUBY_VERSION
60
+ assert_equal RUBY_VERSION, rcd_env['RCD_HOST_RUBY_VERSION']
61
+ end
49
62
 
50
- def test_PWD
51
- assert_equal Dir.pwd, rcd_env['PWD']
63
+ def test_IMAGE
64
+ assert_equal IMAGE_NAME, rcd_env['RCD_IMAGE']
65
+ end
66
+
67
+ def test_PWD
68
+ assert_equal Dir.pwd, rcd_env['PWD']
69
+ end
52
70
  end
53
71
 
72
+ class AsIfContinuousIntegration < Test::Unit::TestCase
73
+ include Common
74
+
75
+ def invocation(command)
76
+ "docker run -it #{IMAGE_NAME} bash -c '#{command}'"
77
+ end
78
+ end
54
79
  end
@@ -0,0 +1,70 @@
1
+ require 'test/unit'
2
+ require_relative "../build/parallel_docker_build"
3
+ require "tmpdir"
4
+
5
+ class TestParallelDockerBuild < Test::Unit::TestCase
6
+ def setup
7
+ @tmpdir ||= Dir.mktmpdir
8
+
9
+ Dir.chdir(@tmpdir) do
10
+ File.write "File0", <<-EOT
11
+ FROM a
12
+ RUN a
13
+ RUN d
14
+ EOT
15
+ File.write "File1", <<-EOT
16
+ FROM a
17
+ RUN a
18
+ RUN d
19
+ RUN f \\
20
+ g
21
+ EOT
22
+ File.write "File2", <<-EOT
23
+ FROM a
24
+ RUN b
25
+ RUN c
26
+ RUN d
27
+ EOT
28
+ File.write "File3", <<-EOT
29
+ FROM a
30
+ RUN b
31
+ RUN c
32
+ RUN d
33
+ EOT
34
+ end
35
+ end
36
+
37
+ def teardown
38
+ FileUtils.rm_rf @tmpdir
39
+ end
40
+
41
+ def test_tasks
42
+ Dir.chdir(@tmpdir) do
43
+ RakeCompilerDock::ParallelDockerBuild.new(%w[ File0 File1 File2 File3 ], task_prefix: "y")
44
+ end
45
+
46
+ assert_operator Rake::Task["File0"].prerequisites, :include?, "yFile0File1"
47
+ assert_operator Rake::Task["File1"].prerequisites, :include?, "yFile1"
48
+ assert_operator Rake::Task["yFile1"].prerequisites, :include?, "yFile0File1"
49
+ assert_operator Rake::Task["yFile0File1"].prerequisites, :include?, "yFile0File1File2File3"
50
+
51
+ assert_operator Rake::Task["File2"].prerequisites, :include?, "yFile2File3"
52
+ assert_operator Rake::Task["File3"].prerequisites, :include?, "yFile2File3"
53
+ assert_operator Rake::Task["yFile2File3"].prerequisites, :include?, "yFile0File1File2File3"
54
+ end
55
+
56
+ def test_common_files
57
+ Dir.chdir(@tmpdir) do
58
+ RakeCompilerDock::ParallelDockerBuild.new(%w[ File0 File1 File2 File3 ], task_prefix: "y")
59
+ end
60
+
61
+ assert_equal "FROM a\nRUN a\nRUN d\nRUN f \\\ng\n", read_df("yFile1")
62
+ assert_equal "FROM a\nRUN a\nRUN d\n", read_df("yFile0File1")
63
+ assert_equal "FROM a\nRUN b\nRUN c\nRUN d\n", read_df("yFile2File3")
64
+ assert_equal "FROM a\n", read_df("yFile0File1File2File3")
65
+ end
66
+
67
+ def read_df(fn)
68
+ File.read("tmp/docker/#{fn}").each_line.map(&:lstrip).join
69
+ end
70
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ s���)Րd!���k�wHKm�Dn �n���J�o�:�0�CW���l�wX�@��ݾ�׬�+>�J���'_��dR量�/�&���~�c�ꪽI&>�ym>&H�g��8�vM,��]t����b�u�8����m#9��),TsO$' b�Ėm�p��P h�-2D�ݧ�!�E\�� y)��1��fX����bD�"J�4X��D�?W9C�醐^��3��n*��)�1���H5��@�Ť��W ��������lHt��Ky���M�� �1���5p�
metadata CHANGED
@@ -1,43 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler-dock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Kanis
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2019-03-18 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIETTCCArWgAwIBAgIBATANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
14
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yMTAzMTAyMDIxNDBaFw0yMjAz
15
+ MTAyMDIxNDBaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
16
+ PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAoJSMECFMhBiOcic1
17
+ y1cPjgrfxw/R7wK81sQbiilecqw7zcTRZKzhy7sFQzEF0Wbiy2WmStbktq8cXmet
18
+ 44ZEQI5LtyDhkGl7AFMSows5eMu1ChBdOr45OJsHaidrZfVU2vkkohu2+ZJmcqCB
19
+ TmjBIxTrKpSjMbL1TFd/C491L/SyKhJq90QMs3OfA12SUBD5wlgdfkQ5ZDi1LNTY
20
+ rKCOqGaa/zkr7/5BWpsgYcC6ziaA956ktyuQFVUgZgyJTzYStRuYjbDmaZv2sldW
21
+ zwx3Z2YTEItsdGAoZGbiLNuULmzzwyu8yGaWycpK8l8Al+vMpPaa/dgKUFUkAPjy
22
+ neRjP+N6qWW0hxt0acdw3nXN5ITxo618dQmMzWdLw94wxsWzSUMGldLfNfu9hFnV
23
+ zLrh1bFBYdXk6Mg1OnejZFBc2YlzF1u8Us+NNydHR8dMfRcAhp7sPeHOEKH8V6z2
24
+ VgCHlzf1xq+P+FR8svIqGEBVPHuidr1GguIEqJe7enbjrF2ZAgMBAAGjgYEwfzAJ
25
+ BgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUZT8nEztzNp6aQDDOuZHX
26
+ K9PjoW0wIgYDVR0RBBswGYEXbGFyc0BncmVpei1yZWluc2RvcmYuZGUwIgYDVR0S
27
+ BBswGYEXbGFyc0BncmVpei1yZWluc2RvcmYuZGUwDQYJKoZIhvcNAQELBQADggGB
28
+ AHZW9LEmp+sptD9VhxGbMSacFwlf03IdkEfmd+7MGzS4nQCQJvs/B5JGTm6q20ML
29
+ IJXpCnjBPjwnAflyV9rSr9DL2ShuAIJVNWuWs0uhUtz5HEOuV/fVSAFgLHpXP1yV
30
+ weeoJfLmVeXhRUNo/mH0sjpuRm+C1EVb8QuKFItVa5VBf111Zgn7cFXuOjAtflQ2
31
+ n3EGZATdVzduNvUENzg6l1Ba+q/nRKKHq5CnG6+1YzOhdzYKFOwlYMi6jLQK33aV
32
+ aLvq6jWUIpNbL/95ZdOR8Cd6KsCmK5Zvxd5FMMjrQCsZD6OgReshsok5r6tSiNXc
33
+ YgnBIIAFeoeGz8q+dsm6hPtkii/zr25MPRPmKnbRV7bV/zlbmwpIPxhso95lq3R5
34
+ H5q2yo7qMajDFkxRffqQO8ONvDLGecxbuv1QEyzNBdehVt4I7UedIfxyOvKd9cg2
35
+ d5T9wAD7jW/0seVujw+76/YOJWO3Dft+FQmMBbdd8s3J47HbN9R2mDt6fl6he+X/
36
+ gw==
37
+ -----END CERTIFICATE-----
38
+ date: 2022-01-04 00:00:00.000000000 Z
12
39
  dependencies:
13
40
  - !ruby/object:Gem::Dependency
14
41
  name: bundler
15
42
  requirement: !ruby/object:Gem::Requirement
16
43
  requirements:
17
- - - "~>"
44
+ - - ">="
18
45
  - !ruby/object:Gem::Version
19
46
  version: '1.7'
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.0'
20
50
  type: :development
21
51
  prerelease: false
22
52
  version_requirements: !ruby/object:Gem::Requirement
23
53
  requirements:
24
- - - "~>"
54
+ - - ">="
25
55
  - !ruby/object:Gem::Version
26
56
  version: '1.7'
57
+ - - "<"
58
+ - !ruby/object:Gem::Version
59
+ version: '3.0'
27
60
  - !ruby/object:Gem::Dependency
28
61
  name: rake
29
62
  requirement: !ruby/object:Gem::Requirement
30
63
  requirements:
31
- - - "~>"
64
+ - - ">="
32
65
  - !ruby/object:Gem::Version
33
- version: '12.0'
66
+ version: '12'
34
67
  type: :development
35
68
  prerelease: false
36
69
  version_requirements: !ruby/object:Gem::Requirement
37
70
  requirements:
38
- - - "~>"
71
+ - - ">="
39
72
  - !ruby/object:Gem::Version
40
- version: '12.0'
73
+ version: '12'
41
74
  - !ruby/object:Gem::Dependency
42
75
  name: test-unit
43
76
  requirement: !ruby/object:Gem::Requirement
@@ -62,18 +95,23 @@ executables:
62
95
  extensions: []
63
96
  extra_rdoc_files: []
64
97
  files:
98
+ - ".github/workflows/ci.yml"
65
99
  - ".gitignore"
66
100
  - Dockerfile.jruby
67
- - Dockerfile.mri
101
+ - Dockerfile.mri.erb
68
102
  - Gemfile
69
103
  - History.md
70
104
  - LICENSE.txt
71
105
  - README.md
72
106
  - Rakefile
73
107
  - bin/rake-compiler-dock
108
+ - build/gem_helper.rb
74
109
  - build/mk_i686.rb
75
- - build/patches/rake-compiler-1.0.7/enable-static.diff
76
- - build/patches/ruby-2.5.3/no_sendfile.patch
110
+ - build/parallel_docker_build.rb
111
+ - build/patches/ruby-2.5.9/no_sendfile.patch
112
+ - build/patches/ruby-3.1.0/no_sendfile.patch
113
+ - build/patches2/rake-compiler-1.1.6/0004-Enable-build-of-static-libruby.patch
114
+ - build/rcd-env.sh
77
115
  - build/runas
78
116
  - build/sigfw.c
79
117
  - build/strip_wrapper
@@ -81,12 +119,29 @@ files:
81
119
  - lib/rake_compiler_dock.rb
82
120
  - lib/rake_compiler_dock/colors.rb
83
121
  - lib/rake_compiler_dock/docker_check.rb
84
- - lib/rake_compiler_dock/gem_helper.rb
85
122
  - lib/rake_compiler_dock/predefined_user_group.rb
86
123
  - lib/rake_compiler_dock/starter.rb
87
124
  - lib/rake_compiler_dock/version.rb
125
+ - mingw64-ucrt/Dockerfile
126
+ - mingw64-ucrt/binutils-mingw-w64-ignore-check-errors.patch
127
+ - mingw64-ucrt/gcc-mingw-w64-only-c-c++.patch
128
+ - mingw64-ucrt/mingw-w64-enable-ucrt.patch
88
129
  - rake-compiler-dock.gemspec
130
+ - test/env/Dockerfile.alpine
131
+ - test/env/Dockerfile.centos
132
+ - test/env/Dockerfile.debian
133
+ - test/rcd_test/Gemfile
134
+ - test/rcd_test/Rakefile
135
+ - test/rcd_test/ext/java/RcdTestExtService.java
136
+ - test/rcd_test/ext/java/RubyRcdTest.java
137
+ - test/rcd_test/ext/mri/extconf.rb
138
+ - test/rcd_test/ext/mri/rcd_test_ext.c
139
+ - test/rcd_test/ext/mri/rcd_test_ext.h
140
+ - test/rcd_test/lib/rcd_test.rb
141
+ - test/rcd_test/rcd_test.gemspec
142
+ - test/rcd_test/test/test_basic.rb
89
143
  - test/test_environment_variables.rb
144
+ - test/test_parallel_docker_build.rb
90
145
  - test/test_starter.rb
91
146
  homepage: https://github.com/rake-compiler/rake-compiler-dock
92
147
  licenses:
@@ -107,11 +162,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
162
  - !ruby/object:Gem::Version
108
163
  version: '0'
109
164
  requirements: []
110
- rubygems_version: 3.0.1
165
+ rubygems_version: 3.2.22
111
166
  signing_key:
112
167
  specification_version: 4
113
168
  summary: Easy to use and reliable cross compiler environment for building Windows
114
169
  and Linux binary gems.
115
170
  test_files:
171
+ - test/env/Dockerfile.alpine
172
+ - test/env/Dockerfile.centos
173
+ - test/env/Dockerfile.debian
174
+ - test/rcd_test/Gemfile
175
+ - test/rcd_test/Rakefile
176
+ - test/rcd_test/ext/java/RcdTestExtService.java
177
+ - test/rcd_test/ext/java/RubyRcdTest.java
178
+ - test/rcd_test/ext/mri/extconf.rb
179
+ - test/rcd_test/ext/mri/rcd_test_ext.c
180
+ - test/rcd_test/ext/mri/rcd_test_ext.h
181
+ - test/rcd_test/lib/rcd_test.rb
182
+ - test/rcd_test/rcd_test.gemspec
183
+ - test/rcd_test/test/test_basic.rb
116
184
  - test/test_environment_variables.rb
185
+ - test/test_parallel_docker_build.rb
117
186
  - test/test_starter.rb
metadata.gz.sig ADDED
Binary file
data/Dockerfile.mri DELETED
@@ -1,122 +0,0 @@
1
- FROM ubuntu:16.04
2
-
3
- RUN apt-get -y update && \
4
- apt-get install -y curl git-core xz-utils build-essential wget unzip sudo gnupg2 dirmngr
5
-
6
- # Add "rvm" as system group, to avoid conflicts with host GIDs typically starting with 1000
7
- RUN groupadd -r rvm && useradd -r -g rvm -G sudo -p "" --create-home rvm && \
8
- echo "source /etc/profile.d/rvm.sh" >> /etc/rubybashrc
9
- USER rvm
10
-
11
- # install rvm, RVM 1.26.0+ has signed releases, source rvm for usage outside of package scripts
12
- RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
13
- (curl -L http://get.rvm.io | sudo bash -s stable) && \
14
- bash -c " \
15
- source /etc/rubybashrc && \
16
- rvmsudo rvm cleanup all "
17
-
18
- # Import patch files for ruby and gems
19
- COPY build/patches /home/rvm/patches/
20
- ENV BASH_ENV /etc/rubybashrc
21
-
22
- # install rubies and fix permissions on
23
- RUN bash -c " \
24
- export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
25
- for v in 2.5.3 ; do \
26
- rvm install \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
27
- done && \
28
- rvm cleanup all && \
29
- find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
30
-
31
- # Install rake-compiler and typical gems in all Rubies
32
- # do not generate documentation for gems
33
- RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
34
- bash -c " \
35
- rvm all do gem install --no-document bundler 'bundler:~>1.16' rake-compiler hoe mini_portile rubygems-tasks mini_portile2 && \
36
- find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
37
-
38
- # Install rake-compiler's cross rubies in global dir instead of /root
39
- RUN sudo mkdir -p /usr/local/rake-compiler && \
40
- sudo chown rvm.rvm /usr/local/rake-compiler && \
41
- ln -s /usr/local/rake-compiler ~/.rake-compiler
42
-
43
- # Add cross compilers for Windows and Linux
44
- USER root
45
- RUN apt-get -y update && \
46
- apt-get install -y gcc-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-x86-64 g++-mingw-w64-i686 \
47
- gcc-multilib moreutils
48
-
49
- # Create dev tools i686-linux-gnu-*
50
- COPY build/mk_i686.rb /root/
51
- RUN bash -c " \
52
- rvm alias create default 2.5.3 && \
53
- rvm use default && \
54
- ruby /root/mk_i686.rb "
55
-
56
- USER rvm
57
-
58
- # Patch rake-compiler to build and install static libraries for Linux rubies
59
- RUN cd /usr/local/rvm/gems/ruby-2.5.3/gems/rake-compiler-1.0.7 && \
60
- ( git apply /home/rvm/patches/rake-compiler-1.0.7/*.diff || true )
61
-
62
- ENV XRUBIES 2.6.0 2.5.0 2.4.0 2.3.0 2.2.2
63
-
64
- # First do downloads sequentially since they can not run in parallel
65
- # Then build all xruby versions in parallel
66
- # Then cleanup all build artifacts
67
- RUN for rv in $XRUBIES; do \
68
- bash -c "rake-compiler /home/rvm/.rake-compiler/sources/ruby-$rv/Makefile.in VERSION=$rv HOST=x86_64-linux-gnu"; \
69
- done; \
70
- for rv in $XRUBIES; do \
71
- for host in i686-linux-gnu x86_64-linux-gnu i686-w64-mingw32 x86_64-w64-mingw32; do \
72
- echo -n "'rake-compiler cross-ruby VERSION=$rv HOST=$host' " >> ~/xbuild_rubies; \
73
- done; \
74
- done && \
75
- cat ~/xbuild_rubies; \
76
- bash -c " \
77
- export CFLAGS='-s -O1 -fno-omit-frame-pointer -fno-fast-math' && \
78
- parallel -- $( cat ~/xbuild_rubies ) && \
79
- rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources && \
80
- find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
81
-
82
- # Avoid linking against libruby shared object.
83
- # See also https://github.com/rake-compiler/rake-compiler-dock/issues/13
84
- RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.so | xargs rm
85
- RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby-static.a | while read f ; do cp $f `echo $f | sed s/-static//` ; done
86
- RUN find /usr/local/rake-compiler/ruby/*linux*/ -name libruby.a | while read f ; do ar t $f | xargs ar d $f ; done
87
- RUN find /usr/local/rake-compiler/ruby/*linux*/ -name mkmf.rb | while read f ; do sed -i ':a;N;$!ba;s/TRY_LINK = [^\n]*\n[^\n]*\n[^\n]*LOCAL_LIBS)/& -lruby-static/' $f ; done
88
-
89
- # RubyInstaller doesn't install libgcc -> link it static.
90
- RUN find /usr/local/rake-compiler/ruby/*mingw*/ -name rbconfig.rb | while read f ; do sed -i 's/."LDFLAGS". = "/&-static-libgcc /' $f ; done
91
-
92
- USER root
93
-
94
- # Add more libraries and tools to support cross build
95
- RUN dpkg --add-architecture i386 && \
96
- apt-get -y update && \
97
- apt-get install -y libc6-dev:i386 libudev-dev libudev-dev:i386 cmake
98
-
99
- # Fix paths in rake-compiler/config.yml and add rvm and mingw-tools to the global bashrc
100
- RUN sed -i -- "s:/root/.rake-compiler:/usr/local/rake-compiler:g" /usr/local/rake-compiler/config.yml && \
101
- echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc
102
-
103
- # # Install wrappers for strip commands as a workaround for "Protocol error" in boot2docker.
104
- COPY build/strip_wrapper /root/
105
- RUN mv /usr/bin/i686-w64-mingw32-strip /usr/bin/i686-w64-mingw32-strip.bin && \
106
- mv /usr/bin/x86_64-w64-mingw32-strip /usr/bin/x86_64-w64-mingw32-strip.bin && \
107
- ln /root/strip_wrapper /usr/bin/i686-w64-mingw32-strip && \
108
- ln /root/strip_wrapper /usr/bin/x86_64-w64-mingw32-strip
109
-
110
- # Install SIGINT forwarder
111
- COPY build/sigfw.c /root/
112
- RUN gcc $HOME/sigfw.c -o /usr/local/bin/sigfw
113
-
114
- # Install user mapper
115
- COPY build/runas /usr/local/bin/
116
-
117
- # Install sudoers configuration
118
- COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
119
-
120
- ENV RUBY_CC_VERSION 2.6.0:2.5.0:2.4.0:2.3.0:2.2.2
121
-
122
- CMD bash
@@ -1,13 +0,0 @@
1
- diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
- index 6230799..3a69f13 100644
3
- --- a/tasks/bin/cross-ruby.rake
4
- +++ b/tasks/bin/cross-ruby.rake
5
- @@ -134,6 +134,8 @@ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER
6
- "--target=#{MINGW_TARGET}",
7
- "--build=#{RUBY_BUILD}",
8
- '--enable-shared',
9
- + '--enable-static',
10
- + '--enable-install-static-library',
11
- '--disable-install-doc',
12
- '--with-ext='
13
- ]