rake-compiler-dock 1.9.1 → 1.11.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/.github/workflows/ci.yml +74 -74
  4. data/.github/workflows/publish-images.yml +798 -46
  5. data/.github/workflows/publish-images.yml.erb +121 -0
  6. data/.github/workflows/release-images.yml +854 -45
  7. data/{History.md → CHANGELOG.md} +37 -0
  8. data/CONTRIBUTING.md +44 -1
  9. data/Dockerfile.jruby +3 -3
  10. data/Dockerfile.mri.erb +103 -58
  11. data/README.md +48 -6
  12. data/Rakefile +143 -40
  13. data/build/buildkitd.toml +2 -0
  14. data/build/gem_helper.rb +2 -2
  15. data/build/mk_musl_cross.sh +1 -1
  16. data/build/parallel_docker_build.rb +64 -23
  17. data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0004-Enable-build-of-static-libruby.patch +4 -2
  18. data/build/patches/{rake-compiler-1.2.9 → rake-compiler-1.3.1}/0005-build-miniruby-first.patch +2 -3
  19. data/build/patches/rake-compiler-1.3.1/0006-ruby-4-rubyspec-capiext.patch +16 -0
  20. data/build/sudoers +1 -1
  21. data/lib/rake_compiler_dock/starter.rb +11 -1
  22. data/lib/rake_compiler_dock/version.rb +2 -2
  23. data/lib/rake_compiler_dock.rb +12 -17
  24. data/mingw64-ucrt/README.md +0 -44
  25. data/test/env/Dockerfile.alpine +1 -1
  26. data/test/fixtures/mig_test_rpc.defs +8 -0
  27. data/test/rcd_test/Rakefile +1 -0
  28. data/test/rcd_test/ext/mri/extconf.rb +2 -0
  29. data/test/rcd_test/rcd_test.gemspec +1 -1
  30. data/test/rcd_test/test/test_basic.rb +11 -0
  31. data/test/test_environment_variables.rb +13 -0
  32. data/test/test_mig.rb +18 -0
  33. data/test/test_parallel_docker_build.rb +2 -2
  34. data/test/test_starter.rb +6 -0
  35. data/test/test_versions.rb +1 -1
  36. data.tar.gz.sig +0 -0
  37. metadata +39 -9
  38. metadata.gz.sig +0 -0
  39. data/test/env/Dockerfile.centos +0 -24
data/Rakefile CHANGED
@@ -8,10 +8,30 @@ CLEAN.include("tmp")
8
8
 
9
9
  RakeCompilerDock::GemHelper.install_tasks
10
10
 
11
+ def build_mri_images(platforms, host_platforms, output: )
12
+ plats = host_platforms.map(&:first).join(",")
13
+ platforms.each do |platform, _|
14
+ sdf = "tmp/docker/Dockerfile.mri.#{platform}"
15
+ image_name = RakeCompilerDock::Starter.container_image_name(platform: platform)
16
+
17
+ tags = [image_name]
18
+ tags << image_name.sub("linux-gnu", "linux") if image_name.include?("linux-gnu")
19
+ RakeCompilerDock.docker_build(sdf, tag: tags, platform: plats, output: output)
20
+ end
21
+ end
22
+
23
+ def build_jruby_images(host_platforms, output: )
24
+ image_name = RakeCompilerDock::Starter.container_image_name(rubyvm: "jruby")
25
+ plats = host_platforms.map(&:first).join(",")
26
+ sdf = "tmp/docker/Dockerfile.jruby"
27
+ RakeCompilerDock.docker_build(sdf, tag: image_name, platform: plats, output: output)
28
+ end
29
+
11
30
  platforms = [
12
31
  # tuple is [platform, target]
13
32
  ["aarch64-linux-gnu", "aarch64-linux-gnu"],
14
33
  ["aarch64-linux-musl", "aarch64-linux-musl"],
34
+ ["aarch64-mingw-ucrt", "aarch64-w64-mingw32"],
15
35
  ["arm-linux-gnu", "arm-linux-gnueabihf"],
16
36
  ["arm-linux-musl", "arm-linux-musleabihf"],
17
37
  ["arm64-darwin", "aarch64-apple-darwin"],
@@ -25,51 +45,138 @@ platforms = [
25
45
  ["x86_64-linux-musl", "x86_64-unknown-linux-musl"],
26
46
  ]
27
47
 
48
+ host_platforms = [
49
+ # tuple is [docker platform, RUBY_PLATFORM matcher]
50
+ ["linux/amd64", /^x86_64|^x64|^amd64/],
51
+ ["linux/arm64", /^aarch64|arm64/],
52
+ ]
53
+ local_platform = host_platforms.find { |_,reg| reg =~ RUBY_PLATFORM } or
54
+ raise("RUBY_PLATFORM #{RUBY_PLATFORM} is not supported as host")
55
+
56
+ mkdir_p "tmp/docker"
57
+
58
+ docker_platform, _ = local_platform
59
+ platforms.each do |platform, target|
60
+ sdf = "tmp/docker/Dockerfile.mri.#{platform}"
61
+ df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding)
62
+ File.write(sdf, df)
63
+ CLEAN.include(sdf)
64
+ end
65
+ sdf = "tmp/docker/Dockerfile.jruby"
66
+ df = File.read("Dockerfile.jruby")
67
+ File.write(sdf, df)
68
+
69
+ parallel_docker_build = RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "tmp/docker/Dockerfile.mri.#{pl}" } + ["tmp/docker/Dockerfile.jruby"], workdir: "tmp/docker", task_prefix: "common-")
70
+
28
71
  namespace :build do
