rake-compiler 1.1.1 → 1.1.5

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.
@@ -237,7 +237,7 @@ execute the Rake compilation task using the JRuby interpreter.
237
237
  cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
238
238
  cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
239
239
  jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
240
- rescue => e
240
+ rescue
241
241
  end
242
242
  end
243
243
 
@@ -41,106 +41,104 @@ end
41
41
  require 'rake/extensioncompiler'
42
42
 
43
43
  MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
44
- USER_HOME = File.expand_path("~/.rake-compiler")
45
- RUBY_CC_VERSION = "ruby-" << ENV.fetch("VERSION", "1.8.7-p371")
44
+ USER_HOME = File.realpath(File.expand_path("~/.rake-compiler"))
46
45
  RUBY_SOURCE = ENV['SOURCE']
47
46
  RUBY_BUILD = RbConfig::CONFIG["host"]
48
47
 
49
- # grab the major "1.8" or "1.9" part of the version number
50
- MAJOR = RUBY_CC_VERSION.match(/.*-(\d.\d).\d/)[1]
51
-
52
- # Use Rake::ExtensionCompiler helpers to find the proper host
53
- MINGW_HOST = ENV['HOST'] || Rake::ExtensionCompiler.mingw_host
54
- MINGW_TARGET = MINGW_HOST.gsub('msvc', '')
55
-
56
48
  # Unset any possible variable that might affect compilation
57
- ["CC", "CXX", "CPPFLAGS", "LDFLAGS", "RUBYOPT"].each do |var|
49
+ ["RUBYOPT"].each do |var|
58
50
  ENV.delete(var)
59
51
  end
60
52
 
61
- source_dir = "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
62
- build_dir = "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}"
63
-
64
- # define a location where sources will be stored
65
- directory source_dir
66
- directory build_dir
67
-
68
- # clean intermediate files and folders
69
- CLEAN.include(source_dir)
70
- CLEAN.include(build_dir)
71
-
72
- # remove the final products and sources
73
- CLOBBER.include("#{USER_HOME}/sources")
74
- CLOBBER.include("#{USER_HOME}/builds")
75
- CLOBBER.include("#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
76
- CLOBBER.include("#{USER_HOME}/config.yml")
53
+ RUBY_CC_VERSIONS = ENV.fetch("VERSION", "1.8.7-p371")
54
+ RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
55
+ ruby_cc_version = "ruby-" + ruby_cc_version
56
+ # grab the major "1.8" or "1.9" part of the version number
57
+ major = ruby_cc_version.match(/.*-(\d.\d).\d/)[1]
58
+
59
+ # define a location where sources will be stored
60
+ source_dir = "#{USER_HOME}/sources/#{ruby_cc_version}"
61
+ directory source_dir
62
+ # clean intermediate files and folders
63
+ CLEAN.include(source_dir)
64
+
65
+ # remove the final products and sources
66
+ CLOBBER.include("#{USER_HOME}/sources")
67
+ CLOBBER.include("#{USER_HOME}/builds")
68
+ CLOBBER.include("#{USER_HOME}/config.yml")
69
+
70
+ # Extract the sources
71
+ source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{ruby_cc_version}.tar.gz"
72
+ file source_dir => ["#{USER_HOME}/sources/#{source_file}"] do |t|
73
+ t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}", chdir: File.dirname(t.name) }
74
+ end
77
75
 
78
- # ruby source file should be stored there
79
- file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.bz2" => ["#{USER_HOME}/sources"] do |t|
80
- # download the source file using wget or curl
81
- chdir File.dirname(t.name) do
76
+ # ruby source file should be stored there
77
+ file "#{USER_HOME}/sources/#{ruby_cc_version}.tar.gz" => ["#{USER_HOME}/sources"] do |t|
78
+ # download the source file using wget or curl
82
79
  if RUBY_SOURCE
83
80
  url = RUBY_SOURCE
84
81
  else
85
- url = "http://cache.ruby-lang.org/pub/ruby/#{MAJOR}/#{File.basename(t.name)}"
82
+ url = "http://cache.ruby-lang.org/pub/ruby/#{major}/#{File.basename(t.name)}"
86
83
  end
87
- sh "wget #{url} || curl -O #{url}"
84
+ sh "wget #{url} || curl -O #{url}", chdir: File.dirname(t.name)
88
85
  end
89
- end
90
-
91
- # Extract the sources
92
- source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{RUBY_CC_VERSION}.tar.bz2"
93
- file source_dir => ["#{USER_HOME}/sources/#{source_file}"] do |t|
94
- chdir File.dirname(t.name) do
95
- t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}" }
96
- end
97
- end
98
86
 
