rake-compiler-dock 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +168 -0
  4. data/.gitignore +11 -1
  5. data/Dockerfile.jruby +6 -5
  6. data/Dockerfile.mri.erb +83 -43
  7. data/History.md +19 -1
  8. data/README.md +95 -36
  9. data/Rakefile +39 -12
  10. data/build/parallel_docker_build.rb +7 -3
  11. data/build/patches/{ruby-2.5.8 → ruby-2.5.9}/no_sendfile.patch +0 -0
  12. data/build/patches/{ruby-3.0.0 → ruby-3.1.0}/no_sendfile.patch +0 -0
  13. data/build/patches2/{rake-compiler-1.1.1 → rake-compiler-1.1.6}/0004-Enable-build-of-static-libruby.patch +3 -4
  14. data/build/rcd-env.sh +6 -0
  15. data/build/runas +1 -9
  16. data/lib/rake_compiler_dock/starter.rb +3 -2
  17. data/lib/rake_compiler_dock/version.rb +2 -2
  18. data/mingw64-ucrt/Dockerfile +62 -0
  19. data/mingw64-ucrt/binutils-mingw-w64-ignore-check-errors.patch +13 -0
  20. data/mingw64-ucrt/gcc-mingw-w64-only-c-c++.patch +13 -0
  21. data/mingw64-ucrt/mingw-w64-enable-ucrt.patch +22 -0
  22. data/rake-compiler-dock.gemspec +2 -2
  23. data/test/env/Dockerfile.alpine +17 -0
  24. data/test/env/Dockerfile.centos +17 -0
  25. data/test/env/Dockerfile.debian +24 -0
  26. data/test/rcd_test/Gemfile +11 -0
  27. data/test/rcd_test/Rakefile +74 -0
  28. data/test/rcd_test/ext/java/RcdTestExtService.java +19 -0
  29. data/test/rcd_test/ext/java/RubyRcdTest.java +16 -0
  30. data/test/rcd_test/ext/mri/extconf.rb +20 -0
  31. data/test/rcd_test/ext/mri/rcd_test_ext.c +35 -0
  32. data/test/rcd_test/ext/mri/rcd_test_ext.h +6 -0
  33. data/test/rcd_test/lib/rcd_test.rb +6 -0
  34. data/test/rcd_test/rcd_test.gemspec +27 -0
  35. data/test/rcd_test/test/test_basic.rb +22 -0
  36. data/test/test_environment_variables.rb +56 -31
  37. data/test/test_parallel_docker_build.rb +19 -6
  38. data.tar.gz.sig +0 -0
  39. metadata +74 -37
  40. metadata.gz.sig +0 -0
  41. data/build/patches2/hoe-3.20.0/0001-Load-encrypted-private-key-using-ENV-GEM_PRIVATE_KEY.patch +0 -32
  42. data/build/patches2/rake-compiler-1.1.1/0001-Fix-determining-of-ruby-versions-in-rake-native-gem.patch +0 -44
  43. data/build/patches2/rake-compiler-1.1.1/0003-Allow-building-of-cross-rubies-in-parallel.patch +0 -214
  44. data/build/patches2/rake-compiler-1.1.1/0005-Don-t-mask-out-build-env-vars-for-cross-ruby.patch +0 -30
  45. data/build/patches2/rake-compiler-1.1.1/0006-Use-RAKE_EXTENSION_TASK_NO_NATIVE-env-var-as-the-def.patch +0 -26
  46. data/build/patches2/ruby-2.7.0/ruby2_keywords.patch +0 -15
  47. data/build/patches2/ruby-3.0.0/ruby2_keywords.patch +0 -15