72
+ parallel_docker_build.define_file_tasks platform: docker_platform
73
+
74
+ # The jobs in the CI pipeline are already organized in a tree structure.
75
+ # So we can avoid unnecessary rebuilds by omitting the dependecies.
76
+ unless ENV['RCD_TASK_DEPENDENCIES'] = "false"
77
+ parallel_docker_build.define_tree_tasks
78
+ parallel_docker_build.define_final_tasks
79
+ end
29
80
 
30
81
  platforms.each do |platform, target|
31
- sdf = "Dockerfile.mri.#{platform}"
32
-
33
- desc "Build image for platform #{platform}"
34
- task platform => sdf
35
- task sdf do
36
- image_name = RakeCompilerDock::Starter.container_image_name(platform: platform)
37
- sh(*RakeCompilerDock.docker_build_cmd(platform), "-t", image_name, "-f", "Dockerfile.mri.#{platform}", ".")
38
- if image_name.include?("linux-gnu")
39
- sh("docker", "tag", image_name, image_name.sub("linux-gnu", "linux"))
40
- end
41
- end
82
+ sdf = "tmp/docker/Dockerfile.mri.#{platform}"
42
83
 
43
- df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding)
44
- File.write(sdf, df)
45
- CLEAN.include(sdf)
84
+ # Load image after build on local platform only
85
+ desc "Build and load image for platform #{platform} on #{docker_platform}"
86
+ task platform => sdf do
87
+ build_mri_images([platform], [local_platform], output: 'load')
88
+ end
89
+ multitask :images => platform
46
90
  end
47
91
 
48
- desc "Build image for JRuby"
49
- task :jruby => "Dockerfile.jruby"
50
- task "Dockerfile.jruby" do
51
- image_name = RakeCompilerDock::Starter.container_image_name(rubyvm: "jruby")
52
- sh(*RakeCompilerDock.docker_build_cmd("jruby"), "-t", image_name, "-f", "Dockerfile.jruby", ".")
92
+ sdf = "tmp/docker/Dockerfile.jruby"
93
+ # Load image after build on local platform only
94
+ desc "Build and load image for JRuby on #{docker_platform}"
95
+ task :jruby => sdf do
96
+ build_jruby_images([local_platform], output: 'load')
53
97
  end
98
+ multitask :images => :jruby
54
99
 
55
- RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "Dockerfile.mri.#{pl}" } + ["Dockerfile.jruby"], workdir: "tmp/docker")
56
-
100
+ all_mri_images = platforms.map(&:first)
57
101
  desc "Build images for all MRI platforms in parallel"
58
102
  if ENV['RCD_USE_BUILDX_CACHE']
