rake-compiler-dock 1.8.0 → 1.9.1
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.
- checksums.yaml +4 -4
- data/Dockerfile.mri.erb +32 -31
- data/History.md +26 -0
- data/README.md +38 -0
- data/lib/rake_compiler_dock/version.rb +2 -2
- data/lib/rake_compiler_dock.rb +82 -1
- data/test/test_environment_variables.rb +2 -0
- data/test/test_versions.rb +82 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17f3ab24c0e7f48cc7eba4fbfce3af5d2e178643a6d0d5663b92a635ec9c48ae
|
4
|
+
data.tar.gz: 25c51dc1ebf4872403b8e9a2233dea9d4e47edb44506a7a65b2088657625de47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2a8bc6953b45749a195aa0e742f3d84c18705d286b364acc2b0c9533f30f762e34b5ed09ffed3261749d3ff90654d858592f405bb68c17babc001246b65ef0b
|
7
|
+
data.tar.gz: 0c4e8fe5ba886f41b824637f018bac313d0fe4d8f4440a7789e90d706b4a9f96c54b0b06e2486a75bd94d54bd1172c43882b1e1060e09b5d1f086952e32ddd92
|
data/Dockerfile.mri.erb
CHANGED
@@ -74,30 +74,30 @@ ENV BASH_ENV=/etc/rubybashrc
|
|
74
74
|
##
|
75
75
|
USER rubyuser
|
76
76
|
|
77
|
-
ENV RBENV_RUBIES="2.5.9 3.1.6"
|
77
|
+
ENV RBENV_RUBIES="2.5.9 3.1.6 3.4.1"
|
78
78
|
|
79
79
|
# Install the bootstrap rubies
|
80
80
|
RUN bash -c " \
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
81
|
+
echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \
|
82
|
+
export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
|
83
|
+
for v in ${RBENV_RUBIES} ; do \
|
84
|
+
rbenv install \$v -- --disable-install-doc ; \
|
85
|
+
done && \
|
86
|
+
find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \
|
87
|
+
"
|
88
88
|
|
89
89
|
# Install rake-compiler and patch it to build and install static libraries for Linux rubies
|
90
90
|
COPY build/patches /home/rubyuser/patches
|
91
91
|
RUN bash -c " \
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
92
|
+
for v in ${RBENV_RUBIES} ; do \
|
93
|
+
rbenv shell \$v && \
|
94
|
+
gem install rake-compiler -v1.2.9 && \
|
95
|
+
cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.9 && \
|
96
|
+
for patch in /home/rubyuser/patches/rake-compiler-1.2.9/*.patch ; do \
|
97
|
+
patch -p1 < \$patch ; \
|
98
|
+
done \
|
99
|
+
done \
|
100
|
+
"
|
101
101
|
|
102
102
|
# Install rake-compiler's cross rubies in global dir instead of /root
|
103
103
|
RUN sudo mkdir -p /usr/local/rake-compiler && \
|
@@ -115,7 +115,7 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
|
|
115
115
|
xrubies_build_plan = if platform =~ /x64-mingw-ucrt/
|
116
116
|
[
|
117
117
|
# Rubyinstaller-3.1+ is platform x64-mingw-ucrt
|
118
|
-
["3.4.1:3.3.
|
118
|
+
["3.4.1:3.3.7:3.2.6:3.1.6", "3.4.1"],
|
119
119
|
]
|
120
120
|
elsif platform =~ /x64-mingw32/
|
121
121
|
[
|
@@ -126,7 +126,8 @@ elsif platform =~ /x64-mingw32/
|
|
126
126
|
else
|
127
127
|
[
|
128
128
|
["2.6.10:2.5.9:2.4.10", "2.5.9"],
|
129
|
-
["
|
129
|
+
["2.7.8", "3.1.6"],
|
130
|
+
["3.4.1:3.3.7:3.2.6:3.1.6:3.0.7", "3.4.1"],
|
130
131
|
]
|
131
132
|
end
|
132
133
|
|
@@ -134,16 +135,16 @@ strip = '-s' if platform !~ /darwin/
|
|
134
135
|
|
135
136
|
xrubies_build_plan.each do |xrubies, bootstrap_ruby_version| %>
|
136
137
|
RUN bash -c " \
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
138
|
+
rbenv shell <%= bootstrap_ruby_version %> && \
|
139
|
+
export CPPFLAGS='<%= "-D__USE_MINGW_ANSI_STDIO=1" if platform =~ /x64-mingw-ucrt/ %>' && \
|
140
|
+
export CFLAGS='-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong <%= strip %>' && \
|
141
|
+
export LDFLAGS='-pipe <%= strip %>' && \
|
142
|
+
<%= "export LIBS='-l:libssp.a' &&" if platform =~ /mingw/ %> \
|
143
|
+
<%= "export CC=#{target}-clang &&" if platform =~ /darwin/ %> \
|
144
|
+
export MAKE='make V=1' && \
|
145
|
+
rake-compiler cross-ruby VERSION=<%= xrubies %> HOST=<%= target %> && \
|
146
|
+
rm -rf ~/.rake-compiler/builds ~/.rake-compiler/sources \
|
147
|
+
"
|
147
148
|
<% end %>
|
148
149
|
# "
|
149
150
|
|
@@ -223,8 +224,8 @@ RUN echo 'source /etc/profile.d/rcd-env.sh' >> /etc/rubybashrc
|
|
223
224
|
# Install sudoers configuration
|
224
225
|
COPY build/sudoers /etc/sudoers.d/rake-compiler-dock
|
225
226
|
|
226
|
-
RUN bash -c "rbenv global 3.1
|
227
|
+
RUN bash -c "rbenv global 3.4.1"
|
227
228
|
|
228
|
-
ENV RUBY_CC_VERSION=3.4.1:3.3.
|
229
|
+
ENV RUBY_CC_VERSION=3.4.1:3.3.7:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10:2.5.9:2.4.10
|
229
230
|
|
230
231
|
CMD bash
|
data/History.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# `rake-compiler/rake-compiler-dock` Changelog
|
2
2
|
|
3
|
+
## v1.9.1 / 2025-01-20
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- Introduce `RakeCompilerDock.set_ruby_cc_version` to make it easier to set `RUBY_CC_VERSION` without hardcoding specific patch-level ruby versions. See the README for more deteails. #149, #150 @flavorjones
|
8
|
+
|
9
|
+
|
10
|
+
## v1.9.0 / 2025-01-19
|
11
|
+
|
12
|
+
### Changes
|
13
|
+
|
14
|
+
- Bump Ruby 3.3 to v3.3.7 (from v3.3.5). #147 @flavorjones
|
15
|
+
- The default `rbenv` ruby in the container is now Ruby v3.4.1 (previously the default was 3.1.6), which allows gems to drop Ruby 3.1 from their gemspecs. Fixes #145. #146 @flavorjones
|
16
|
+
- Ruby 3.4.x, 3.3.x, 3.2.x, 3.1.x, and 3.0.x are cross-compiled using Ruby v3.4.1. #146 @flavorjones
|
17
|
+
|
18
|
+
### CRuby container summary
|
19
|
+
|
20
|
+
- native rubies: 3.4.1 (default), 3.1.6, 2.5.9
|
21
|
+
- `RUBY_CC_VERSION=3.4.1:3.3.7:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10:2.5.9:2.4.10`
|
22
|
+
|
23
|
+
|
3
24
|
## v1.8.0 / 2025-01-05
|
4
25
|
|
5
26
|
### Notable changes
|
@@ -13,6 +34,11 @@ All versions of Ruby in the build containers are the latest patch version. #135
|
|
13
34
|
- (Darwin) Set `OSXCROSS_PKG_CONFIG_USE_NATIVE_VARIABLES=1` to successfully build the 3.0 series.
|
14
35
|
- (Darwin) The linker flags include `-Wl,-flat_namespace` for 2.7, 3.0, 3.1, 3.2, 3.3, and 3.4 rubies. Previously this was only needed for 3.2+, but code backported to 2.7.7, 3.0.5, and 3.1.3 required it for those versions as well.
|
15
36
|
|
37
|
+
### CRuby container summary
|
38
|
+
|
39
|
+
- native rubies: 3.1.6 (default), 2.5.9
|
40
|
+
- `RUBY_CC_VERSION=3.4.1:3.3.5:3.2.6:3.1.6:3.0.7:2.7.8:2.6.10:2.5.9:2.4.10`
|
41
|
+
|
16
42
|
|
17
43
|
## v1.7.1 / 2025-01-03
|
18
44
|
|
data/README.md
CHANGED
@@ -352,6 +352,44 @@ Other environment variables can be set or passed through to the container like t
|
|
352
352
|
RakeCompilerDock.sh "rake cross native gem OPENSSL_VERSION=#{ENV['OPENSSL_VERSION']}"
|
353
353
|
```
|
354
354
|
|
355
|
+
### Choosing specific Ruby versions to support
|
356
|
+
|
357
|
+
If you only want to precompile for certain Ruby versions, you can specify those versions by overwriting the `RUBY_CC_VERSION` environment variable.
|
358
|
+
|
359
|
+
For example, if you wanted to only support Ruby 3.4 and 3.3, you might set this variable to:
|
360
|
+
|
361
|
+
``` ruby
|
362
|
+
ENV["RUBY_CC_VERSION"] = "3.4.1:3.3.7"
|
363
|
+
```
|
364
|
+
|
365
|
+
In practice, though, hardcoding these versions is brittle because the patch versions in the container may very from release to release.
|
366
|
+
|
367
|
+
A more robust way to do this is to use `RakeCompilerDock.ruby_cc_version` which accepts an array of Ruby minor versions or patch version requirements.
|
368
|
+
|
369
|
+
``` ruby
|
370
|
+
RakeCompilerDock.ruby_cc_version("3.3", "3.4")
|
371
|
+
# => "3.4.1:3.3.7"
|
372
|
+
|
373
|
+
RakeCompilerDock.ruby_cc_version("~> 3.4.0", "~> 3.3.0")
|
374
|
+
# => "3.4.1:3.3.7"
|
375
|
+
|
376
|
+
RakeCompilerDock.ruby_cc_version("~> 3.3")
|
377
|
+
# => "3.4.1:3.3.7"
|
378
|
+
```
|
379
|
+
|
380
|
+
So you can either set the environment variable directly:
|
381
|
+
|
382
|
+
``` ruby
|
383
|
+
ENV["RUBY_CC_VERSION"] = RakeCompilerDock.ruby_cc_version("~> 3.1")
|
384
|
+
```
|
385
|
+
|
386
|
+
or do the same thing using the `set_ruby_cc_version` convenience method:
|
387
|
+
|
388
|
+
``` ruby
|
389
|
+
RakeCompilerDock.set_ruby_cc_version("~> 3.1") # equivalent to the above assignment
|
390
|
+
```
|
391
|
+
|
392
|
+
|
355
393
|
|
356
394
|
## More information
|
357
395
|
|
data/lib/rake_compiler_dock.rb
CHANGED
@@ -73,5 +73,86 @@ module RakeCompilerDock
|
|
73
73
|
Starter.exec(*args, &block)
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
# Retrieve the cross-rubies that are available in the docker image. This can be used to construct
|
77
|
+
# a custom `RUBY_CC_VERSION` string that is valid.
|
78
|
+
#
|
79
|
+
# Returns a Hash<minor_version => corresponding_patch_version>
|
80
|
+
#
|
81
|
+
# For example:
|
82
|
+
#
|
83
|
+
# RakeCompilerDock.cross_rubies
|
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",
|
89
|
+
# # "3.0" => "3.0.7",
|
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
|
+
# # }
|
95
|
+
#
|
96
|
+
def cross_rubies
|
97
|
+
{
|
98
|
+
"3.4" => "3.4.1",
|
99
|
+
"3.3" => "3.3.7",
|
100
|
+
"3.2" => "3.2.6",
|
101
|
+
"3.1" => "3.1.6",
|
102
|
+
"3.0" => "3.0.7",
|
103
|
+
"2.7" => "2.7.8",
|
104
|
+
"2.6" => "2.6.10",
|
105
|
+
"2.5" => "2.5.9",
|
106
|
+
"2.4" => "2.4.10",
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
# Returns a valid RUBY_CC_VERSION string for the given requirements,
|
111
|
+
# where each `requirement` may be:
|
112
|
+
#
|
113
|
+
# - a String that matches the minor version exactly
|
114
|
+
# - a String that can be used as a Gem::Requirement constructor argument
|
115
|
+
# - a Gem::Requirement object
|
116
|
+
#
|
117
|
+
# Note that the returned string will contain versions sorted in descending order.
|
118
|
+
#
|
119
|
+
# For example:
|
120
|
+
# RakeCompilerDock.ruby_cc_version("2.7", "3.4")
|
121
|
+
# # => "3.4.1:2.7.8"
|
122
|
+
#
|
123
|
+
# RakeCompilerDock.ruby_cc_version("~> 3.2")
|
124
|
+
# # => "3.4.1:3.3.7:3.2.6"
|
125
|
+
#
|
126
|
+
# RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.2"))
|
127
|
+
# # => "3.4.1:3.3.7:3.2.6"
|
128
|
+
#
|
129
|
+
def ruby_cc_version(*requirements)
|
130
|
+
cross = cross_rubies
|
131
|
+
output = []
|
132
|
+
|
133
|
+
if requirements.empty?
|
134
|
+
output += cross.values
|
135
|
+
else
|
136
|
+
requirements.each do |requirement|
|
137
|
+
if cross[requirement]
|
138
|
+
output << cross[requirement]
|
139
|
+
else
|
140
|
+
requirement = Gem::Requirement.new(requirement) unless requirement.is_a?(Gem::Requirement)
|
141
|
+
versions = cross.values.find_all { |v| requirement.satisfied_by?(Gem::Version.new(v)) }
|
142
|
+
raise("No matching ruby version for requirement: #{requirement.inspect}") if versions.empty?
|
143
|
+
output += versions
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
output.uniq.sort.reverse.join(":")
|
149
|
+
end
|
150
|
+
|
151
|
+
# Set the environment variable `RUBY_CC_VERSION` to the value returned by `ruby_cc_version`,
|
152
|
+
# for the given requirements.
|
153
|
+
def set_ruby_cc_version(*requirements)
|
154
|
+
ENV["RUBY_CC_VERSION"] = ruby_cc_version(*requirements)
|
155
|
+
end
|
156
|
+
|
157
|
+
module_function :exec, :sh, :image_name, :cross_rubies, :ruby_cc_version, :set_ruby_cc_version
|
77
158
|
end
|
@@ -34,6 +34,8 @@ class TestEnvironmentVariables
|
|
34
34
|
df = File.read(File.expand_path("../../Dockerfile.mri.erb", __FILE__))
|
35
35
|
df =~ /^ENV RUBY_CC_VERSION=(.*)$/
|
36
36
|
assert_equal $1, rcd_env['RUBY_CC_VERSION']
|
37
|
+
|
38
|
+
assert_equal RakeCompilerDock.ruby_cc_version, rcd_env['RUBY_CC_VERSION']
|
37
39
|
end
|
38
40
|
|
39
41
|
def test_RAKE_EXTENSION_TASK_NO_NATIVE
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rake_compiler_dock'
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class TestVersions < Test::Unit::TestCase
|
6
|
+
def test_cross_rubies
|
7
|
+
cross = RakeCompilerDock.cross_rubies
|
8
|
+
assert_operator(cross, :is_a?, Hash)
|
9
|
+
cross.each do |minor, patch|
|
10
|
+
assert_match(/^\d+\.\d+$/, minor)
|
11
|
+
assert_match(/^\d+\.\d+\.\d+$/, patch)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_ruby_cc_versions_no_args
|
16
|
+
cross = RakeCompilerDock.cross_rubies
|
17
|
+
expected = cross.values.sort.reverse.join(":")
|
18
|
+
|
19
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_ruby_cc_versions_strings
|
23
|
+
cross = RakeCompilerDock.cross_rubies
|
24
|
+
|
25
|
+
expected = cross["3.4"]
|
26
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version("3.4"))
|
27
|
+
|
28
|
+
expected = [cross["3.4"], cross["3.2"]].join(":")
|
29
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version("3.4", "3.2"))
|
30
|
+
|
31
|
+
expected = [cross["3.4"], cross["3.2"]].join(":")
|
32
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version("3.2", "3.4"))
|
33
|
+
|
34
|
+
assert_raises do
|
35
|
+
RakeCompilerDock.ruby_cc_version("9.8")
|
36
|
+
end
|
37
|
+
|
38
|
+
assert_raises do
|
39
|
+
RakeCompilerDock.ruby_cc_version("foo")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_ruby_cc_versions_requirements
|
44
|
+
cross = RakeCompilerDock.cross_rubies
|
45
|
+
|
46
|
+
expected = cross["3.4"]
|
47
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version("~> 3.4"))
|
48
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.4")))
|
49
|
+
|
50
|
+
expected = [cross["3.4"], cross["3.3"], cross["3.2"]].join(":")
|
51
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version("~> 3.2"))
|
52
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.2")))
|
53
|
+
|
54
|
+
expected = [cross["3.4"], cross["3.2"]].join(":")
|
55
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version("~> 3.2.0", "~> 3.4.0"))
|
56
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("~> 3.2.0"), Gem::Requirement.new("~> 3.4.0")))
|
57
|
+
|
58
|
+
expected = [cross["3.4"], cross["3.3"], cross["3.2"]].join(":")
|
59
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version(">= 3.2"))
|
60
|
+
assert_equal(expected, RakeCompilerDock.ruby_cc_version(Gem::Requirement.new(">= 3.2")))
|
61
|
+
|
62
|
+
assert_raises do
|
63
|
+
RakeCompilerDock.ruby_cc_version(Gem::Requirement.new("> 9.8"))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_set_ruby_cc_versions
|
68
|
+
original_ruby_cc_versions = ENV["RUBY_CC_VERSION"]
|
69
|
+
cross = RakeCompilerDock.cross_rubies
|
70
|
+
|
71
|
+
RakeCompilerDock.set_ruby_cc_version(Gem::Requirement.new("~> 3.2.0"), Gem::Requirement.new("~> 3.4.0"))
|
72
|
+
assert_equal([cross["3.4"], cross["3.2"]].join(":"), ENV["RUBY_CC_VERSION"])
|
73
|
+
|
74
|
+
RakeCompilerDock.set_ruby_cc_version("~> 3.2.0", "~> 3.4.0")
|
75
|
+
assert_equal([cross["3.4"], cross["3.2"]].join(":"), ENV["RUBY_CC_VERSION"])
|
76
|
+
|
77
|
+
RakeCompilerDock.set_ruby_cc_version("~> 3.1")
|
78
|
+
assert_equal([cross["3.4"], cross["3.3"], cross["3.2"], cross["3.1"]].join(":"), ENV["RUBY_CC_VERSION"])
|
79
|
+
ensure
|
80
|
+
ENV["RUBY_CC_VERSION"] = original_ruby_cc_versions
|
81
|
+
end
|
82
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-compiler-dock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Kanis
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-20 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- test/test_environment_variables.rb
|
124
124
|
- test/test_parallel_docker_build.rb
|
125
125
|
- test/test_starter.rb
|
126
|
+
- test/test_versions.rb
|
126
127
|
homepage: https://github.com/rake-compiler/rake-compiler-dock
|
127
128
|
licenses:
|
128
129
|
- MIT
|
@@ -162,3 +163,4 @@ test_files:
|
|
162
163
|
- test/test_environment_variables.rb
|
163
164
|
- test/test_parallel_docker_build.rb
|
164
165
|
- test/test_starter.rb
|
166
|
+
- test/test_versions.rb
|