99
- task :mingw32 do
100
- unless MINGW_HOST then
101
- warn "You need to install mingw32 cross compile functionality to be able to continue."
102
- warn "Please refer to your distribution/package manager documentation about installation."
103
- fail
104
- end
105
- end
87
+ # Create tasks for each host out of the ":" separated hosts list in the HOST variable.
88
+ # These tasks are processed in parallel as dependencies to the "install" task.
89
+ mingw_hosts = ENV['HOST'] || Rake::ExtensionCompiler.mingw_host
90
+ mingw_hosts.split(":").each do |mingw_host|
91
+
92
+ # Use Rake::ExtensionCompiler helpers to find the proper host
93
+ mingw_target = mingw_host.gsub('msvc', '')
94
+
95
+ # define a location where built files for each host will be stored
96
+ build_dir = "#{USER_HOME}/builds/#{mingw_host}/#{ruby_cc_version}"
97
+ directory build_dir
98
+ install_dir = "#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}"
99
+
100
+ # clean intermediate files and folders
101
+ CLEAN.include(build_dir)
102
+ CLOBBER.include(install_dir)
103
+
104
+ task :mingw32 do
105
+ unless mingw_host then
106
+ warn "You need to install mingw32 cross compile functionality to be able to continue."
107
+ warn "Please refer to your distribution/package manager documentation about installation."
108
+ fail
109
+ end
110
+ end
106
111
 
107
- # generate the makefile in a clean build location
108
- file "#{build_dir}/Makefile" => [build_dir, source_dir] do |t|
109
-
110
- options = [
111
- "--host=#{MINGW_HOST}",
112
- "--target=#{MINGW_TARGET}",
113
- "--build=#{RUBY_BUILD}",
114
- '--enable-shared',
115
- '--disable-install-doc',
116
- '--with-ext=',
117
- 'LDFLAGS=-pipe -s',
118
- ]
119
-
120
- # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
121
- options << "--with-winsock2" if MAJOR == "1.8"
122
-
123
- chdir File.dirname(t.name) do
124
- prefix = File.expand_path("../../../ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
125
- options << "--prefix=#{prefix}"
126
- sh File.expand_path("../../../sources/#{RUBY_CC_VERSION}/configure"), *options
127
- end
128
- end
112
+ # generate the makefile in a clean build location
113
+ file "#{build_dir}/Makefile" => [build_dir, source_dir] do |t|
114
+
115
+ options = [
116
+ "--host=#{mingw_host}",
117
+ "--target=#{mingw_target}",
118
+ "--build=#{RUBY_BUILD}",
119
+ '--enable-shared',
120
+ '--disable-install-doc',
121
+ '--with-ext=',
122
+ ]
123
+
124
+ # Force Winsock2 for Ruby 1.8, 1.9 defaults to it
125
+ options << "--with-winsock2" if major == "1.8"
126
+ options << "--prefix=#{install_dir}"
127
+ sh File.expand_path("#{USER_HOME}/sources/#{ruby_cc_version}/configure"), *options, chdir: File.dirname(t.name)
128
+ end
129
129
 
130
- # make
131
- file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
132
- chdir File.dirname(t.prerequisites.first) do
133
- sh MAKE
134
- end
135
- end
130
+ # make
131
+ file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
132
+ sh MAKE, chdir: File.dirname(t.prerequisites.first)
133
+ end
136
134
 
137
- # make install
138
- file "#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{build_dir}/ruby.exe"] do |t|
139
- chdir File.dirname(t.prerequisites.first) do
140
- sh "#{MAKE} install"
135
+ # make install
136
+ file "#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}/bin/ruby.exe" => ["#{build_dir}/ruby.exe"] do |t|
137
+ sh "#{MAKE} install", chdir: File.dirname(t.prerequisites.first)
138
+ end
139
+ multitask :install => ["#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}/bin/ruby.exe"]
141
140
  end
142
141
  end
143
- task :install => ["#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe"]
144
142
 
145
143
  desc "Update rake-compiler list of installed Ruby versions"
146
144
  task 'update-config' do
@@ -187,5 +185,5 @@ task :default do
187
185
  Rake.application.display_tasks_and_comments
188
186
  end
189
187
 
190
- desc "Build #{RUBY_CC_VERSION} suitable for cross-platform development."
188
+ desc "Build rubies suitable for cross-platform development."
191
189
  task 'cross-ruby' => [:mingw32, :install, 'update-config']
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  - Luis Lavena
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-07-09 00:00:00.000000000 Z
12
+ date: 2021-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -79,10 +79,10 @@ extensions: []
79
79
  extra_rdoc_files:
80
80
  - README.md
81
81
  - LICENSE.txt
82
- - History.txt
82
+ - History.md
83
83
  files:
84
84
  - Gemfile
85
- - History.txt
85
+ - History.md
86
86
  - LICENSE.txt
87
87
  - README.md
88
88
  - Rakefile
@@ -126,7 +126,7 @@ homepage: https://github.com/rake-compiler/rake-compiler
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: {}
129
- post_install_message:
129
+ post_install_message:
130
130
  rdoc_options:
131
131
  - "--main"
132
132
  - README.md
@@ -145,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: 1.8.23
147
147
  requirements: []
148
- rubygems_version: 3.2.0.pre1
149
- signing_key:
148
+ rubygems_version: 3.3.0.dev
149
+ signing_key:
150
150
  specification_version: 4
151
151
  summary: Rake-based Ruby Extension (C, Java) task generator.
152
152
  test_files: []