rake-compiler 0.8.3 → 0.9.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
+ source "https://rubygems.org"
2
+
1
3
  gem "rake"
2
4
 
3
- env :development do
5
+ group :development do
4
6
  gem "rspec", "~> 2.8.0"
5
7
  gem "cucumber", "~> 1.1.4"
6
8
  end
@@ -1,3 +1,31 @@
1
+ === 0.9.0.pre.1 / 2013-05-05
2
+
3
+ * Enhancements:
4
+ * Add support for cross-builds and multiple platforms (x86/x64).
5
+ Pull #74 [larskanis]
6
+
7
+ $ rake-compiler cross-ruby VERSION=1.8.7-p371
8
+ $ rake-compiler cross-ruby VERSION=1.9.3-p392
9
+ $ rake-compiler cross-ruby VERSION=2.0.0-p0
10
+ $ rake-compiler cross-ruby VERSION=2.0.0-p0 HOST=x86_64-w64-mingw32
11
+ $ rake cross compile RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
12
+
13
+ # Rakefile
14
+ ext.cross_platform = %w[i386-mingw32 x64-mingw32]
15
+
16
+ * Support for cross-platform specific options. Pull #74 [larskanis]
17
+
18
+ # Rakefile
19
+ ext.cross_config_options << "--with-common-option"
20
+ ext.cross_config_options << {"x64-mingw32" => "--enable-64bits"}
21
+
22
+ * Bugfixes:
23
+ * Correct fat-gems support caused by RubyGems issues. Pull #76 [knu]
24
+
25
+ * Deprecations:
26
+ * Requires minimum Ruby 1.8.7 and RubyGems 1.8.25
27
+ * Usage of 'i386-mswin32' needs to be changed to 'i386-mswin32-60'
28
+
1
29
  === 0.8.3 / 2013-02-16
2
30
 
3
31
  * Bugfixes:
@@ -274,9 +274,9 @@ on the Windows host system you're cross-compiling for. An example:
274
274
 
275
275
  # File: ~/.rake-compiler/config.yml
276
276
 
277
- rbconfig-1.8.6: /path/to/ruby-1.8.6/rbconfig.rb
278
- rbconfig-1.8.7: /path/to/ruby-1.8.7/rbconfig.rb
279
- rbconfig-1.9.2: /path/to/ruby-1.9.2/rbconfig.rb
277
+ rbconfig-i386-mingw32-1.8.6: /path/to/ruby-1.8.6/rbconfig.rb
278
+ rbconfig-i386-mingw32-1.8.7: /path/to/ruby-1.8.7/rbconfig.rb
279
+ rbconfig-i386-mingw32-1.9.2: /path/to/ruby-1.9.2/rbconfig.rb
280
280
 
281
281
  If, instead, you want to build a different Ruby version than the default one, please
282
282
  supply a <tt>VERSION</tt>:
@@ -298,7 +298,7 @@ Now, you only need specify a few additional options in your extension definition
298
298
 
299
299
  Rake::ExtensionTask.new('my_extension', gem_spec) do |ext|
300
300
  ext.cross_compile = true # enable cross compilation (requires cross compile toolchain)
301
- ext.cross_platform = 'i386-mswin32' # forces the Windows platform instead of the default one
301
+ ext.cross_platform = 'i386-mswin32-60' # forces the Windows platform instead of the default one
302
302
  # configure options only for cross compile
303
303
  ext.cross_config_options << '--with-something'
304
304
 
@@ -312,7 +312,7 @@ By default, cross compilation targets 'i386-mingw32' which is the default GCC
312
312
  platform for Ruby.
313
313
 
314
314
  To target gems for MRI Ruby's current official distribution, please force the
315
- platform to the one (i386-mswin32) previously shown.
315
+ platform to the one (i386-mswin32-60) previously shown.
316
316
 
317
317
  === Warning, magician about to do some tricks, don't blink!
318
318
 