59
- task :mri => platforms.map(&:first)
103
+ task :mri => all_mri_images
60
104
  else
61
- multitask :mri => platforms.map(&:first)
105
+ multitask :mri => all_mri_images
62
106
  end
63
107
 
108
+ all_images = all_mri_images + ["jruby"]
64
109
  desc "Build images for all platforms in parallel"
65
110
  if ENV['RCD_USE_BUILDX_CACHE']
66
- task :all => platforms.map(&:first) + ["jruby"]
111
+ task :images => all_images
67
112
  else
68
- multitask :all => platforms.map(&:first) + ["jruby"]
113
+ multitask :images => all_images
69
114
  end
70
115
  end
71
116
 
72
- task :build => "build:all"
117
+ namespace :release do
118
+ host_pl = host_platforms.map(&:first).join(",")
119
+
120
+ desc "Push image for JRuby on #{host_pl}"
121
+ task :jruby do
122
+ build_jruby_images(host_platforms, output: 'push')
123
+ end
124
+
125
+ desc "Push all docker images on #{host_pl}"
126
+ multitask :images => :jruby
127
+
128
+ platforms.each do |platform, target|
129
+ desc "Push image for platform #{platform} on #{host_pl}"
130
+ task platform do
131
+ build_mri_images([platform], host_platforms, output: 'push')
132
+ end
133
+
134
+ desc "Push all docker images on #{host_pl}"
135
+ multitask :images => platform
136
+ end
137
+
138
+ desc "Show download sizes of the release images"
139
+ task :sizes do
140
+ require "yaml"
141
+
142
+ ths = platforms.map do |pl, _|
143
+ image_name = RakeCompilerDock::Starter.container_image_name(platform: pl)
144
+ Thread.new do
145
+ [ pl,
146
+ IO.popen("docker manifest inspect #{image_name} -v", &:read)
147
+ ]
148
+ end
149
+ end
150
+
151
+ hlayers = Hash.new{|h,k| h[k] = {} }
152
+ isize_sums = Hash.new{|h,k| h[k] = 0 }
153
+
154
+ ths.map(&:value).each do |pl, ystr|
155
+ y = YAML.load(ystr)
156
+ y = [y] unless y.is_a?(Array)
157
+ y.each do |img|
158
+ next unless img
159
+ host_pl = "#{img.dig("Descriptor", "platform", "architecture")}-#{
160
+ img.dig("Descriptor", "platform", "os")}"
161
+ next if host_pl=="unknown-unknown"
162
+ lays = img.dig("OCIManifest", "layers") || img.dig("SchemaV2Manifest", "layers")
163
+ isize = lays.map do |lay|
164
+ hlayers[host_pl][lay["digest"]] = lay["size"]
165
+ end.sum
166
+ isize_sums[host_pl] += isize
167
+ puts format("%-15s %-20s:%12d MB", host_pl, pl, isize/1024/1024)
168
+ end
169
+ end
170
+ puts "----------"
171
+ isize_sums.each do |host_pl, isize|
172
+ puts format("%-15s %-20s:%12d MB", host_pl, "all-separate", isize/1024/1024)
173
+ end
174
+ hlayers.each do |host_pl, layers|
175
+ asize = layers.values.sum
176
+ puts format("%-15s %-20s:%12d MB", host_pl, "all-combined", asize/1024/1024)
177
+ end
178
+ end
179
+ end
73
180
 
74
181
  namespace :prepare do
75
182
  desc "Build cross compiler for x64-mingw-ucrt aka RubyInstaller-3.1+"
@@ -114,19 +221,15 @@ task :update_lists do
114
221
  end
115
222
  end
116
223
 
