rake-compiler 1.1.0 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +522 -0
- data/lib/rake/extensioncompiler.rb +1 -1
- data/lib/rake/extensiontask.rb +46 -20
- data/lib/rake/javaextensiontask.rb +3 -3
- data/tasks/bin/cross-ruby.rake +79 -110
- metadata +5 -6
- data/History.txt +0 -461
@@ -35,8 +35,8 @@ module Rake
|
|
35
35
|
@source_pattern = '**/*.java'
|
36
36
|
@classpath = nil
|
37
37
|
@debug = false
|
38
|
-
@source_version = '1.
|
39
|
-
@target_version = '1.
|
38
|
+
@source_version = '1.7'
|
39
|
+
@target_version = '1.7'
|
40
40
|
@encoding = nil
|
41
41
|
@java_compiling = nil
|
42
42
|
@lint_option = nil
|
@@ -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
|
240
|
+
rescue
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
data/tasks/bin/cross-ruby.rake
CHANGED
@@ -41,135 +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
|
-
["
|
49
|
+
["RUBYOPT"].each do |var|
|
58
50
|
ENV.delete(var)
|
59
51
|
end
|
60
52
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
CLOBBER.include("#{USER_HOME}/
|
75
|
-
CLOBBER.include("#{USER_HOME}/
|
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/#{
|
80
|
-
|
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/#{
|
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
|
-
|
99
|
-
# backup makefile.in
|
100
|
-
if RUBY_CC_VERSION >= "ruby-2.7.0"
|
101
|
-
makefile_in = "#{source_dir}/template/Makefile.in"
|
102
|
-
else
|
103
|
-
makefile_in = "#{source_dir}/Makefile.in"
|
104
|
-
end
|
105
|
-
makefile_in_bak = "#{makefile_in}.bak"
|
106
|
-
file makefile_in_bak => [source_dir] do |t|
|
107
|
-
cp makefile_in, makefile_in_bak
|
108
|
-
end
|
109
|
-
|
110
|
-
# correct the makefiles
|
111
|
-
file makefile_in => [makefile_in_bak] do |t|
|
112
|
-
content = File.open(makefile_in_bak, 'rb') { |f| f.read }
|
113
|
-
|
114
|
-
out = ""
|
115
86
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
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
|
121
110
|
end
|
122
|
-
end
|
123
|
-
|
124
|
-
when_writing("Patching Makefile.in") {
|
125
|
-
File.open(makefile_in, 'wb') { |f| f.write(out) }
|
126
|
-
}
|
127
|
-
end
|
128
|
-
|
129
|
-
task :mingw32 do
|
130
|
-
unless MINGW_HOST then
|
131
|
-
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
132
|
-
warn "Please refer to your distribution/package manager documentation about installation."
|
133
|
-
fail
|
134
|
-
end
|
135
|
-
end
|
136
111
|
|
137
|
-
# generate the makefile in a clean build location
|
138
|
-
file "#{build_dir}/Makefile" => [build_dir,
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
options << "--prefix=#{prefix}"
|
155
|
-
sh File.expand_path("../../../sources/#{RUBY_CC_VERSION}/configure"), *options
|
156
|
-
end
|
157
|
-
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
|
158
129
|
|
159
|
-
# make
|
160
|
-
file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
|
161
|
-
|
162
|
-
|
163
|
-
end
|
164
|
-
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
|
165
134
|
|
166
|
-
# make install
|
167
|
-
file "#{USER_HOME}/ruby/#{
|
168
|
-
|
169
|
-
|
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"]
|
170
140
|
end
|
171
141
|
end
|
172
|
-
task :install => ["#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe"]
|
173
142
|
|
174
143
|
desc "Update rake-compiler list of installed Ruby versions"
|
175
144
|
task 'update-config' do
|
@@ -216,5 +185,5 @@ task :default do
|
|
216
185
|
Rake.application.display_tasks_and_comments
|
217
186
|
end
|
218
187
|
|
219
|
-
desc "Build
|
188
|
+
desc "Build rubies suitable for cross-platform development."
|
220
189
|
task 'cross-ruby' => [:mingw32, :install, 'update-config']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
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.
|
82
|
+
- History.md
|
83
83
|
files:
|
84
84
|
- Gemfile
|
85
|
-
- History.
|
85
|
+
- History.md
|
86
86
|
- LICENSE.txt
|
87
87
|
- README.md
|
88
88
|
- Rakefile
|
@@ -145,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: 1.8.23
|
147
147
|
requirements: []
|
148
|
-
|
149
|
-
rubygems_version: 2.7.6.2
|
148
|
+
rubygems_version: 3.3.0.dev
|
150
149
|
signing_key:
|
151
150
|
specification_version: 4
|
152
151
|
summary: Rake-based Ruby Extension (C, Java) task generator.
|