data/Rakefile CHANGED
@@ -11,11 +11,5 @@
11
11
  # Thank You.
12
12
  #
13
13
 
14
- begin
15
- require "isolate/now"
16
- rescue LoadError => e
17
- abort "This project requires Isolate to work. Please `gem install isolate` and try again."
18
- end
19
-
20
14
  # load rakefile extensions (tasks)
21
15
  Dir['tasks/*.rake'].sort.each { |f| load f }
File without changes
@@ -16,7 +16,8 @@ Feature: Cross-compile C extensions
16
16
  Given that all my source files are in place
17
17
  And I'm running a POSIX operating system
18
18
  And I've installed cross compile toolchain
19
- When rake task 'cross compile RUBY_CC_VERSION=1.8.7:1.9.3' is invoked
20
- Then rake task 'cross compile RUBY_CC_VERSION=1.8.7:1.9.3' succeeded
19
+ When rake task 'cross compile RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0' is invoked
20
+ Then rake task 'cross compile RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0' succeeded
21
21
  And binaries for platform 'i386-mingw32' version '1.8' get copied
22
22
  And binaries for platform 'i386-mingw32' version '1.9' get copied
23
+ And binaries for platform 'i386-mingw32' version '2.0' get copied
@@ -11,5 +11,5 @@ Feature: Generate multiple Windows gems from Linux
11
11
  And I've already successfully executed rake task 'cross compile'
12
12
  When rake task 'cross native gem' is invoked
13
13
  Then rake task 'cross native gem' succeeded
14
- And gem for platform 'x86-mswin32' get generated
14
+ And gem for platform 'x86-mswin32-60' get generated
15
15
  And gem for platform 'x86-mingw32' get generated
@@ -4,3 +4,7 @@ require 'fileutils'
4
4
  require 'rbconfig'
5
5
 
6
6
  ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
7
+
8
+ # get rid of Bundler environment polution
9
+ defined?(Bundler) and
10
+ ENV.delete("RUBYOPT")
@@ -69,7 +69,7 @@ EOF
69
69
  require 'rake/extensiontask'
70
70
  Rake::ExtensionTask.new("#{extension_name}", SPEC) do |ext|
71
71
  ext.cross_compile = true
72
- ext.cross_platform = ['x86-mswin32', 'x86-mingw32']
72
+ ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
73
73
  end
74
74
  EOF
75
75
  end
@@ -12,7 +12,7 @@ module Rake
12
12
  attr_accessor :config_script
13
13
  attr_accessor :cross_compile
14
14
  attr_accessor :cross_platform
15
- attr_accessor :cross_config_options
15
+ attr_writer :cross_config_options
16
16
  attr_accessor :no_native
17
17
  attr_accessor :config_includes
18
18
 
@@ -73,6 +73,19 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
73
73
  end
74
74
  end
75
75
 
76
+ def cross_config_options(for_platform=nil)
77
+ return @cross_config_options unless for_platform
78
+
79
+ # apply options for this platform, only
80
+ @cross_config_options.map do |option|
81
+ if option.kind_of?(Hash)
82
+ option[for_platform] || []
83
+ else
84
+ option
85
+ end
86
+ end.flatten
87
+ end
88
+
76
89
  private
77
90
  def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
78
91
  # platform usage
@@ -83,14 +96,17 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
83
96
 
84
97
  # tmp_path
85
98
  tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
99
+ stage_path = "#{@tmp_dir}/#{platf}/stage"
86
100
 
87
101
  # cleanup and clobbering
88
102
  CLEAN.include(tmp_path)
103
+ CLEAN.include(stage_path)
89
104
  CLOBBER.include("#{lib_path}/#{binary(platf)}")
90
105
  CLOBBER.include("#{@tmp_dir}")
91
106
 
92
107
  # directories we need
93
108
  directory tmp_path
109
+ directory "#{stage_path}/#{lib_path}"
94
110
  directory lib_dir