@@ -1,214 +0,0 @@
1
- From 01fd7364bdcb37ac8709ffa48388b5cbe6478211 Mon Sep 17 00:00:00 2001
2
- From: Lars Kanis <lars@greiz-reinsdorf.de>
3
- Date: Fri, 10 Jan 2020 23:57:18 +0100
4
- Subject: [PATCH] Allow building of cross rubies in parallel
5
-
6
- Rubies can be build like so:
7
- rake-compiler cross-ruby VERSION=2.7.0:2.6.0 HOST=x86_64-w64-mingw32:i686-w64-mingw32
8
-
9
- This builds the cross product of all ":" separated ruby and host versions.
10
- To force sequential builds add option "-j1".
11
- ---
12
- tasks/bin/cross-ruby.rake | 161 +++++++++++++++++++-------------------
13
- 1 file changed, 80 insertions(+), 81 deletions(-)
14
-
15
- diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
16
- index 278541c..8b88025 100644
17
- --- a/tasks/bin/cross-ruby.rake
18
- +++ b/tasks/bin/cross-ruby.rake
19
- @@ -41,106 +41,105 @@ end
20
- require 'rake/extensioncompiler'
21
-
22
- MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
23
- -USER_HOME = File.expand_path("~/.rake-compiler")
24
- -RUBY_CC_VERSION = "ruby-" << ENV.fetch("VERSION", "1.8.7-p371")
25
- +USER_HOME = File.realpath(File.expand_path("~/.rake-compiler"))
26
- RUBY_SOURCE = ENV['SOURCE']
27
- RUBY_BUILD = RbConfig::CONFIG["host"]
28
-
29
- -# grab the major "1.8" or "1.9" part of the version number
30
- -MAJOR = RUBY_CC_VERSION.match(/.*-(\d.\d).\d/)[1]
31
- -
32
- -# Use Rake::ExtensionCompiler helpers to find the proper host
33
- -MINGW_HOST = ENV['HOST'] || Rake::ExtensionCompiler.mingw_host
34
- -MINGW_TARGET = MINGW_HOST.gsub('msvc', '')
35
- -
36
- # Unset any possible variable that might affect compilation
37
- ["CC", "CXX", "CPPFLAGS", "LDFLAGS", "RUBYOPT"].each do |var|
38
- ENV.delete(var)
39
- end
40
-
41
- -source_dir = "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
42
- -build_dir = "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}"
43
- -
44
- -# define a location where sources will be stored
45
- -directory source_dir
46
- -directory build_dir
47
- -
48
- -# clean intermediate files and folders
49
- -CLEAN.include(source_dir)
50
- -CLEAN.include(build_dir)
51
- -
52
- -# remove the final products and sources
53
- -CLOBBER.include("#{USER_HOME}/sources")
54
- -CLOBBER.include("#{USER_HOME}/builds")
55
- -CLOBBER.include("#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
56
- -CLOBBER.include("#{USER_HOME}/config.yml")
57
- +RUBY_CC_VERSIONS = ENV.fetch("VERSION", "1.8.7-p371")
58
- +RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
59
- + ruby_cc_version = "ruby-" + ruby_cc_version
60
- + # grab the major "1.8" or "1.9" part of the version number
61
- + major = ruby_cc_version.match(/.*-(\d.\d).\d/)[1]
62
- +
63
- + # define a location where sources will be stored
64
- + source_dir = "#{USER_HOME}/sources/#{ruby_cc_version}"
65
- + directory source_dir
66
- + # clean intermediate files and folders
67
- + CLEAN.include(source_dir)
68
- +
69
- + # remove the final products and sources
70
- + CLOBBER.include("#{USER_HOME}/sources")
71
- + CLOBBER.include("#{USER_HOME}/builds")
72
- + CLOBBER.include("#{USER_HOME}/config.yml")
73
- +
74
- + # Extract the sources
75
- + source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{ruby_cc_version}.tar.bz2"
76
- + file source_dir => ["#{USER_HOME}/sources/#{source_file}"] do |t|
77
- + t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}", chdir: File.dirname(t.name) }
78
- + end
79
-
80
- -# ruby source file should be stored there
81
- -file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.bz2" => ["#{USER_HOME}/sources"] do |t|
82
- - # download the source file using wget or curl
83
- - chdir File.dirname(t.name) do
84
- + # ruby source file should be stored there
85
- + file "#{USER_HOME}/sources/#{ruby_cc_version}.tar.bz2" => ["#{USER_HOME}/sources"] do |t|
86
- + # download the source file using wget or curl
87
- if RUBY_SOURCE
88
- url = RUBY_SOURCE
89
- else
90
- - url = "http://cache.ruby-lang.org/pub/ruby/#{MAJOR}/#{File.basename(t.name)}"
91
- + url = "http://cache.ruby-lang.org/pub/ruby/#{major}/#{File.basename(t.name)}"
92
- end
93
- - sh "wget #{url} || curl -O #{url}"
94
- + sh "wget #{url} || curl -O #{url}", chdir: File.dirname(t.name)
95
- end
96
- -end
97
- -
98
- -# Extract the sources
99
- -source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{RUBY_CC_VERSION}.tar.bz2"
100
- -file source_dir => ["#{USER_HOME}/sources/#{source_file}"] do |t|
101
- - chdir File.dirname(t.name) do
102
- - t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}" }
103
- - end
104
- -end
105
-
106
- -task :mingw32 do
107
- - unless MINGW_HOST then
108
- - warn "You need to install mingw32 cross compile functionality to be able to continue."
109
- - warn "Please refer to your distribution/package manager documentation about installation."
110
- - fail
111
- - end
112
- -end
113
- + # Create tasks for each host out of the ":" separated hosts list in the HOST variable.
114
- + # These tasks are processed in parallel as dependencies to the "install" task.
115
- + mingw_hosts = ENV['HOST'] || Rake::ExtensionCompiler.mingw_host
116
- + mingw_hosts.split(":").each do |mingw_host|
117
- +
118
- + # Use Rake::ExtensionCompiler helpers to find the proper host
119
- + mingw_target = mingw_host.gsub('msvc', '')
120
- +
121
- + # define a location where built files for each host will be stored
122
- + build_dir = "#{USER_HOME}/builds/#{mingw_host}/#{ruby_cc_version}"
123
- + directory build_dir
124
- + install_dir = "#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}"
125
- +
126
- + # clean intermediate files and folders
127
- + CLEAN.include(build_dir)
128
- + CLOBBER.include(install_dir)
129
- +
130
- + task :mingw32 do
131
- + unless mingw_host then
132
- + warn "You need to install mingw32 cross compile functionality to be able to continue."
133
- + warn "Please refer to your distribution/package manager documentation about installation."
134
- + fail
135
- + end
136
- + end
137
-
138
- -# generate the makefile in a clean build location
139
- -file "#{build_dir}/Makefile" => [build_dir, source_dir] do |t|
140
- -
141
- - options = [
142
- - "--host=#{MINGW_HOST}",
143
- - "--target=#{MINGW_TARGET}",
144
- - "--build=#{RUBY_BUILD}",
145
- - '--enable-shared',
146
- - '--disable-install-doc',
147
- - '--with-ext=',
148
- - 'LDFLAGS=-pipe -s',
149
- - ]
150
- -
151
- - # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
152
- - options << "--with-winsock2" if MAJOR == "1.8"
153
- -
154
- - chdir File.dirname(t.name) do
155
- - prefix = File.expand_path("../../../ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
156
- - options << "--prefix=#{prefix}"
157
- - sh File.expand_path("../../../sources/#{RUBY_CC_VERSION}/configure"), *options
158
- - end
159
- -end
160
- + # generate the makefile in a clean build location
161
- + file "#{build_dir}/Makefile" => [build_dir, source_dir] do |t|
162
- +
163
- + options = [
164
- + "--host=#{mingw_host}",
165
- + "--target=#{mingw_target}",
166
- + "--build=#{RUBY_BUILD}",
167
- + '--enable-shared',
168
- + '--disable-install-doc',
169
- + '--with-ext=',
170
- + 'LDFLAGS=-pipe -s',
171
- + ]
172
- +
173
- + # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
174
- + options << "--with-winsock2" if major == "1.8"
175
- + options << "--prefix=#{install_dir}"
176
- + sh File.expand_path("#{USER_HOME}/sources/#{ruby_cc_version}/configure"), *options, chdir: File.dirname(t.name)
177
- + end
178
-
179
- -# make
180
- -file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
181
- - chdir File.dirname(t.prerequisites.first) do
182
- - sh MAKE
183
- - end
184
- -end
185
- + # make
186
- + file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
187
- + sh MAKE, chdir: File.dirname(t.prerequisites.first)
188
- + end
189
-
190
- -# make install
191
- -file "#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{build_dir}/ruby.exe"] do |t|
192
- - chdir File.dirname(t.prerequisites.first) do
193
- - sh "#{MAKE} install"
194
- + # make install
195
- + file "#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}/bin/ruby.exe" => ["#{build_dir}/ruby.exe"] do |t|
196
- + sh "#{MAKE} install", chdir: File.dirname(t.prerequisites.first)
197
- + end
198
- + multitask :install => ["#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}/bin/ruby.exe"]
199
- end
200
- end
201
- -task :install => ["#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe"]
202
-
203
- desc "Update rake-compiler list of installed Ruby versions"
204
- task 'update-config' do
205
- @@ -187,5 +186,5 @@ task :default do
206
- Rake.application.display_tasks_and_comments
207
- end
208
-
209
- -desc "Build #{RUBY_CC_VERSION} suitable for cross-platform development."
210
- +desc "Build rubies suitable for cross-platform development."
211
- task 'cross-ruby' => [:mingw32, :install, 'update-config']
212
- --
213
- 2.20.1
214
-
@@ -1,30 +0,0 @@
1
- From 783d3d380e6abf107e0747d229da0f5e001c623f Mon Sep 17 00:00:00 2001
2
- From: Lars Kanis <lars@greiz-reinsdorf.de>
3
- Date: Sun, 20 Dec 2020 19:08:22 +0100
4
- Subject: [PATCH] Don't mask out build env vars for cross-ruby
5
-
6
- This was introduced in commit a7c113e580c1565000166f9967da82ff2ecdaeaa to avoid interference with host build.
7
- However it prohibits setting important flags for cross-build.
8
-
9
- Also don't force 'LDFLAGS=-pipe -s' in configure, which doesn't work with clang targeting MacOS.
10
- It can now be set externally.
11
- ---
12
- tasks/bin/cross-ruby.rake | 3 +--
13
- 1 file changed, 1 insertion(+), 2 deletions(-)
14
-
15
- diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
16
- index 8edf5cd..8317a2a 100644
17
- --- a/tasks/bin/cross-ruby.rake
18
- +++ b/tasks/bin/cross-ruby.rake
19
- @@ -46,7 +46,7 @@ RUBY_SOURCE = ENV['SOURCE']
20
- RUBY_BUILD = RbConfig::CONFIG["host"]
21
-
22
- # Unset any possible variable that might affect compilation
23
- -["CC", "CXX", "CPPFLAGS", "LDFLAGS", "RUBYOPT"].each do |var|
24
- +["RUBYOPT"].each do |var|
25
- ENV.delete(var)
26
- end
27
-
28
- --
29
- 2.27.0
30
-
@@ -1,26 +0,0 @@
1
- From 15f630adc4325f9cafb762e15a051c2ec8bd21e2 Mon Sep 17 00:00:00 2001
2
- From: Sutou Kouhei <kou@clear-code.com>
3
- Date: Mon, 21 Dec 2020 04:30:44 +0900
4
- Subject: [PATCH] Use RAKE_EXTENSION_TASK_NO_NATIVE env var as the default
5
- value
6
-
7
- ---
8
- lib/rake/extensiontask.rb | 2 +-
9
- 1 file changed, 1 insertion(+), 1 deletion(-)
10
-
11
- diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb
12
- index b0ab88e..49d59da 100644
13
- --- a/lib/rake/extensiontask.rb
14
- +++ b/lib/rake/extensiontask.rb
15
- @@ -23,7 +23,7 @@ module Rake
16
- @cross_compile = false
17
- @cross_config_options = []
18
- @cross_compiling = nil
19
- - @no_native = false
20
- + @no_native = (ENV["RAKE_EXTENSION_TASK_NO_NATIVE"] == "true")
21
- @config_includes = []
22
- @ruby_versions_per_platform = {}
23
- @make = nil
24
- --
25
- 2.27.0
26
-
@@ -1,15 +0,0 @@
1
- diff --git a/template/fake.rb.in b/template/fake.rb.in
2
- index f1da719ecb..e0b649fb28 100644
3
- --- a/template/fake.rb.in
4
- +++ b/template/fake.rb.in
5
- @@ -27,6 +27,10 @@ case "$0" in /*) r=-r"$0";; *) r=-r"./$0";; esac
6
- exec $ruby "$r" "$@"
7
- =end
8
- =baseruby
9
- +<% if RUBY_VERSION < "2.7" %>
10
- +def ruby2_keywords(*)
11
- +end
12
- +<% end %>
13
- class Object
14
- remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
15
- CROSS_COMPILING = RUBY_PLATFORM
@@ -1,15 +0,0 @@
1
- diff --git a/template/fake.rb.in b/template/fake.rb.in
2
- index f1da719ecb..e0b649fb28 100644
3
- --- a/template/fake.rb.in
4
- +++ b/template/fake.rb.in
5
- @@ -27,6 +27,10 @@ case "$0" in /*) r=-r"$0";; *) r=-r"./$0";; esac
6
- exec $ruby "$r" "$@"
7
- =end
8
- =baseruby
9
- +<% if RUBY_VERSION < "2.7" %>
10
- +def ruby2_keywords(*)
11
- +end
12
- +<% end %>
13
- class Object
14
- remove_const :CROSS_COMPILING if defined?(CROSS_COMPILING)
15
- CROSS_COMPILING = RUBY_PLATFORM