rake-compiler-dock 1.1.0 → 1.2.0

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 (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
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # rake-compiler-dock
2
2
 
3
- **Easy to use and reliable cross compiler environment for building Windows, Linux and JRuby binary gems.**
3
+ **Easy to use and reliable cross compiler environment for building Windows, Linux, Mac and JRuby binary gems.**
4
4
 
5
- It provides cross compilers and Ruby environments for 2.2 and newer versions of the [RubyInstaller](http://rubyinstaller.org/) and Linux runtime environments.
5
+ It provides cross compilers and Ruby environments for 2.4 and newer versions of the [RubyInstaller](http://rubyinstaller.org/) and Linux runtime environments.
6
6
  They are prepared for use with [rake-compiler](https://github.com/rake-compiler/rake-compiler).
7
7
  It is used by [many gems with C or JRuby extentions](https://github.com/rake-compiler/rake-compiler-dock/wiki/Projects-using-rake-compiler-dock).
8
8
 
@@ -12,11 +12,7 @@ It is also more reliable, since the underlying docker images are versioned and i
12
12
 
13
13
  ## Installation
14
14
 
15
- Install docker natively on Linux:
16
-
17
- $ sudo apt-get install docker.io
18
-
19
- ... or install [docker-toolbox for Windows and OSX](https://github.com/docker/toolbox/releases) or boot2docker on [Windows](https://github.com/boot2docker/windows-installer/releases) or [OS X](https://github.com/boot2docker/osx-installer/releases) .
15
+ Install docker [following the instructions on the docker website](https://docs.docker.com/engine/install/) ... or install [docker-toolbox for Windows and OSX](https://github.com/docker/toolbox/releases) or boot2docker on [Windows](https://github.com/boot2docker/windows-installer/releases) or [OS X](https://github.com/boot2docker/osx-installer/releases) .
20
16
 
21
17
  Install rake-compiler-dock as a gem. The docker image is downloaded later on demand:
22
18
 
@@ -34,10 +30,12 @@ Rake-compiler-dock provides the necessary tools to build Ruby extensions for Win
34
30
  It is intended to be used in conjunction with [rake-compiler's](https://github.com/rake-compiler/rake-compiler) cross build capability.
35
31
  Your Rakefile should enable cross compilation like so:
36
32
 
37
- exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
38
- ext.cross_compile = true
39
- ext.cross_platform = %w[x86-mingw32 x64-mingw32 x86-linux x86_64-linux]
40
- end
33
+ ```ruby
34
+ exttask = Rake::ExtensionTask.new('my_extension', my_gem_spec) do |ext|
35
+ ext.cross_compile = true
36
+ ext.cross_platform = %w[x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux x86_64-darwin arm64-darwin]
37
+ end
38
+ ```
41
39
 
42
40
  See below, how to invoke cross builds in your Rakefile.
43
41
 
@@ -46,7 +44,9 @@ Additionally it may also be used to build ffi based binary gems like [libusb](ht
46
44
  ### Interactive Usage
47
45
 
48
46
  Rake-compiler-dock offers the shell command `rake-compiler-dock` and a [ruby API](http://www.rubydoc.info/gems/rake-compiler-dock/RakeCompilerDock) for issuing commands within the docker image, described below.
49
- There dedicated are images for `x86-mingw32`, `x64-mingw32`, `x86-linux`, `x86_64-linux` and `jruby` targets.
47
+ There are dedicated images for `x86-mingw32`, `x64-mingw-ucrt`, `x64-mingw32`, `x86-linux`, `x86_64-linux`, `x86_64-darwin`, `arm64-darwin` and `jruby` targets.
48
+ The images contain all supported cross ruby versions, with the exception of `x64-mingw32`, which has versions before 3.1 only, and `x64-mingw-ucrt`, which has only ruby-3.1+.
49
+ This is to match the [changed platform of RubyInstaller-3.1](https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html).
50
50
 
51
51
  `rake-compiler-dock` without arguments starts an interactive shell session.
52
52
  This is best suited to try out and debug a build.
@@ -81,13 +81,64 @@ Or non-interactive:
81
81
 
82
82
  The environment variable `RUBY_CC_VERSION` is predefined as described [below](#environment-variables).
83
83
 
84
- If necessary, additional software from the Ubuntu repositories can be installed, prior to the build command.
85
- This is local to the running session, only:
84
+ If necessary, additional software can be installed, prior to the build command.
85
+ This is local to the running session, only.
86
+
87
+ For Windows and Mac:
86
88
 
87
89
  sudo apt-get update && sudo apt-get install your-package
88
90
 
91
+ For Linux:
92
+
93
+ sudo yum install your-package
94
+
89
95
  You can also choose between different executable ruby versions by `rvm use <version>` .
90
- The current default is 2.5.
96
+ The current default is 3.1.
97
+
98
+
99
+ ### As a CI System Container
100
+
101
+ The OCI images provided by rake-compiler-dock can be used without the `rake-compiler-dock` gem or wrapper. This may be useful if your CI pipeline is building native gems.
102
+
103
+ For example, a Github Actions job might look like this:
104
+
105
+ ``` yaml
106
+ jobs:
107
+ native-gem:
108
+ name: "native-gem"
109
+ runs-on: ubuntu-latest
110
+ container:
111
+ image: "larskanis/rake-compiler-dock-mri-x86_64-linux:1.2.0"
112
+ steps:
113
+ - uses: actions/checkout@v2
114
+ - run: bundle install && bundle exec rake gem:x86_64-linux:rcd
115
+ - uses: actions/upload-artifact@v2
116
+ with:
117
+ name: native-gem
118
+ path: gems
119
+ retention-days: 1
120
+ ```
121
+
122
+ Where the referenced rake task might be defined by:
123
+
124
+ ``` ruby
125
+ cross_platforms = ["x64-mingw32", "x86_64-linux", "x86_64-darwin", "arm64-darwin"]
126
+
127
+ namespace "gem" do
128
+ cross_platforms.each do |platform|
129
+ namespace platform do
130
+ task "rcd" do
131
+ Rake::Task["native:#{platform}"].invoke
132
+ Rake::Task["pkg/#{rcee_precompiled_spec.full_name}-#{Gem::Platform.new(platform)}.gem"].invoke
133
+ end
134
+ end
135
+ end
136
+ end
137
+
138
+ ```
139
+
140
+ For an example of rake tasks that support this style of invocation, visit https://github.com/flavorjones/ruby-c-extensions-explained/tree/main/precompiled
141
+
91
142
 
92
143
  ### JRuby support
93
144
 
@@ -111,17 +162,19 @@ To build java binary gems interactively, it can be called like this:
111
162
  To make the build process reproducible for other parties, it is recommended to add rake-compiler-dock to your Rakefile.
112
163
  This can be done like this:
113
164
 
114
- task 'gem:native' do
115
- require 'rake_compiler_dock'
116
- sh "bundle package" # Avoid repeated downloads of gems by using gem files from the host.
117
- %w[ x86-mingw32 x64-mingw32 x86-linux x86_64-linux ].each do |plat|
118
- RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
119
- end
120
- RakeCompilerDock.sh "bundle --local && rake java gem", rubyvm: :jruby
121
- end
165
+ ```ruby
166
+ task 'gem:native' do
167
+ require 'rake_compiler_dock'
168
+ sh "bundle package --all" # Avoid repeated downloads of gems by using gem files from the host.
169
+ %w[ x86-mingw32 x64-mingw-ucrt x64-mingw32 x86-linux x86_64-linux arm-linux aarch64-linux x86_64-darwin arm64-darwin ].each do |plat|
170
+ RakeCompilerDock.sh "bundle --local && rake native:#{plat} gem", platform: plat
171
+ end
172
+ RakeCompilerDock.sh "bundle --local && rake java gem", rubyvm: :jruby
173
+ end
174
+ ```
122
175
 
123
176
  This runs the `bundle` and `rake` commands once for each platform.
124
- That is once for the jruby gems and 4 times for the specified MRI platforms.
177
+ That is once for the jruby gems and 6 times for the specified MRI platforms.
125
178
 
126
179
  ### Run builds in parallel
127
180
 
@@ -133,17 +186,19 @@ Please note, that parallel builds only work reliable, if the specific platform g
133
186
 
134
187
  ```ruby
135
188
  namespace "gem" do
189
+ task 'prepare' do
190
+ require 'rake_compiler_dock'
191
+ require 'io/console'
192
+ sh "bundle package --all"
193
+ sh "cp ~/.gem/gem-*.pem build/gem/ || true"
194
+ ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
195
+ end
196
+
136
197
  exttask.cross_platform.each do |plat|
137
- desc "Build the native binary gems"
198
+ desc "Build all native binary gems in parallel"
138
199
  multitask 'native' => plat
139
200
 
140
- task 'prepare' do
141
- require 'rake_compiler_dock'
142
- sh "cp ~/.gem/gem-*.pem build/gem/ || true"
143
- require 'io/console'
144
- ENV["GEM_PRIVATE_KEY_PASSPHRASE"] = STDIN.getpass("Enter passphrase of gem signature key: ")
145
- end
146
-
201
+ desc "Build the native gem for #{plat}"
147
202
  task plat => 'prepare' do
148
203
  RakeCompilerDock.sh <<-EOT, platform: plat
149
204
  (cp build/gem/gem-*.pem ~/.gem/ || true) &&
@@ -159,7 +214,9 @@ Please note, that parallel builds only work reliable, if the specific platform g
159
214
 
160
215
  Rake-compiler-dock uses [semantic versioning](http://semver.org/), so you should add it into your Gemfile, to make sure, that future changes will not break your build.
161
216
 
162
- gem 'rake-compiler-dock', '~> 1.0'
217
+ ```ruby
218
+ gem 'rake-compiler-dock', '~> 1.2'
219
+ ```
163
220
 
164
221
  See [the wiki](https://github.com/rake-compiler/rake-compiler-dock/wiki/Projects-using-rake-compiler-dock) for projects which make use of rake-compiler-dock.
165
222
 
@@ -173,7 +230,7 @@ The following variables are recognized by rake-compiler-dock:
173
230
  * `RCD_RUBYVM` - The ruby VM and toolchain to be used.
174
231
  Must be one of `mri`, `jruby`.
175
232
  * `RCD_PLATFORM` - The target rubygems platform.
176
- Must be a space separated list out of `x86-mingw32`, `x64-mingw32`, `x86-linux` and `x86_64-linux`.
233
+ Must be a space separated list out of `x86-mingw32`, `x64-mingw-ucrt`, `x64-mingw32`, `x86-linux`, `x86_64-linux`, `arm-linux`, `aarch64-linux`, `x86_64-darwin` and `arm64-darwin`.
177
234
  It is ignored when `rubyvm` is set to `:jruby`.
178
235
  * `RCD_IMAGE` - The docker image that is downloaded and started.
179
236
  Defaults to "larskanis/rake-compiler-dock:IMAGE_VERSION" with an image version that is determined by the gem version.
@@ -189,7 +246,7 @@ The following variables are provided to the running docker container:
189
246
  * `RCD_HOST_RUBY_PLATFORM` - The `RUBY_PLATFORM` of the host ruby.
190
247
  * `RCD_HOST_RUBY_VERSION` - The `RUBY_VERSION` of the host ruby.
191
248
  * `RUBY_CC_VERSION` - The target ruby versions for rake-compiler.
192
- The default is defined in the [Dockerfile](https://github.com/rake-compiler/rake-compiler-dock/blob/master/Dockerfile), but can be changed as a parameter to rake.
249
+ The default is defined in the [Dockerfile](https://github.com/rake-compiler/rake-compiler-dock/blob/94770238d68d71df5f70abe76097451a575ce46c/Dockerfile.mri.erb#L229), but can be changed as a parameter to rake.
193
250
  * `RCD_MOUNTDIR` - The directory which is mounted into the docker container.
194
251
  Defaults to pwd.
195
252
  * `RCD_WORKDIR` - The working directory within the docker container.
@@ -197,7 +254,9 @@ The following variables are provided to the running docker container:
197
254
 
198
255
  Other environment variables can be set or passed through to the container like this:
199
256
 
200
- RakeCompilerDock.sh "rake cross native gem OPENSSL_VERSION=#{ENV['OPENSSL_VERSION']}"
257
+ ```ruby
258
+ RakeCompilerDock.sh "rake cross native gem OPENSSL_VERSION=#{ENV['OPENSSL_VERSION']}"
259
+ ```
201
260
 
202
261
 
203
262
  ## More information
data/Rakefile CHANGED
@@ -7,26 +7,32 @@ require_relative "build/parallel_docker_build"
7
7
  RakeCompilerDock::GemHelper.install_tasks
8
8
 
9
9
  DOCKERHUB_USER = ENV['DOCKERHUB_USER'] || "larskanis"
10
+ docker_build_cmd = Shellwords.split(ENV['RCD_DOCKER_BUILD'] || "docker build")
11
+
12
+ platforms = [
13
+ ["x86-mingw32", "i686-w64-mingw32"],
14
+ ["x64-mingw32", "x86_64-w64-mingw32"],
15
+ ["x64-mingw-ucrt", "x86_64-w64-mingw32"],
16
+ ["x86-linux", "i686-redhat-linux"],
17
+ ["x86_64-linux", "x86_64-redhat-linux"],
18
+ ["x86_64-darwin", "x86_64-apple-darwin"],
19
+ ["arm64-darwin", "aarch64-apple-darwin"],
20
+ ["arm-linux", "arm-linux-gnueabihf"],
21
+ ["aarch64-linux", "aarch64-linux-gnu"],
22
+ ]
10
23
 
11
24
  namespace :build do
12
- platforms = [
13
- ["x86-mingw32", "i686-w64-mingw32"],
14
- ["x64-mingw32", "x86_64-w64-mingw32"],
15
- ["x86-linux", "i686-redhat-linux"],
16
- ["x86_64-linux", "x86_64-redhat-linux"],
17
- ["x86_64-darwin", "x86_64-apple-darwin"],
18
- ["arm64-darwin", "aarch64-apple-darwin"],
19
- ]
25
+
20
26
  platforms.each do |platform, target|
21
27
  sdf = "Dockerfile.mri.#{platform}"
22
28
 
23
29
  desc "Build image for platform #{platform}"
24
30
  task platform => sdf
25
31
  task sdf do
26
- sh "docker build -t #{DOCKERHUB_USER}/rake-compiler-dock-mri-#{platform}:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.mri.#{platform} ."
32
+ sh(*docker_build_cmd, "-t", "#{DOCKERHUB_USER}/rake-compiler-dock-mri-#{platform}:#{RakeCompilerDock::IMAGE_VERSION}", "-f", "Dockerfile.mri.#{platform}", ".")
27
33
  end
28
34
 
29
- df = ERB.new(File.read("Dockerfile.mri.erb")).result(binding)
35
+ df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding)
30
36
  File.write(sdf, df)
31
37
  CLEAN.include(sdf)
32
38
  end
@@ -34,10 +40,10 @@ namespace :build do
34
40
  desc "Build image for JRuby"
35
41
  task :jruby => "Dockerfile.jruby"
36
42
  task "Dockerfile.jruby" do
37
- sh "docker build -t #{DOCKERHUB_USER}/rake-compiler-dock-jruby:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.jruby ."
43
+ sh(*docker_build_cmd, "-t", "#{DOCKERHUB_USER}/rake-compiler-dock-jruby:#{RakeCompilerDock::IMAGE_VERSION}", "-f", "Dockerfile.jruby", ".")
38
44
  end
39
45
 
40
- RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "Dockerfile.mri.#{pl}" } + ["Dockerfile.jruby"], workdir: "tmp/docker")
46
+ RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "Dockerfile.mri.#{pl}" } + ["Dockerfile.jruby"], workdir: "tmp/docker", docker_build_cmd: docker_build_cmd)
41
47
 
42
48
  desc "Build images for all MRI platforms in parallel"
43
49
  multitask :mri => platforms.map(&:first)
@@ -48,6 +54,14 @@ end
48
54
 
49
55
  task :build => "build:all"
50
56
 
57
+ namespace :prepare do
58
+ desc "Build cross compiler for x64-mingw-ucrt aka RubyInstaller-3.1+"
59
+ task "mingw64-ucrt" do
60
+ sh(*docker_build_cmd, "-t", "#{DOCKERHUB_USER}/mingw64-ucrt:20.04", ".",
61
+ chdir: "mingw64-ucrt")
62
+ end
63
+ end
64
+
51
65
  desc "Run tests"
52
66
  task :test do
53
67
  sh "ruby -w -W2 -I. -Ilib -e \"#{Dir["test/test_*.rb"].map{|f| "require '#{f}';"}.join}\" -- -v"
@@ -74,3 +88,16 @@ task :update_lists do
74
88
  EOT
75
89
  end
76
90
  end
91
+
92
+ namespace :release do
93
+ desc "push all docker images"
94
+ task :images do
95
+ jimg = "#{DOCKERHUB_USER}/rake-compiler-dock-jruby:#{RakeCompilerDock::IMAGE_VERSION}"
96
+ sh "docker", "push", jimg
97
+
98
+ platforms.each do |platform, _|
99
+ img = "#{DOCKERHUB_USER}/rake-compiler-dock-mri-#{platform}:#{RakeCompilerDock::IMAGE_VERSION}"
100
+ sh "docker", "push", img
101
+ end
102
+ end
103
+ end
@@ -6,7 +6,11 @@ module RakeCompilerDock
6
6
  class ParallelDockerBuild
7
7
  include Rake::DSL
8
8
 
9
- def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-")
9
+ attr_reader :docker_build_cmd
10
+
11
+ def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-",
12
+ docker_build_cmd: %w["docker", "build"])
13
+ @docker_build_cmd = docker_build_cmd
10
14
  FileUtils.mkdir_p(workdir)
11
15
 
12
16
  files = parse_dockerfiles(dockerfiles, inputdir)
@@ -25,7 +29,7 @@ module RakeCompilerDock
25
29
  # "File1"=>[" FROM a\n",
26
30
  # ...
27
31
  def parse_dockerfiles(dockerfiles, inputdir)
28
- files = dockerfiles.map do |fn|
32
+ dockerfiles.map do |fn|
29
33
  [fn, File.read(File.join(inputdir, fn))]
30
34
  end.map do |fn, f|
31
35
  # Split file contant in lines unless line ends with backslash
@@ -96,7 +100,7 @@ module RakeCompilerDock
96
100
  #
97
101
  # The layers will be reused in subsequent builds, even if they run in parallel.
98
102
  def docker_build(filename, workdir)
99
- sh "docker", "build", "-f", File.join(workdir, filename), "."
103
+ sh(*docker_build_cmd, "-f", File.join(workdir, filename), ".")
100
104
  end
101
105
  end
102
106
  end
@@ -1,8 +1,8 @@
1
1
  diff --git a/tasks/bin/cross-ruby.rake b/tasks/bin/cross-ruby.rake
2
- index 8edf5cd..5d25b82 100644
2
+ index 8317a2a..5a1b3ea 100644
3
3
  --- a/tasks/bin/cross-ruby.rake
4
4
  +++ b/tasks/bin/cross-ruby.rake
5
- @@ -116,11 +116,22 @@ RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
5
+ @@ -116,10 +116,22 @@ RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
6
6
  "--host=#{mingw_host}",
7
7
  "--target=#{mingw_target}",
8
8
  "--build=#{RUBY_BUILD}",
@@ -11,7 +11,6 @@ index 8edf5cd..5d25b82 100644
11
11
  + '--disable-jit-support',
12
12
  '--disable-install-doc',
13
13
  '--with-ext=',
14
- - 'LDFLAGS=-pipe -s',
15
14
  ]
16
15
  + if mingw_host=~/darwin/
17
16
  + options += [
@@ -24,6 +23,6 @@ index 8edf5cd..5d25b82 100644
24
23
  + '--enable-shared',
25
24
  + ]
26
25
  + end
27
-
26
+
28
27
  # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
29
28
  options << "--with-winsock2" if major == "1.8"
data/build/rcd-env.sh ADDED
@@ -0,0 +1,6 @@
1
+ # set up a working RCD build environment
2
+ export RAKE_EXTENSION_TASK_NO_NATIVE=true
3
+ if ! test -e "$HOME"/.rake-compiler ; then
4
+ ln -s /usr/local/rake-compiler "$HOME"/.rake-compiler
5
+ fi
6
+ mkdir -p "$HOME"/.gem
data/build/runas CHANGED
@@ -4,12 +4,4 @@ groupadd -o -g "$GID" "$GROUP"
4
4
  mkdir -p /tmp/home
5
5
  useradd -o -g "$GID" -u "$UID" -G rvm,sudo -p "" -b /tmp/home -m "$USER"
6
6
 
7
- HOME=$(bash <<< "echo ~$USER")
8
- ln -s /usr/local/rake-compiler "$HOME"/.rake-compiler
9
- mkdir -p "$HOME"/.gem
10
- chown "$USER" "$HOME"/.gem
11
-
12
- /usr/bin/sudo -u "$USER" -H \
13
- BASH_ENV=/etc/rubybashrc \
14
- RAKE_EXTENSION_TASK_NO_NATIVE=true \
15
- -- "$@"
7
+ /usr/bin/sudo -u "$USER" -H BASH_ENV=/etc/rubybashrc -- "$@"
@@ -41,11 +41,12 @@ module RakeCompilerDock
41
41
  user = options.fetch(:username){ current_user }
42
42
  group = options.fetch(:groupname){ current_group }
43
43
  rubyvm = options.fetch(:rubyvm){ ENV['RCD_RUBYVM'] } || "mri"
44
+ jrubyvm = rubyvm.to_s == "jruby"
44
45
 
45
- platforms = options.fetch(:platform){ ENV['RCD_PLATFORM'] } || "x86-mingw32 x64-mingw32"
46
+ platforms = options.fetch(:platform){ ENV['RCD_PLATFORM'] } || (jrubyvm ? "jruby" : "x86-mingw32 x64-mingw32")
46
47
  platforms.split(" ").each do |platform|
47
48
  image_name = options.fetch(:image) do
48
- platform_postfix = rubyvm.to_s == "jruby" ? "" : "-#{platform}"
49
+ platform_postfix = jrubyvm ? "" : "-#{platform}"
49
50
  ENV['RCD_IMAGE'] ||
50
51
  ENV['RAKE_COMPILER_DOCK_IMAGE'] ||
51
52
  "larskanis/rake-compiler-dock-#{rubyvm}#{platform_postfix}:#{IMAGE_VERSION}"
@@ -1,4 +1,4 @@
1
1
  module RakeCompilerDock
2
- VERSION = "1.1.0"
3
- IMAGE_VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
+ IMAGE_VERSION = "1.2.0"
4
4
  end
@@ -0,0 +1,62 @@
1
+ FROM ubuntu:20.04
2
+
3
+ ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+ RUN set -ex \
6
+ && sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list \
7
+ && apt-get update \
8
+ && apt-get install -y --no-install-recommends \
9
+ build-essential \
10
+ cdbs \
11
+ devscripts \
12
+ equivs \
13
+ fakeroot \
14
+ pkg-config \
15
+ && apt-get clean \
16
+ && rm -rf /tmp/* /var/tmp/*
17
+
18
+ WORKDIR /build
19
+
20
+ # Download mingw sources
21
+ RUN apt-get source mingw-w64-common && \
22
+ cd mingw-w64-* && \
23
+ mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y --no-install-recommends"
24
+
25
+ # Patch build for UCRT and build UCRT enabled deb-packages
26
+ ADD mingw-w64-*.patch ./
27
+ RUN cd mingw-w64-* && \
28
+ cat debian/rules && \
29
+ ls ../mingw-w64-*.patch | xargs -n1 patch --verbose -p1 -i && \
30
+ dpkg-buildpackage -b && \
31
+ rm -rf ../*.ddeb ../*i686* `pwd`
32
+
33
+ # Install UCRT enabled deb-packages
34
+ RUN dpkg -i mingw-w64-common_7.0.0-2_all.deb \
35
+ mingw-w64-tools_7.0.0-2_amd64.deb \
36
+ mingw-w64-x86-64-dev_7.0.0-2_all.deb
37
+
38
+ # Download gcc-binutils sources for mingw
39
+ RUN apt-get source binutils-mingw-w64 && \
40
+ cd binutils-mingw-w64-* && \
41
+ mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y --no-install-recommends"
42
+
43
+ # Build gcc-binutils based on UCRT headers and crt
44
+ ADD binutils-mingw-w64-*.patch ./
45
+ RUN cd binutils-mingw-w64-* && \
46
+ ls ../binutils-mingw-w64-*.patch | xargs -n1 patch --verbose -p1 -i && \
47
+ dpkg-buildpackage -b --jobs=auto && \
48
+ rm -rf ../*.ddeb ../*i686* `pwd`
49
+
50
+ # Download gcc sources for mingw
51
+ RUN apt-get source gcc-mingw-w64 && \
52
+ cd gcc-mingw-w64-* && \
53
+ mk-build-deps -ir -t "apt-get -o Debug::pkgProblemResolver=yes -y --no-install-recommends"
54
+
55
+ # Build gcc (only C and C++) based on UCRT headers and crt
56
+ ADD gcc-mingw-w64-*.patch ./
57
+ RUN cd gcc-mingw-w64-* && \
58
+ ls ../gcc-mingw-w64-*.patch | xargs -n1 patch --verbose -p1 -i && \
59
+ dpkg-buildpackage -b --jobs=auto && \
60
+ rm -rf ../*.ddeb ../*i686* `pwd`
61
+
62
+ RUN ls -l *.deb
@@ -0,0 +1,13 @@
1
+ diff --git a/debian/rules b/debian/rules
2
+ index 4401493..62c8fe4 100755
3
+ --- a/debian/rules
4
+ +++ b/debian/rules
5
+ @@ -91,7 +91,7 @@ override_dh_auto_test-arch:
6
+ unset CFLAGS CPPFLAGS LDFLAGS; \
7
+ env > $(build_dir)/env; \
8
+ for target in $(targets); do \
9
+ - dh_auto_test -B$(build_dir)/$$target; \
10
+ + dh_auto_test -B$(build_dir)/$$target || true; \
11
+ done
12
+
13
+ override_dh_auto_install-arch:
@@ -0,0 +1,13 @@
1
+ diff --git a/debian/rules b/debian/rules
2
+ index 9e7e40c..fa9a8a2 100755
3
+ --- a/debian/rules
4
+ +++ b/debian/rules
5
+ @@ -58,7 +58,7 @@ ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
6
+ INSTALL_TARGET := install-gcc
7
+ else
8
+ # Build the full GCC.
9
+ - languages := c,c++,fortran,objc,obj-c++,ada
10
+ + languages := c,c++
11
+ BUILD_TARGET :=
12
+ INSTALL_TARGET := install install-lto-plugin
13
+ endif
@@ -0,0 +1,22 @@
1
+ diff --git a/debian/rules b/debian/rules
2
+ index 9fb970c..5473839 100755
3
+ --- a/debian/rules
4
+ +++ b/debian/rules
5
+ @@ -94,7 +94,7 @@ build-arch-stamp: $(patsubst %,$(host)~$(host)~tools-%-install-stamp,$(HOST_TOOL
6
+ %~headers-configure-stamp: autoreconf-stamp
7
+ mkdir -p $(call buildfolder,$*~headers) && \
8
+ cd $(call buildfolder,$*~headers) && \
9
+ - $(call sourcefolder,$*~headers)/configure --prefix=/usr/$(call ruletarget,$*~headers) --host=$(call rulehost,$*~headers) --enable-sdk=all --enable-secure-api
10
+ + $(call sourcefolder,$*~headers)/configure --prefix=/usr/$(call ruletarget,$*~headers) --host=$(call rulehost,$*~headers) --enable-sdk=all --with-default-msvcrt=ucrt
11
+ touch $*-headers-configure-stamp
12
+
13
+ # Override CRT configuration to avoid multilib builds
14
+ @@ -108,7 +108,7 @@ target64crt := $(target64)~$(target64)~crt
15
+ $(target64crt)-configure-stamp: $(target64)~$(target64)~headers-install-stamp autoreconf-stamp
16
+ mkdir -p $(call buildfolder,$(target64crt)) && \
17
+ cd $(call buildfolder,$(target64crt)) && \
18
+ - $(call sourcefolder,$(target64crt))/configure --prefix=/usr/$(call ruletarget,$(target64crt)) --host=$(call rulehost,$(target64crt)) --target=$(call ruletarget,$(target64crt)) --disable-lib32 --enable-lib64 CPPFLAGS="$(CPPFLAGS) -I$(top_dir)/debian/tmp/usr/$(call ruletarget,$(target64crt))/include"
19
+ + $(call sourcefolder,$(target64crt))/configure --prefix=/usr/$(call ruletarget,$(target64crt)) --host=$(call rulehost,$(target64crt)) --target=$(call ruletarget,$(target64crt)) --disable-lib32 --enable-lib64 --with-default-msvcrt=ucrt CPPFLAGS="$(CPPFLAGS) -I$(top_dir)/debian/tmp/usr/$(call ruletarget,$(target64crt))/include"
20
+ touch $@
21
+
22
+ build-indep-stamp: $(foreach target,$(targets),$(patsubst %,$(target)~$(target)~%-install-stamp,$(TARGET_PROJECTS))) $(patsubst %,$(target32)~$(target32)~%-install-stamp,$(TARGET32_PROJECTS))
@@ -22,7 +22,7 @@ Use rake-compiler-dock to enter an interactive shell session or add a task to yo
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.7"
26
- spec.add_development_dependency "rake", "~> 12.0"
25
+ spec.add_development_dependency "bundler", ">= 1.7", "< 3.0"
26
+ spec.add_development_dependency "rake", ">= 12"
27
27
  spec.add_development_dependency "test-unit", "~> 3.0"
28
28
  end
@@ -0,0 +1,17 @@
1
+ ARG from_image
2
+ FROM ${from_image}
3
+
4
+ RUN uname -a
5
+ RUN apk add ruby ruby-etc ruby-rake git
6
+
7
+ RUN ruby --version
8
+ RUN gem env
9
+ RUN gem inst bundler
10
+
11
+ WORKDIR /build
12
+
13
+ CMD ruby -e "puts Gem::Platform.local.to_s" && \
14
+ gem install --local *.gem --verbose --no-document && \
15
+ cd test/rcd_test/ && \
16
+ bundle install && \
17
+ rake test
@@ -0,0 +1,17 @@
1
+ ARG from_image
2
+ FROM ${from_image}
3
+
4
+ RUN uname -a
5
+ RUN yum install -y ruby git
6
+
7
+ RUN ruby --version
8
+ RUN gem env
9
+ RUN gem inst bundler
10
+
11
+ WORKDIR /build
12
+
13
+ CMD ruby -e "puts Gem::Platform.local.to_s" && \
14
+ gem install --local *.gem --verbose --no-document && \
15
+ cd test/rcd_test/ && \
16
+ bundle install && \
17
+ rake test
@@ -0,0 +1,24 @@
1
+ ARG from_image
2
+ FROM ${from_image}
3
+
4
+ # To prevent installed tzdata deb package to show interactive dialog.
5
+ ENV DEBIAN_FRONTEND noninteractive
6
+
7
+ RUN uname -a
8
+ RUN apt-get update -qq && \
9
+ apt-get install -yq \
10
+ -o Dpkg::Options::='--force-confnew' \
11
+ ruby \
12
+ git
13
+
14
+ RUN ruby --version
15
+ RUN gem env
16
+ RUN gem inst bundler
17
+
18
+ WORKDIR /build
19
+
20
+ CMD ruby -e "puts Gem::Platform.local.to_s" && \
21
+ gem install --local *.gem --verbose --no-document && \
22
+ cd test/rcd_test/ && \
23
+ bundle install && \
24
+ rake test
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rcd_test.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "rake-compiler"
10
+ gem "rake-compiler-dock"
11
+ gem "minitest", "~> 5.0"