95
111
 
96
112
  # copy binary from temporary location to final lib
@@ -98,12 +114,36 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
98
114
  task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_path, "#{tmp_path}/#{binary(platf)}"] do
99
115
  install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
100
116
  end
117
+ # copy binary from temporary location to staging directory
118
+ task "copy:#{@name}:#{platf}:#{ruby_ver}" => ["#{stage_path}/#{lib_path}", "#{tmp_path}/#{binary(platf)}"] do
119
+ cp "#{tmp_path}/#{binary(platf)}", "#{stage_path}/#{lib_path}/#{binary(platf)}"
120
+ end
121
+
122
+ # copy other gem files to staging directory
123
+ if @gem_spec
124
+ @gem_spec.files.each do |gem_file|
125
+ # ignore directories and the binary extension
126
+ next if File.directory?(gem_file) || gem_file == "#{lib_path}/#{binary(platf)}"
127
+ stage_file = "#{stage_path}/#{gem_file}"
128
+
129
+ # copy each file from base to stage directory
130
+ unless Rake::Task.task_defined?(stage_file) then
131
+ directory File.dirname(stage_file)
132
+ file stage_file => [File.dirname(stage_file), gem_file] do
133
+ cp gem_file, stage_file
134
+ end
135
+ end
136
+
137
+ # append each file to the copy task
138
+ task "copy:#{@name}:#{platf}:#{ruby_ver}" => [stage_file]
139
+ end
140
+ end
101
141
 
102
142
  # binary in temporary folder depends on makefile and source files
103
143
  # tmp/extension_name/extension_name.{so,bundle}
104
144
  file "#{tmp_path}/#{binary(platf)}" => ["#{tmp_path}/Makefile"] + source_files do
105
145
  jruby_compile_msg = <<-EOF
106
- Compiling a native C extension on JRuby. This is discouraged and a
146
+ Compiling a native C extension on JRuby. This is discouraged and a
107
147
  Java extension should be preferred.
108
148
  EOF
109
149
  warn_once(jruby_compile_msg) if defined?(JRUBY_VERSION)
@@ -122,11 +162,6 @@ Java extension should be preferred.
122
162
  include_dirs = ['.'].concat(@config_includes).uniq.join(File::PATH_SEPARATOR)
123
163
  cmd = [Gem.ruby, "-I#{include_dirs}"]
124
164
 
125
- # if fake.rb is present, add to the command line
126
- if t.prerequisites.include?("#{tmp_path}/fake.rb") then
127
- cmd << '-rfake'
128
- end
129
-
130
165
  # build a relative path to extconf script
131
166
  abs_tmp_path = (Pathname.new(Dir.pwd) + tmp_path).realpath
132
167
  abs_extconf = (Pathname.new(Dir.pwd) + extconf).realpath
@@ -136,7 +171,7 @@ Java extension should be preferred.
136
171
 
137
172
  # rbconfig.rb will be present if we are cross compiling
138
173
  if t.prerequisites.include?("#{tmp_path}/rbconfig.rb") then
139
- options.push(*@cross_config_options)
174
+ options.push(*cross_config_options(platf))
140
175
  end
141
176
 
142
177
  # add options to command
@@ -186,6 +221,7 @@ Java extension should be preferred.
186
221
 
187
222
  # tmp_path
188
223
  tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
224
+ stage_path = "#{@tmp_dir}/#{platf}/stage"
189
225
 
190
226
  # lib_path
191
227
  lib_path = lib_dir
@@ -209,7 +245,8 @@ Java extension should be preferred.
209
245
 
210
246
  # go through native prerequisites and grab the real extension files from there
211
247
  t.prerequisites.each do |ext|
212
- ext_files << ext
248
+ # strip stage path and keep lib/... only
249
+ ext_files << ext.sub(stage_path+"/", '')
213
250
  end
214
251
 
215
252
  # include the files in the gem specification