117
- namespace :release do
118
- desc "push all docker images"
119
- task :images do
120
- image_name = RakeCompilerDock::Starter.container_image_name(rubyvm: "jruby")
121
- sh("docker", "push", image_name)
122
-
123
- platforms.each do |platform, _|
124
- image_name = RakeCompilerDock::Starter.container_image_name(platform: platform)
125
- sh("docker", "push", image_name)
126
-
127
- if image_name.include?("linux-gnu")
128
- sh("docker", "push", image_name.sub("linux-gnu", "linux"))
129
- end
130
- end
224
+ desc "Update CI publish workflows from erb"
225
+ namespace :ci do
226
+ task :update_workflows do
227
+ erb = ERB.new(File.read(".github/workflows/publish-images.yml.erb"))
228
+ sdf = ".github/workflows/publish-images.yml"
229
+ release = false
230
+ File.write(sdf, erb.result(binding))
231
+ sdf = ".github/workflows/release-images.yml"
232
+ release = true
233
+ File.write(sdf, erb.result(binding))
131
234
  end
132
235
  end
@@ -0,0 +1,2 @@
1
+ [worker.oci]
2
+ gc = false
data/build/gem_helper.rb CHANGED
@@ -13,11 +13,11 @@ module RakeCompilerDock
13
13
  end
14
14
 
15
15
  def hfile
16
- "History.md"
16
+ "CHANGELOG.md"
17
17
  end
18
18
 
19
19
  def headline
20
- '([^\w]*)(\d+\.\d+\.\d+)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
20
+ '([^\w]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
21
21
  end
22
22
 
23
23
  def reldate
@@ -29,7 +29,7 @@ GCC_CONFIG += --disable-libquadmath --disable-decimal-float
29
29
  GCC_CONFIG += --disable-multilib
30
30
  EOF
31
31
 
32
- make -j$(nproc) install
32
+ make -j$(nproc) install LINUX_HEADERS_SITE=http://mirrors.2f30.org/sabotage/tarballs/
33
33
 
34
34
  popd
35
35
 
@@ -9,21 +9,37 @@ module RakeCompilerDock
9
9
  if platform
10
10
  cache_version = RakeCompilerDock::IMAGE_VERSION.split(".").take(2).join(".")
11
11
  cache = File.join("cache", cache_version, platform)
12
- "docker buildx build --cache-to=type=local,dest=#{cache},mode=max --cache-from=type=local,src=#{cache} --load"
12
+ "docker buildx build --cache-to=type=local,dest=#{cache},mode=max --cache-from=type=local,src=#{cache} --progress=plain"
13
13
  else
14
14
  return nil
15
15
  end
16
16
  else
17
- ENV['RCD_DOCKER_BUILD'] || "docker build"
17
+ ENV['RCD_DOCKER_BUILD'] || "docker buildx build --progress=plain"
18
18
  end
19
19
  Shellwords.split(cmd)
20
20
  end
21
+
22
+ # Run an intermediate dockerfile without tag
23
+ #
24
+ # The layers will be reused in subsequent builds, even if they run in parallel.
25
+ def docker_build(filename, tag: nil, output: false, platform: )
26
+ cmd = docker_build_cmd(platform)
27
+ return if cmd.nil?
28
+ tag_args = Array(tag).flat_map{|t| ["-t", t] } if tag
29
+ push_args = ["--push"] if output == 'push'
30
+ push_args = ["--load"] if output == 'load'
31
+ Class.new.extend(FileUtils).sh(*cmd, "-f", filename, ".", "--platform", platform, *tag_args, *push_args)
32
+ end
21
33
  end
22
34
 
23
35
  # Run docker builds in parallel, but ensure that common docker layers are reused
24
36
  class ParallelDockerBuild
25
37
  include Rake::DSL
26
38
 
39
+ attr_reader :file_deps
40
+ attr_reader :tree_deps
41
+ attr_reader :final_deps
42
+
27
43
  def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-")
28
44
  FileUtils.mkdir_p(workdir)
29
45
 
@@ -33,7 +49,11 @@ module RakeCompilerDock
33
49
  vcs = find_commons(files)
34
50
  # pp vcs
35
51
 
36
- define_common_tasks(vcs, workdir, task_prefix)
52
+ @file_deps = {}
53
+ @tree_deps = {}
54
+ @final_deps = {}
55
+
56
+ write_docker_files(vcs, workdir, task_prefix)
37
57
  end
38
58
 
39
59
  # Read given dockerfiles from inputdir and split into a list of commands.
