rake-compiler-dock 0.7.0 → 1.1.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 (33) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.gitignore +4 -0
  5. data/Dockerfile.jruby +12 -8
  6. data/Dockerfile.mri.erb +231 -0
  7. data/History.md +56 -0
  8. data/README.md +86 -15
  9. data/Rakefile +44 -4
  10. data/{lib/rake_compiler_dock → build}/gem_helper.rb +0 -15
  11. data/build/parallel_docker_build.rb +102 -0
  12. data/build/patches/{ruby-2.5.3 → ruby-2.5.8}/no_sendfile.patch +1 -1
  13. data/build/patches/ruby-3.0.0/no_sendfile.patch +24 -0
  14. data/build/patches2/hoe-3.20.0/0001-Load-encrypted-private-key-using-ENV-GEM_PRIVATE_KEY.patch +32 -0
  15. data/build/patches2/rake-compiler-1.1.1/0001-Fix-determining-of-ruby-versions-in-rake-native-gem.patch +44 -0
  16. data/build/patches2/rake-compiler-1.1.1/0003-Allow-building-of-cross-rubies-in-parallel.patch +214 -0
  17. data/build/patches2/rake-compiler-1.1.1/0004-Enable-build-of-static-libruby.patch +29 -0
  18. data/build/patches2/rake-compiler-1.1.1/0005-Don-t-mask-out-build-env-vars-for-cross-ruby.patch +30 -0
  19. data/build/patches2/rake-compiler-1.1.1/0006-Use-RAKE_EXTENSION_TASK_NO_NATIVE-env-var-as-the-def.patch +26 -0
  20. data/build/patches2/ruby-2.7.0/ruby2_keywords.patch +15 -0
  21. data/build/patches2/ruby-3.0.0/ruby2_keywords.patch +15 -0
  22. data/build/runas +4 -1
  23. data/build/sudoers +1 -1
  24. data/lib/rake_compiler_dock.rb +10 -0
  25. data/lib/rake_compiler_dock/docker_check.rb +12 -6
  26. data/lib/rake_compiler_dock/starter.rb +68 -53
  27. data/lib/rake_compiler_dock/version.rb +2 -2
  28. data/test/test_environment_variables.rb +2 -2
  29. data/test/test_parallel_docker_build.rb +57 -0
  30. metadata +35 -25
  31. metadata.gz.sig +0 -0
  32. data/Dockerfile.mri +0 -122
  33. data/build/patches/rake-compiler-1.0.6/enable-static.diff +0 -13
data/Rakefile CHANGED
@@ -1,13 +1,53 @@
1
+ require 'erb'
2
+ require "rake/clean"
1
3
  require "rake_compiler_dock"
2
- require "rake_compiler_dock/gem_helper"
4
+ require_relative "build/gem_helper"
5
+ require_relative "build/parallel_docker_build"
3
6
 
4
7
  RakeCompilerDock::GemHelper.install_tasks
5
8
 
6
- task :build do
7
- sh "docker build -t larskanis/rake-compiler-dock-mri:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.mri ."
8
- sh "docker build -t larskanis/rake-compiler-dock-jruby:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.jruby ."
9
+ DOCKERHUB_USER = ENV['DOCKERHUB_USER'] || "larskanis"
10
+
11
+ 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
+ ]
20
+ platforms.each do |platform, target|
21
+ sdf = "Dockerfile.mri.#{platform}"
22
+
23
+ desc "Build image for platform #{platform}"
24
+ task platform => sdf
25
+ task sdf do
26
+ sh "docker build -t #{DOCKERHUB_USER}/rake-compiler-dock-mri-#{platform}:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.mri.#{platform} ."
27
+ end
28
+
29
+ df = ERB.new(File.read("Dockerfile.mri.erb")).result(binding)
30
+ File.write(sdf, df)
31
+ CLEAN.include(sdf)
32
+ end
33
+
34
+ desc "Build image for JRuby"
35
+ task :jruby => "Dockerfile.jruby"
36
+ task "Dockerfile.jruby" do
37
+ sh "docker build -t #{DOCKERHUB_USER}/rake-compiler-dock-jruby:#{RakeCompilerDock::IMAGE_VERSION} -f Dockerfile.jruby ."
38
+ end
39
+
40
+ RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "Dockerfile.mri.#{pl}" } + ["Dockerfile.jruby"], workdir: "tmp/docker")
41
+
42
+ desc "Build images for all MRI platforms in parallel"
43
+ multitask :mri => platforms.map(&:first)
44
+
45
+ desc "Build images for all platforms in parallel"
46
+ multitask :all => platforms.map(&:first) + ["jruby"]
9
47
  end