@@ -221,20 +258,46 @@ Java extension should be preferred.
221
258
  end
222
259
 
223
260
  # Generate a package for this gem
224
- Gem::PackageTask.new(spec) do |pkg|
261
+ pkg = Gem::PackageTask.new(spec) do |pkg|
225
262
  pkg.need_zip = false
226
263
  pkg.need_tar = false
264
+ # Do not copy any files per PackageTask, because
265
+ # we need the files from the staging directory
266
+ pkg.package_files.clear
267
+ end
268
+
269
+ # Copy from staging directory to gem package directory.
270
+ # This is derived from the code of Gem::PackageTask
271
+ # but uses stage_path as source directory.
272
+ stage_files = spec.files.map do |gem_file|
273
+ File.join(stage_path, gem_file)
274
+ end
275
+ file pkg.package_dir_path => stage_files do
276
+ mkdir_p pkg.package_dir rescue nil
277
+ spec.files.each do |ft|
278
+ fn = File.join(stage_path, ft)
279
+ f = File.join(pkg.package_dir_path, ft)
280
+ fdir = File.dirname(f)
281
+ mkdir_p(fdir) if !File.exist?(fdir)
282
+ if File.directory?(fn)
283
+ mkdir_p(f)
284
+ else
285
+ rm_f f
286
+ safe_ln(fn, f)
287
+ end
288
+ end
227
289
  end
228
290
  end
229
291
  end
230
292
 
231
293
  # add binaries to the dependency chain
232
- task "native:#{@gem_spec.name}:#{platf}" => ["#{lib_path}/#{binary(platf)}"]
294
+ task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{lib_dir}/#{binary(platf)}"]
233
295
 
234
296
  # ensure the extension get copied
235
297
  unless Rake::Task.task_defined?("#{lib_path}/#{binary(platf)}") then
236
298
  file "#{lib_path}/#{binary(platf)}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
237
299
  end
300
+ file "#{stage_path}/#{lib_dir}/#{binary(platf)}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
238
301
 
239
302
  # Allow segmented packaging by platform (open door for 'cross compile')
240
303
  task "native:#{platf}" => ["native:#{@gem_spec.name}:#{platf}"]
@@ -290,8 +353,8 @@ Java extension should be preferred.
290
353
  # lib_path
291
354
  lib_path = lib_dir
292
355
 
293
- unless rbconfig_file = config_file["rbconfig-#{ruby_ver}"] then
294
- warn "no configuration section for specified version of Ruby (rbconfig-#{ruby_ver})"
356
+ unless rbconfig_file = config_file["rbconfig-#{for_platform}-#{ruby_ver}"] then
357
+ warn "no configuration section for specified version of Ruby (rbconfig-#{for_platform}-#{ruby_ver})"
295
358
  return
296
359
  end
297
360
 
@@ -308,7 +371,10 @@ Java extension should be preferred.
308
371
 
309
372
  # copy the file from the cross-ruby location
310
373
  file "#{tmp_path}/rbconfig.rb" => [rbconfig_file] do |t|
311
- cp t.prerequisites.first, t.name
374
+ File.open(t.name, 'w') do |f|
375
+ f.write "require 'fake.rb'\n\n"
376
+ f.write File.read(t.prerequisites.first)
377
+ end
312
378
  end
313
379
 
314
380
  # copy mkmf from cross-ruby location
@@ -264,7 +264,7 @@ describe Rake::ExtensionTask do
264
264
  context 'native:my_gem:{platform}' do
265
265
  it 'should depend on binary extension' do
266
266
  Rake::ExtensionTask.new('extension_one', @spec)
267
- Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("lib/#{@ext_bin}")
267
+ Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("tmp/#{@platform}/stage/lib/#{@ext_bin}")
268
268
  end
269
269
  end
270
270
  end
@@ -278,7 +278,8 @@ describe Rake::ExtensionTask do
278
278
  @spec = mock_gem_spec