@@ -87,36 +107,57 @@ module RakeCompilerDock
87
107
  end.compact.to_h
88
108
  end
89
109
 
90
- # Write intermediate dockerfiles to workdir and define rake tasks
91
- #
92
- # The rake tasks are named after the dockerfiles given to #new .
93
- # This also adds dependant intermediate tasks as prerequisites.
94
- def define_common_tasks(vcs, workdir, task_prefix, plines=[])
110
+ # Write intermediate dockerfiles to workdir and fill properties
111
+ def write_docker_files(vcs, workdir, task_prefix, plines=[])
95
112
  vcs.map do |files, (lines, nvcs)|
96
- fn = "#{task_prefix}#{Digest::SHA1.hexdigest(files.join)}"
97
- File.write(File.join(workdir, fn), (plines + lines).join)
98
- task fn do
99
- docker_build(fn, workdir)
113
+ fn = "#{task_prefix}#{Digest::SHA1.hexdigest(files.join)[0, 7]}"
114
+ wfn = File.join(workdir, fn)
115
+ File.write(wfn, (plines + lines).join)
116
+ @file_deps[fn] = wfn
117
+
118
+ files.each do |file|
119
+ @final_deps[file] = fn
100
120
  end
101
121
 
102
- nfn = define_common_tasks(nvcs, workdir, task_prefix, plines + lines)
122
+ nfn = write_docker_files(nvcs, workdir, task_prefix, plines + lines)
103
123
  nfn.each do |file|
104
- task file => fn
105
- end
106
- files.each do |file|
107
- task file => fn
124
+ @tree_deps[file] = fn
108
125
  end
109
126
  fn
110
127
  end
111
128
  end
112
129
 
113
- # Run an intermediate dockerfile without tag
130
+ # Define rake tasks for building common docker files
114
131
  #
115
- # The layers will be reused in subsequent builds, even if they run in parallel.
116
- def docker_build(filename, workdir)
117
- cmd = RakeCompilerDock.docker_build_cmd
118
- return if cmd.nil?
119
- sh(*RakeCompilerDock.docker_build_cmd, "-f", File.join(workdir, filename), ".")
132
+ # The rake tasks are named after the dockerfiles given to #new .
133
+ # This also adds dependant intermediate tasks as prerequisites.
134
+ def define_rake_tasks(**build_options)
135
+ define_file_tasks(**build_options)
136
+ define_tree_tasks
137
+ define_final_tasks
138
+ end
139
+
140
+ def define_file_tasks(**build_options)
141
+ file_deps.each do |fn, wfn|
142
+ # p file_deps: {fn => wfn}
143
+ task fn do
144
+ RakeCompilerDock.docker_build(wfn, **build_options)
145
+ end
146
+ end
147
+ end
148
+
149
+ def define_tree_tasks
150
+ tree_deps.each do |file, prereq|
151
+ # p tree_deps: {file => prereq}
152
+ task file => prereq
153
+ end
154
+ end
155
+
156
+ def define_final_tasks
157
+ final_deps.each do |file, prereq|
158
+ # p final_deps: {file => prereq}
159
+ task file => prereq
160
+ end
120
161
  end
121
162
  end
122
163
  end
@@ -1,17 +1,19 @@
1
1
  diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
- index 8317a2a3..8ed21718 100644
2
+ index d37ab97b..4623896a 100644
3
3
  --- a/tasks/bin/cross-ruby.rake
4
4
  +++ b/tasks/bin/cross-ruby.rake
5
- @@ -116,11 +116,30 @@
5
+ @@ -116,11 +116,32 @@
6
6
  "--host=#{mingw_host}",
7
7
  "--target=#{mingw_target}",
8
8
  "--build=#{RUBY_BUILD}",
9
9
  - '--enable-shared',
10
10
  + '--enable-install-static-library',
11
11
  + '--disable-jit-support',
12
+ + '--disable-rpath',
12
13
  + 'ac_cv_lib_z_uncompress=no',
13
14
  + 'ac_cv_lib_crypt_crypt=no',
14
15
  + 'ac_cv_func_crypt_r=no',