10
48
 
49
+ task :build => "build:all"
50
+
11
51
  desc "Run tests"
12
52
  task :test do
13
53
  sh "ruby -w -W2 -I. -Ilib -e \"#{Dir["test/test_*.rb"].map{|f| "require '#{f}';"}.join}\" -- -v"
@@ -1,18 +1,3 @@
1
- # This file is part of Libusb for Ruby.
2
- #
3
- # Libusb for Ruby is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU Lesser General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # Libusb for Ruby is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU Lesser General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU Lesser General Public License
14
- # along with Libusb for Ruby. If not, see <http://www.gnu.org/licenses/>.
15
-
16
1
  require "bundler/gem_helper"
17
2
 
18
3
  module RakeCompilerDock
@@ -0,0 +1,102 @@
1
+ require "fileutils"
2
+ require "rake"
3
+
4
+ module RakeCompilerDock
5
+ # Run docker builds in parallel, but ensure that common docker layers are reused
6
+ class ParallelDockerBuild
7
+ include Rake::DSL
8
+
9
+ def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-")
10
+ FileUtils.mkdir_p(workdir)
11
+
12
+ files = parse_dockerfiles(dockerfiles, inputdir)
13
+ # pp files
14
+
15
+ vcs = find_commons(files)
16
+ # pp vcs
17
+
18
+ define_common_tasks(vcs, workdir, task_prefix)
19
+ end
20
+
21
+ # Read given dockerfiles from inputdir and split into a list of commands.
22
+ #
23
+ # Returns:
24
+ # {"File0"=>[" FROM a\n", " RUN a\n", " RUN d\n"],
25
+ # "File1"=>[" FROM a\n",
26
+ # ...
27
+ def parse_dockerfiles(dockerfiles, inputdir)
28
+ files = dockerfiles.map do |fn|
29
+ [fn, File.read(File.join(inputdir, fn))]
30
+ end.map do |fn, f|
31
+ # Split file contant in lines unless line ends with backslash
32
+ fc = f.each_line.with_object([]) do |line, lines|
33
+ if lines.last=~/\\\n\z/
34
+ lines.last << line
35
+ else
36
+ lines << line
37
+ end
38
+ end
39
+ [fn, fc]
40
+ end.to_h
41
+ end
42
+
43
+ # Build a tree of common parts of given files.
44
+ #
45
+ # Returns:
46
+ # {["File0", "File1", "File2", "File3"]=>
47
+ # [[" FROM a\n"],
48
+ # {["File0", "File1"]=>
49
+ # [[" RUN a\n", " RUN d\n"], {["File1"]=>[[" RUN f\n"], {}]}],
50
+ # ["File2", "File3"]=>[[" RUN b\n", " RUN c\n", " RUN d\n"], {}]}]}
51
+ def find_commons(files, vmask=nil, li=0)
52
+ vmask ||= files.keys
53
+ vcs = Hash.new { [] }
54
+ files.each do |fn, lines|
55
+ next unless vmask.include?(fn)
56
+ vcs[lines[li]] += [fn]
57
+ end
58
+
59
+ vcs.map do |line, vc|
60
+ next unless line
61
+ nvcs = find_commons(files, vc, li+1)
62
+ if nvcs.first && nvcs.first[0] == vc
63
+ # Append lines that are equal between file(s)
64
+ nl = [[line] + nvcs.first[1][0], nvcs.first[1][1]]
65
+ else
66
+ nl = [[line], nvcs]
67
+ end
68
+ [vc, nl]
69
+ end.compact.to_h
70
+ end
71
+
72
+ # Write intermediate dockerfiles to workdir and define rake tasks
73
+ #
74
+ # The rake tasks are named after the dockerfiles given to #new .
75
+ # This also adds dependant intermediate tasks as prerequisites.
76
+ def define_common_tasks(vcs, workdir, task_prefix, plines=[])
77
+ vcs.map do |files, (lines, nvcs)|
78
+ fn = "#{task_prefix}#{files.join}"
79
+ File.write(File.join(workdir, fn), (plines + lines).join)
80
+ task fn do
81
+ docker_build(fn, workdir)
82
+ end
83
+
84
+ nfn = define_common_tasks(nvcs, workdir, task_prefix, plines + lines)
85
+ nfn.each do |file|
86
+ task file => fn
87
+ end
88
+ files.each do |file|
89
+ task file => fn
90
+ end
91
+ fn
92
+ end
93
+ end
94
+
95
+ # Run an intermediate dockerfile without tag
96
+ #
97
+ # The layers will be reused in subsequent builds, even if they run in parallel.
98
+ def docker_build(filename, workdir)
99
+ sh "docker", "build", "-f", File.join(workdir, filename), "."
100
+ end
101
+ end
102
+ end
@@ -17,7 +17,7 @@ index 82c5940538..a8d3661ec8 100644
17
17
  @@ -10721,7 +10721,6 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