279
279
  @config_file = File.expand_path("~/.rake-compiler/config.yml")
280
280
  @ruby_ver = RUBY_VERSION
281
- @config_path = mock_config_yml["rbconfig-#{@ruby_ver}"]
281
+ @platform = 'i386-mingw32'
282
+ @config_path = mock_config_yml["rbconfig-#{@platform}-#{@ruby_ver}"]
282
283
 
283
284
  File.stub!(:open).and_yield(mock_fake_rb)
284
285
  end
@@ -317,7 +318,7 @@ describe Rake::ExtensionTask do
317
318
 
318
319
  it 'should warn if no section of config file defines running version of ruby' do
319
320
  config = mock(Hash)
320
- config.should_receive(:[]).with("rbconfig-#{@ruby_ver}").and_return(nil)
321
+ config.should_receive(:[]).with("rbconfig-#{@platform}-#{@ruby_ver}").and_return(nil)
321
322
  YAML.stub!(:load_file).and_return(config)
322
323
  out, err = capture_output do
323
324
  Rake::ExtensionTask.new('extension_one') do |ext|
@@ -339,7 +340,7 @@ describe Rake::ExtensionTask do
339
340
 
340
341
  it 'should allow usage of RUBY_CC_VERSION to indicate a different version of ruby' do
341
342
  config = mock(Hash)