16
+ + 'extra_warnflags=-Wno-shorten-64-to-32 -Wno-dll-attribute-on-redeclaration',
15
17
  '--disable-install-doc',
16
18
  '--with-ext=',
17
19
  ]
@@ -1,12 +1,11 @@
1
1
  diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
- index d37ab97b..0df44b30 100644
2
+ index d37ab97b..512afbf4 100644
3
3
  --- a/tasks/bin/cross-ruby.rake
4
4
  +++ b/tasks/bin/cross-ruby.rake
5
- @@ -129,6 +129,12 @@
5
+ @@ -129,6 +129,11 @@
6
6
 
7
7
  # make
8
8
  file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
9
- + puts "MIKE: #{ruby_cc_version}: #{mingw_target}"
10
9
  + if ruby_cc_version.start_with?("ruby-3.1") && mingw_target =~ /darwin/
11
10
  + # for later 3.1.x releases, we need to explicitly build miniruby
12
11
  + # see https://bugs.ruby-lang.org/issues/19239
@@ -0,0 +1,16 @@
1
+ diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
+ index 3d23eed6..904c12e0 100644
3
+ --- a/tasks/bin/cross-ruby.rake
4
+ +++ b/tasks/bin/cross-ruby.rake
5
+ @@ -150,6 +150,11 @@
6
+
7
+ # make
8
+ file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
9
+ + if ruby_cc_version.start_with?("ruby-4.0")
10
+ + # https://bugs.ruby-lang.org/issues/21792 - hopefully will be fixed by 4.0.0 final
11
+ + FileUtils.rm_f("#{USER_HOME}/sources/#{ruby_cc_version}/spec/ruby/optional/capi/ext/digest_spec.c")
12
+ + end
13
+ +
14
+ if ruby_cc_version.start_with?("ruby-3.1") && mingw_target =~ /darwin/
15
+ # for later 3.1.x releases, we need to explicitly build miniruby
16
+ # see https://bugs.ruby-lang.org/issues/19239
data/build/sudoers CHANGED
@@ -1 +1 @@
1
- Defaults env_keep += "http_proxy https_proxy ftp_proxy GEM_PRIVATE_KEY_PASSPHRASE RCD_HOST_RUBY_PLATFORM RCD_HOST_RUBY_VERSION RCD_IMAGE RUBY_CC_VERSION LD_LIBRARY_PATH DEVTOOLSET_ROOTPATH SOURCE_DATE_EPOCH"
1
+ Defaults env_keep += "http_proxy https_proxy ftp_proxy GEM_PRIVATE_KEY_PASSPHRASE RCD_HOST_RUBY_PLATFORM RCD_HOST_RUBY_VERSION RCD_IMAGE RUBY_CC_VERSION LD_LIBRARY_PATH DEVTOOLSET_ROOTPATH SOURCE_DATE_EPOCH RBENV_VERSION"
@@ -41,6 +41,11 @@ module RakeCompilerDock
41
41
  user = options.fetch(:username){ current_user }
42
42
  group = options.fetch(:groupname){ current_group }
43
43
 
44
+ ruby_version = options[:ruby] || ENV['RCD_RUBY_VERSION']
45
+ rbenv_opts = if ruby_version
46
+ ["-e", "RBENV_VERSION=#{ruby_version}"]
47
+ end
48
+
44
49
  platforms(options).split(" ").each do |platform|
45
50
  image_name = container_image_name(options.merge(platform: platform))
46
51
 
@@ -73,6 +78,7 @@ module RakeCompilerDock
73
78
  "-e", "RCD_HOST_RUBY_PLATFORM=#{RUBY_PLATFORM}",
74
79
  "-e", "RCD_HOST_RUBY_VERSION=#{RUBY_VERSION}",
75
80
  "-e", "RCD_IMAGE=#{image_name}",
81
+ *rbenv_opts,
76
82
  "-w", make_valid_path(workdir),
77
83
  *docker_opts,
78
84
  image_name,
@@ -167,7 +173,7 @@ module RakeCompilerDock
167
173
 