18
18
  }
19
19
 
20
- #if defined __linux__ && defined __NR_copy_file_range
20
+ #if defined HAVE_COPY_FILE_RANGE || (defined __linux__ && defined __NR_copy_file_range)
21
21
  -# define USE_COPY_FILE_RANGE
22
22
  #endif
23
23
 
@@ -0,0 +1,24 @@
1
+ diff --git a/configure b/configure
2
+ index ebe3d8c..a336b73 100755
3
+ --- a/configure
4
+ +++ b/configure
5
+ @@ -18943,7 +18943,6 @@ do :
6
+ ac_fn_c_check_func "$LINENO" "sendfile" "ac_cv_func_sendfile"
7
+ if test "x$ac_cv_func_sendfile" = xyes; then :
8
+ cat >>confdefs.h <<_ACEOF
9
+ -#define HAVE_SENDFILE 1
10
+ _ACEOF
11
+
12
+ fi
13
+ diff --git a/io.c b/io.c
14
+ index 48592ac51a..2635ac8ec6 100644
15
+ --- a/io.c
16
+ +++ b/io.c
17
+ @@ -11111,6 +11111,7 @@ nogvl_copy_stream_wait_write(struct copy_stream_struct *stp)
18
+ return 0;
19
+ }
20
+
21
+ +#undef USE_COPY_FILE_RANGE
22
+ #ifdef USE_COPY_FILE_RANGE
23
+
24
+ static ssize_t
@@ -0,0 +1,32 @@
1
+ From ecc5669223457ceaba6bd94c2947ae99ddfa8f10 Mon Sep 17 00:00:00 2001
2
+ From: Lars Kanis <lars@greiz-reinsdorf.de>
3
+ Date: Fri, 27 Dec 2019 15:57:07 +0100
4
+ Subject: [PATCH] Load encrypted private key using
5
+ ENV['GEM_PRIVATE_KEY_PASSPHRASE'] as passphrase.
6
+
7
+ This way the password can be avoided to be entered several times when building multiple gems.
8
+ It also allows parallel builds which are incompatible to interactive password prompts.
9
+
10
+ The same feature has been implemented in rubygems:
11
+ https://github.com/rubygems/rubygems/commit/c1a114396fcec124d3feabf74708b4bdec02eac3
12
+ ---
13
+ lib/hoe/signing.rb | 3 ++-
14
+ 1 file changed, 2 insertions(+), 1 deletion(-)
15
+
16
+ diff --git a/lib/hoe/signing.rb b/lib/hoe/signing.rb
17
+ index 4833c55..11c8c2f 100644
18
+ --- a/lib/hoe/signing.rb
19
+ +++ b/lib/hoe/signing.rb
20
+ @@ -70,7 +70,8 @@ module Hoe::Signing
21
+ end
22
+
23
+ if signing_key and cert_chain then
24
+ - spec.signing_key = OpenSSL::PKey::RSA.new File.read signing_key
25
+ + passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
26
+ + spec.signing_key = OpenSSL::PKey::RSA.new(File.read(signing_key), passphrase)
27
+ spec.cert_chain = cert_chain
28
+ end
29
+ end
30
+ --
31
+ 2.20.1
32
+
@@ -0,0 +1,44 @@
1
+ From 365843bfe0bfc3f1c1b11e81e24ac7b6c7942bdf Mon Sep 17 00:00:00 2001
2
+ From: Lars Kanis <lars@greiz-reinsdorf.de>
3
+ Date: Fri, 27 Dec 2019 18:18:59 +0100
4
+ Subject: [PATCH] Fix determining of ruby versions in "rake native gem"
5
+
6
+ "rake native gem" without "cross" didn't set the ruby version constraint.
7
+ Instead it failed with NoMethodError like so:
8
+
9
+ /ffi $ rake native gem
10
+ no configuration section for specified version of Ruby (rbconfig-i386-mingw32-2.6.3)
11
+ no configuration section for specified version of Ruby (rbconfig-x64-mingw32-2.6.3)
12
+ install -c build/x86_64-linux/ffi_c/2.6.3/ffi_c.so lib/ffi_c.so
13
+ cp build/x86_64-linux/ffi_c/2.6.3/ffi_c.so build/x86_64-linux/stage/lib/ffi_c.so
14
+ rake aborted!
15
+ NoMethodError: undefined method `split' for nil:NilClass
16
+ /home/lars/.rvm/gems/ruby-2.6.3/gems/rake-compiler-1.0.9/lib/rake/extensiontask.rb:515:in `ruby_api_version'
17
+ /home/lars/.rvm/gems/ruby-2.6.3/gems/rake-compiler-1.0.9/lib/rake/extensiontask.rb:262:in `block in define_native_tasks'
18
+ /home/lars/.rvm/gems/ruby-2.6.3/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
19
+ /home/lars/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
20
+ /home/lars/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
21
+ Tasks: TOP => native => native:x86_64-linux => native:ffi:x86_64-linux
22
+ (See full trace by running task with --trace)
23
+ ---
24
+ lib/rake/extensiontask.rb | 4 ++++
25
+ 1 file changed, 4 insertions(+)
26
+
27
+ diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb
28
+ index d85b1a3..cb1ea12 100644
29
+ --- a/lib/rake/extensiontask.rb
30
+ +++ b/lib/rake/extensiontask.rb
31
+ @@ -242,6 +242,10 @@ Java extension should be preferred.
32
+ # lib_path
33
+ lib_path = lib_dir
34
+
35
+ + # Update compiled platform/version combinations
36
+ + ruby_versions = (@ruby_versions_per_platform[platf] ||= [])
37
+ + ruby_versions << ruby_ver
38
+ +
39
+ # create 'native:gem_name' and chain it to 'native' task
40
+ unless Rake::Task.task_defined?("native:#{@gem_spec.name}:#{platf}")
41
+ task "native:#{@gem_spec.name}:#{platf}" do |t|
42
+ --
43
+ 2.20.1
44
+
@@ -0,0 +1,214 @@
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
+