342
- config.should_receive(:[]).with("rbconfig-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
343
+ config.should_receive(:[]).with("rbconfig-i386-mingw32-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
343
344
  YAML.stub!(:load_file).and_return(config)
344
345
 
345
346
  ENV['RUBY_CC_VERSION'] = '1.9.1'
@@ -350,8 +351,8 @@ describe Rake::ExtensionTask do
350
351
 
351
352
  it 'should allow multiple versions be supplied to RUBY_CC_VERSION' do
352
353
  config = mock(Hash)
353
- config.should_receive(:[]).once.with("rbconfig-1.8.6").and_return('/path/to/ruby/1.8.6/rbconfig.rb')
354
- config.should_receive(:[]).once.with("rbconfig-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
354
+ config.should_receive(:[]).once.with("rbconfig-i386-mingw32-1.8.6").and_return('/path/to/ruby/1.8.6/rbconfig.rb')
355
+ config.should_receive(:[]).once.with("rbconfig-i386-mingw32-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
355
356
  YAML.stub!(:load_file).and_return(config)
356
357
 
357
358
  ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
@@ -440,15 +441,24 @@ describe Rake::ExtensionTask do
440
441
  end
441
442
 
442
443
  context '(cross for multiple platforms)' do
443
- it 'should define task for each supplied platform' do
444
+ before :each do
444
445
  @ext = Rake::ExtensionTask.new('extension_one', @spec) do |ext|
445
446
  ext.cross_compile = true
446
447
  ext.cross_platform = ['universal-known', 'universal-unknown']
448
+ ext.cross_config_options << '--with-something'
449
+ ext.cross_config_options << {'universal-known' => '--with-known'}
447
450
  end
451
+ end
448
452
 
453
+ it 'should define task for each supplied platform' do
449
454
  Rake::Task.should have_defined('compile:universal-known')
450
455
  Rake::Task.should have_defined('compile:universal-unknown')
451
456
  end
457
+
458
+ it 'should filter options for each supplied platform' do
459
+ @ext.cross_config_options('universal-unknown').should eq(%w[--with-something])
460
+ @ext.cross_config_options('universal-known').should eq(%w[--with-something --with-known])
461
+ end
452
462
  end
453
463
  end
454
464
  end
@@ -460,18 +470,28 @@ describe Rake::ExtensionTask do
460
470
 
461
471
  def mock_gem_spec(stubs = {})
462
472
  mock(Gem::Specification,
463
- { :name => 'my_gem', :platform => 'ruby' }.merge(stubs)
473
+ { :name => 'my_gem', :platform => 'ruby', :files => [] }.merge(stubs)
464
474
  )
465
475
  end
466
476
 
467
477
  def mock_config_yml
468
478
  {
469
- 'rbconfig-1.8.6' => '/some/path/version/1.8/to/rbconfig.rb',
470
- 'rbconfig-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
471
- 'rbconfig-1.9.1' => '/some/path/version/1.9.1/to/rbconfig.rb',
472
- 'rbconfig-1.9.2' => '/some/path/version/1.9.1/to/rbconfig.rb',
473
- 'rbconfig-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
474
- 'rbconfig-3.0.0' => '/some/fake/version/3.0.0/to/rbconfig.rb'
479
+ 'rbconfig-i386-mingw32-1.8.6' => '/some/path/version/1.8/to/rbconfig.rb',
480
+ 'rbconfig-universal-unknown-1.8.6' => '/some/path/version/1.8/to/rbconfig.rb',
481
+ 'rbconfig-i386-mingw32-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
482
+ 'rbconfig-universal-known-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
483
+ 'rbconfig-universal-unknown-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
484
+ 'rbconfig-universal-unknown-1.9.1' => '/some/path/version/1.9.1/to/rbconfig.rb',
485
+ 'rbconfig-universal-unknown-1.9.2' => '/some/path/version/1.9.1/to/rbconfig.rb',
486
+ 'rbconfig-universal-unknown-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
487
+ 'rbconfig-i386-mingw32-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
488
+ 'rbconfig-universal-known-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
489
+ 'rbconfig-universal-known-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
490
+ 'rbconfig-universal-unknown-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
491
+ 'rbconfig-universal-unknown-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
492
+ 'rbconfig-i386-mingw32-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
493
+ 'rbconfig-x64-mingw32-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
494
+ 'rbconfig-x64-mingw32-3.0.0' => '/some/fake/version/3.0.0/to/rbconfig.rb'
475
495
  }
476
496
  end
477
497
 
@@ -42,7 +42,7 @@ require 'rake/extensioncompiler'
42
42
 
43
43
  MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
44
44
  USER_HOME = File.expand_path("~/.rake-compiler")
45
- RUBY_CC_VERSION = "ruby-" << ENV.fetch("VERSION", "1.8.7-p334")
45
+ RUBY_CC_VERSION = "ruby-" << ENV.fetch("VERSION", "1.8.7-p371")
46
46
  RUBY_SOURCE = ENV['SOURCE']
47
47
  RUBY_BUILD = RbConfig::CONFIG["host"]
48
48
 
@@ -60,16 +60,16 @@ end
60
60
 
61
61
  # define a location where sources will be stored
62
62
  directory "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
63
- directory "#{USER_HOME}/builds/#{RUBY_CC_VERSION}"
63
+ directory "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}"
64
64
 
65
65
  # clean intermediate files and folders
66
66
  CLEAN.include("#{USER_HOME}/sources/#{RUBY_CC_VERSION}")
67
- CLEAN.include("#{USER_HOME}/builds/#{RUBY_CC_VERSION}")
67
+ CLEAN.include("#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
68
68
 
69
69
  # remove the final products and sources
70
70
  CLOBBER.include("#{USER_HOME}/sources")
71
71
  CLOBBER.include("#{USER_HOME}/builds")
72
- CLOBBER.include("#{USER_HOME}/ruby/#{RUBY_CC_VERSION}")
72
+ CLOBBER.include("#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
73
73
  CLOBBER.include("#{USER_HOME}/config.yml")
74
74
 
75
75
  # ruby source file should be stored there
@@ -126,7 +126,7 @@ task :mingw32 do
126
126
  end
127
127
 
128
128
  # generate the makefile in a clean build location
129
- file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}",
129
+ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}",
130
130
  "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in"] do |t|
131
131
 
132
132
  options = [
@@ -143,26 +143,26 @@ file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/
143
143
  options << "--with-winsock2" if MAJOR == "1.8"
144
144
 
145
145
  chdir File.dirname(t.name) do
146
- prefix = File.expand_path("../../ruby/#{RUBY_CC_VERSION}")
146
+ prefix = File.expand_path("../../../ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
147
147
  options << "--prefix=#{prefix}"
148
- sh File.expand_path("../../sources/#{RUBY_CC_VERSION}/configure"), *options
148
+ sh File.expand_path("../../../sources/#{RUBY_CC_VERSION}/configure"), *options
149
149
  end
150
150
  end
151
151
 
152
152
  # make
153
- file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile"] do |t|
153
+ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t|
154
154
  chdir File.dirname(t.prerequisites.first) do
155
155
  sh MAKE
156
156
  end
157
157
  end
158
158
 
159
159
  # make install
160
- file "#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}/ruby.exe"] do |t|
160
+ file "#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe"] do |t|
161
161
  chdir File.dirname(t.prerequisites.first) do
162
162
  sh "#{MAKE} install"
163
163
  end
164
164
  end
165
- task :install => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe"]
165
+ task :install => ["#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe"]
166
166
 
167
167
  desc "Update rake-compiler list of installed Ruby versions"
168
168
  task 'update-config' do
@@ -175,12 +175,19 @@ task 'update-config' do
175
175
  config = {}
176
176
  end
177
177
 
178
- files = Dir.glob("#{USER_HOME}/ruby/*/**/rbconfig.rb").sort
178
+ files = Dir.glob("#{USER_HOME}/ruby/*/*/**/rbconfig.rb").sort
179
179
 
180
180
  files.each do |rbconfig|
181
- version = rbconfig.match(/.*-(\d.\d.\d)/)[1]
182
- config["rbconfig-#{version}"] = rbconfig
183
- puts "Found Ruby version #{version} (#{rbconfig})"
181
+ version, platform = rbconfig.match(/.*-(\d.\d.\d).*\/([-\w]+)\/rbconfig/)[1,2]
182
+ config["rbconfig-#{platform}-#{version}"] = rbconfig
183
+
184
+ # fake alternate (binary compatible) i386-mswin32-60 platform
185
+ if platform == "i386-mingw32"
186
+ alt_platform = "i386-mswin32-60"
187
+ config["rbconfig-#{alt_platform}-#{version}"] = rbconfig
188
+ end
189
+
190
+ puts "Found Ruby version #{version} for platform #{platform} (#{rbconfig})"
184
191
  end
185
192
 
186
193
  when_writing("Saving changes into #{config_file}") {
@@ -2,7 +2,7 @@ desc 'Ensure all the cross compiled versions are installed'
2
2
  task :bootstrap do
3
3
  fail "Sorry, this only works on OSX and Linux" if RUBY_PLATFORM =~ /mswin|mingw/
4
4
 
5
- versions = %w(1.8.6-p398 1.9.1-p243 1.9.2-p0)
5
+ versions = %w(1.8.7-p371 1.9.3-p392 2.0.0-p0)
6
6
 
7
7
  versions.each do |version|
8
8
  puts "[INFO] Attempt to cross-compile Ruby #{version}"
@@ -3,7 +3,7 @@ require 'rubygems/package_task'
3
3
  GEM_SPEC = Gem::Specification.new do |s|
4
4
  # basic information
5
5
  s.name = "rake-compiler"
6
- s.version = "0.8.3"
6
+ s.version = "0.9.0.pre.1"
7
7
  s.platform = Gem::Platform::RUBY
8
8
 
9
9
  # description and details
@@ -11,8 +11,8 @@ GEM_SPEC = Gem::Specification.new do |s|
11
11
  s.description = "Provide a standard and simplified way to build and package\nRuby extensions (C, Java) using Rake as glue."
12
12
 
13
13
  # requirements
14
- s.required_ruby_version = ">= 1.8.6"
15
- s.required_rubygems_version = ">= 1.3.5"
14
+ s.required_ruby_version = ">= 1.8.7"
15
+ s.required_rubygems_version = ">= 1.8.25"
16
16
 
17
17
  # dependencies
18
18
  s.add_dependency 'rake'
@@ -24,7 +24,7 @@ GEM_SPEC = Gem::Specification.new do |s|
24
24
  # components, files and paths
25
25
  s.files = FileList["features/**/*.{feature,rb}", "bin/rake-compiler",
26
26
  "lib/**/*.rb", "spec/spec.opts", "spec/**/*.rb",
27
- "tasks/**/*.rake", "Rakefile", "Isolate",
27
+ "tasks/**/*.rake", "Rakefile", "Gemfile",
28
28
  "*.{rdoc,txt,yml}"]
29
29
 
30
30
  s.bindir = 'bin'
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
5
- prerelease:
4
+ hash: 2946513
5
+ prerelease: 6
6
6
  segments:
7
7
  - 0
8
- - 8
9
- - 3
10
- version: 0.8.3
8
+ - 9
9
+ - 0
10
+ - pre
11
+ - 1
12
+ version: 0.9.0.pre.1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Luis Lavena
@@ -15,12 +17,13 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2013-02-16 00:00:00 Z
20
+ date: 2013-05-05 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
- name: rake
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ type: :runtime
25
+ name: rake
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
27
  none: false
25
28
  requirements:
26
29
  - - ">="
@@ -29,12 +32,12 @@ dependencies:
29
32
  segments:
30
33
  - 0
31
34
  version: "0"
32
- type: :runtime
33
- version_requirements: *id001
35
+ requirement: *id001
34
36
  - !ruby/object:Gem::Dependency
35
- name: rspec
36
37
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ type: :development
39
+ name: rspec
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
41
  none: false
39
42
  requirements:
40
43
  - - ~>
@@ -45,12 +48,12 @@ dependencies:
45
48
  - 8
46
49
  - 0
47
50
  version: 2.8.0
48
- type: :development
49
- version_requirements: *id002
51
+ requirement: *id002
50
52
  - !ruby/object:Gem::Dependency
51
- name: cucumber
52
53
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
+ type: :development
55
+ name: cucumber
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
57
  none: false
55
58
  requirements:
56
59
  - - ~>
@@ -61,8 +64,7 @@ dependencies:
61
64
  - 1
62
65
  - 4
63
66
  version: 1.1.4
64
- type: :development
65
- version_requirements: *id003
67
+ requirement: *id003
66
68
  description: |-
67
69
  Provide a standard and simplified way to build and package
68
70
  Ruby extensions (C, Java) using Rake as glue.
@@ -113,7 +115,7 @@ files:
113
115
  - tasks/release.rake
114
116
  - tasks/rspec.rake
115
117
  - Rakefile
116
- - Isolate
118
+ - Gemfile
117
119
  - History.txt
118
120
  - LICENSE.txt
119
121
  - README.rdoc
@@ -134,23 +136,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
136
  requirements:
135
137
  - - ">="
136
138
  - !ruby/object:Gem::Version
137
- hash: 59
139
+ hash: 57
138
140
  segments:
139
141
  - 1
140
142
  - 8
141
- - 6
142
- version: 1.8.6
143
+ - 7
144
+ version: 1.8.7
143
145
  required_rubygems_version: !ruby/object:Gem::Requirement
144
146
  none: false
145
147
  requirements:
146
148
  - - ">="
147
149
  - !ruby/object:Gem::Version
148
- hash: 17
150
+ hash: 5
149
151
  segments:
150
152
  - 1
151
- - 3
152
- - 5
153
- version: 1.3.5
153
+ - 8
154
+ - 25
155
+ version: 1.8.25
154
156
  requirements: []
155
157
 
156
158
  rubyforge_project: rake-compiler