168
174
  "%s/rake-compiler-dock-image:%s-%s%s" % [
169
175
  container_registry,
170
- options.fetch(:version) { IMAGE_VERSION },
176
+ options.fetch(:version) { image_version },
171
177
  container_rubyvm(options),
172
178
  container_jrubyvm?(options) ? "" : "-#{options.fetch(:platform)}",
173
179
  ]
@@ -178,6 +184,10 @@ module RakeCompilerDock
178
184
  ENV['CONTAINER_REGISTRY'] || "ghcr.io/rake-compiler"
179
185
  end
180
186
 
187
+ def image_version
188
+ ENV['RCD_IMAGE_VERSION'] || IMAGE_VERSION
189
+ end
190
+
181
191
  def container_rubyvm(options={})
182
192
  return "jruby" if options[:platform] == "jruby"
183
193
  options.fetch(:rubyvm) { ENV['RCD_RUBYVM'] } || "mri"
@@ -1,4 +1,4 @@
1
1
  module RakeCompilerDock
2
- VERSION = "1.9.1"
3
- IMAGE_VERSION = "1.9.1"
2
+ VERSION = "1.11.0.rc1"
3
+ IMAGE_VERSION = "1.11.0.rc1"
4
4
  end
@@ -82,28 +82,23 @@ module RakeCompilerDock
82
82
  #
83
83
  # RakeCompilerDock.cross_rubies
84
84
  # # => {
85
- # # "3.4" => "3.4.1",
86
- # # "3.3" => "3.3.5",
87
- # # "3.2" => "3.2.6",
88
- # # "3.1" => "3.1.6",
85
+ # # "3.4" => "3.4.8",
86
+ # # "3.3" => "3.3.10",
87
+ # # "3.2" => "3.2.9",
88
+ # # "3.1" => "3.1.7",
89
89
  # # "3.0" => "3.0.7",
90
90
  # # "2.7" => "2.7.8",
91
- # # "2.6" => "2.6.10",
92
- # # "2.5" => "2.5.9",
93
- # # "2.4" => "2.4.10",
94
91
  # # }
95
92
  #
96
93
  def cross_rubies
97
94
  {
98
- "3.4" => "3.4.1",
99
- "3.3" => "3.3.7",
100
- "3.2" => "3.2.6",
101
- "3.1" => "3.1.6",
95
+ "4.0" => "4.0.0",
96
+ "3.4" => "3.4.8",
97
+ "3.3" => "3.3.10",
98
+ "3.2" => "3.2.9",
99
+ "3.1" => "3.1.7",
102
100
  "3.0" => "3.0.7",
103
101
  "2.7" => "2.7.8",
104
- "2.6" => "2.6.10",
105
- "2.5" => "2.5.9",
106
- "2.4" => "2.4.10",
107
102
  }
108
103
  end
109
104
 
@@ -118,13 +113,13 @@ module RakeCompilerDock
118
113
  #
119
114
  # For example:
120
115
  # RakeCompilerDock.ruby_cc_version("2.7", "3.4")
121
- # # => "3.4.1:2.7.8"
116
+ # # => "3.4.8:2.7.8"
122
117
  #
123
118
  # RakeCompilerDock.ruby_cc_version("~> 3.2")
124
- # # => "3.4.1:3.3.7:3.2.6"
119
+ # # => "3.4.8:3.3.10:3.2.9"
125
120
  #
126
121
  # RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.2"))
127
- # # => "3.4.1:3.3.7:3.2.6"
122
+ # # => "3.4.8:3.3.10:3.2.9"
128
123
  #
129
124
  def ruby_cc_version(*requirements)
130
125
  cross = cross_rubies
@@ -12,47 +12,3 @@ They are built by the following command:
12
12
  ```sh
13
13
  docker buildx build . -t larskanis/mingw64-ucrt:20.04 --platform linux/arm64,linux/amd64 --push
14
14
  ```
15
-
16
-
17
- Create builder instance for two architectures
18
- ------------------
19
-
20
- Building with qemu emulation fails currently with a segfault, so that it must be built by a builder instance with at least one remote node for the other architecture.
21
- Building on native hardware is also much faster (~30 minutes) than on qemu.
22
- A two-nodes builder requires obviously a ARM and a Intel/AMD device.
23
- It can be created like this:
24
-
25
- ```sh
26
- # Make sure the remote instance can be connected
27
- $ docker -H ssh://isa info
28
-
29
- # Create a new builder with the local instance
30
- $ docker buildx create --name isayoga
31
-
32
- # Add the remote instance
33
- $ docker buildx create --name isayoga --append ssh://isa
34
-
35
- # They are inactive from the start
36
- $ docker buildx ls
37
- NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
38
- isayoga docker-container
39
- \_ isayoga0 \_ unix:///var/run/docker.sock inactive
40
- \_ isayoga1 \_ ssh://isa inactive
41
- default* docker
42
- \_ default \_ default running v0.13.2 linux/arm64
43
-
44
- # Bootstrap the instances
45
- $ docker buildx inspect --bootstrap --builder isayoga
46
-
47
- # Set the new builder as default
48
- $ docker buildx use isayoga
49
-
50
- # Now it should be default and in state "running"
51
- $ docker buildx ls
52
- NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
53
- isayoga* docker-container
54
- \_ isayoga0 \_ unix:///var/run/docker.sock running v0.18.2 linux/arm64
55
- \_ isayoga1 \_ ssh://isa running v0.18.2 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
56
- default docker
57
- \_ default \_ default running v0.13.2 linux/arm64
58
- ```
@@ -2,7 +2,7 @@ ARG from_image
2
2
  FROM ${from_image}
3
3
 
4
4
  RUN uname -a
5
- RUN apk add ruby ruby-etc ruby-rake git
5
+ RUN apk add ruby ruby-rake git
6
6
 
7
7
  RUN ruby --version
8
8
  RUN gem env
@@ -0,0 +1,8 @@
1
+ #include <mach/std_types.defs>
2
+ #include <mach/mach_types.defs>
3
+
4
+ subsystem mig_test_ipc 1;
5
+
6
+ routine mig_test_call(
7
+ server_port : mach_port_t;
8
+ out returnvalue : int);
@@ -22,6 +22,7 @@ else
22
22
  aarch64-linux
23
23
  aarch64-linux-gnu
24
24
  aarch64-linux-musl
25
+ aarch64-mingw-ucrt
25
26
  arm-linux
26
27
  arm-linux-gnu
27
28
  arm-linux-musl
@@ -18,6 +18,8 @@ else
18
18
  puts "cc --version: #{ %x[#{CONFIG['CC']} --version].lines.first}"
19
19
  puts "-"*70
20
20
 
21
+ $CFLAGS << " -Wall -Werror"
22
+
21
23
  have_func('rb_thread_call_without_gvl', 'ruby/thread.h') ||
22
24
  raise("rb_thread_call_without_gvl() not found")
23
25
 
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.summary = "C extension for testing rake-compiler-dock"
10
10
  spec.description = "This gem has no real use other than testing builds of binary gems."
11
11
  spec.homepage = "https://github.com/rake-compiler/rake-compiler-dock"
12
- spec.required_ruby_version = ">= 2.0.0"
12
+ spec.required_ruby_version = ">= 2.7.0"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = [
@@ -35,4 +35,15 @@ class TestBasic < Minitest::Test
35
35
  is_linux = RUBY_PLATFORM.include?("linux")
36
36
  assert_equal(is_linux, RcdTest.largefile_op_removed_from_musl)
37
37
  end
38
+
39
+ def test_disabled_rpath
40
+ skip("jruby uses jar files without rpath") if RUBY_ENGINE == "jruby"
41
+
42
+ cext_fname = $LOADED_FEATURES.grep(/rcd_test_ext/).first
43
+ refute_nil(cext_fname, "the C-ext should be loaded")
44
+ cext_text = File.binread(cext_fname)
45
+ assert_match(/Init_rcd_test_ext/, cext_text, "C-ext shoud contain the init function")
46
+ refute_match(/usr\/local/, cext_text, "there should be no rpath to /usr/local/rake-compiler/ruby/x86_64-unknown-linux-musl/ruby-3.4.5/lib or so")
47
+ refute_match(/home\//, cext_text, "there should be no path to /home/ or so")
48
+ end
38
49
  end