rake-compiler 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +26 -0
- data/README.rdoc +43 -19
- data/features/step_definitions/cross_compilation.rb +2 -2
- data/lib/rake/baseextensiontask.rb +0 -2
- data/lib/rake/extensioncompiler.rb +0 -2
- data/lib/rake/extensiontask.rb +27 -29
- data/lib/rake/javaextensiontask.rb +0 -2
- data/spec/lib/rake/extensiontask_spec.rb +2 -8
- data/tasks/bin/cross-ruby.rake +1 -2
- data/tasks/gem.rake +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 178098c351ebed6cddc5f0c208edf0d74a35f4eb
|
4
|
+
data.tar.gz: 12c7058b897f8514045ff8e2ba2dac96dfb7848b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b2f45814eddded0e6c811c324c94890b6d0f90f26e270622b139298e614ca4ce3eee38fff760efbadd4b40bcec7128a8ab441766df33504bd0412e0393d1c0
|
7
|
+
data.tar.gz: a8e2cae4b42a236bcc1b8eef897bf5cb1045482b660e4f53e29232d8951dc22af7730a469ad51d984475fbff28639a2124f77878872b9f3c834c7e73bf3f8f12
|
data/History.txt
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
=== 0.9.6 / 2016-03-04
|
2
|
+
|
3
|
+
* Enhancements
|
4
|
+
* Add more descriptions into README.
|
5
|
+
Closes #105 [Patch by Aaron Stone]
|
6
|
+
* Remove needless executable bits.
|
7
|
+
Closes #107 [Patch by Thibault Jouan]
|
8
|
+
* Update .gitignore.
|
9
|
+
Closes #108 [Patch by Thibault Jouan]
|
10
|
+
* Improve "make" detection on some platforms such as FreeBSD.
|
11
|
+
Closes #109 [Patch by Thibault Jouan]
|
12
|
+
* Enable cucumber steps for POSIX on *BSD.
|
13
|
+
Closes #110 [Patch by Thibault Jouan]
|
14
|
+
* Stop to build bundled extensions.
|
15
|
+
* Add description about CLI option into README.
|
16
|
+
Closes #115 [Patch by Richard Michael]
|
17
|
+
* Update description about using rake-compiler on virtual machine in
|
18
|
+
README.
|
19
|
+
Closes #116, #117 [Patch by Lars Kanis]
|
20
|
+
* Update fake mechanism to be compatible with Bundler.
|
21
|
+
Closes #121 [Patch by Lars Kanis]
|
22
|
+
|
23
|
+
* Bugfixes:
|
24
|
+
* Fix typos in README.
|
25
|
+
Closes #102, #103 [Patch by Robert Fletcher]
|
26
|
+
|
1
27
|
=== 0.9.5 / 2015-01-03
|
2
28
|
|
3
29
|
* Enhancements
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= What is rake-compiler?
|
2
2
|
|
3
3
|
rake-compiler is first and foremost a productivity tool for Ruby developers.
|
4
|
-
|
4
|
+
Its goal is to make the busy developer's life easier by simplifying the building
|
5
5
|
and packaging of Ruby extensions by simplifying code and reducing duplication.
|
6
6
|
|
7
7
|
It follows *convention over configuration* by advocating a standardized build and
|
@@ -118,6 +118,10 @@ Simply calling <tt>compile</tt> like
|
|
118
118
|
performs the entire compile and build process for you and places the resulting
|
119
119
|
extension inside the <tt>lib</tt> directory of your project.
|
120
120
|
|
121
|
+
To pass <tt>dir_config</tt> options to the compilation, add to the command line:
|
122
|
+
|
123
|
+
$ rake compile -- --with-foo-[dir|lib|bin|...]=/path/to/foo
|
124
|
+
|
121
125
|
NOTE: Please be aware that building C extensions requires the proper
|
122
126
|
development environment for your Platform, including libraries, headers
|
123
127
|
and build tools. Check your distro / vendor documentation on how to install
|
@@ -230,10 +234,11 @@ different 'host' OS's.
|
|
230
234
|
|
231
235
|
==== The Easy Way
|
232
236
|
|
233
|
-
Use rake-compiler-
|
234
|
-
build tools.
|
235
|
-
|
236
|
-
https://github.com/
|
237
|
+
Use rake-compiler-dock, a gem that makes use of a virtual machine provisioned with
|
238
|
+
all the necessary build tools. You can add a task to your Rakefile, that
|
239
|
+
cross-compiles and packages your gem into Windows fat binaries (with 1.8 to 2.2
|
240
|
+
and x86/x64 support). See https://github.com/rake-compiler/rake-compiler-dock for more
|
241
|
+
information.
|
237
242
|
|
238
243
|
==== The Manual Way
|
239
244
|
|
@@ -284,9 +289,9 @@ on the Windows host system you're cross-compiling for. An example:
|
|
284
289
|
|
285
290
|
# File: ~/.rake-compiler/config.yml
|
286
291
|
|
287
|
-
rbconfig-
|
288
|
-
rbconfig-
|
289
|
-
rbconfig-
|
292
|
+
rbconfig-x86-mingw32-1.8.6: /path/to/ruby-1.8.6/rbconfig.rb
|
293
|
+
rbconfig-x86-mingw32-1.8.7: /path/to/ruby-1.8.7/rbconfig.rb
|
294
|
+
rbconfig-x86-mingw32-1.9.2: /path/to/ruby-1.9.2/rbconfig.rb
|
290
295
|
|
291
296
|
If, instead, you want to build a different Ruby version than the default one, please
|
292
297
|
supply a <tt>VERSION</tt>:
|
@@ -296,7 +301,7 @@ supply a <tt>VERSION</tt>:
|
|
296
301
|
If you, like me, have multiple versions of MinGW packages installed, you can
|
297
302
|
specify the HOST that will be used to cross compile Ruby:
|
298
303
|
|
299
|
-
rake-compiler cross-ruby HOST=
|
304
|
+
rake-compiler cross-ruby HOST=x86-mingw32 # (OSX mingw32 port)
|
300
305
|
|
301
306
|
The host will vary depending on provider (mingw32 versus mingw-w64 projects).
|
302
307
|
Please consult the documentation and website of the MinGW package provider before
|
@@ -307,22 +312,41 @@ reporting any issues.
|
|
307
312
|
Now, you only need specify a few additional options in your extension definition:
|
308
313
|
|
309
314
|
Rake::ExtensionTask.new('my_extension', gem_spec) do |ext|
|
310
|
-
|
311
|
-
ext.
|
312
|
-
|
313
|
-
|
315
|
+
# enable cross compilation (requires cross compile toolchain)
|
316
|
+
ext.cross_compile = true
|
317
|
+
|
318
|
+
# set a single platform or an array of platforms to target
|
319
|
+
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
|
320
|
+
|
321
|
+
# cross-compile options will be passed to extconf.rb for each
|
322
|
+
# platform build, with platform-specific options in a hash.
|
323
|
+
ext.cross_config_options << '--with-common-option'
|
324
|
+
ext.cross_config_options << {
|
325
|
+
'x86-mswin32-60 => '--with-some-option',
|
326
|
+
'x64-mingw32' => '--enable-64bits',
|
327
|
+
}
|
328
|
+
ext.cross_config_options << '--with-final-option'
|
314
329
|
|
315
330
|
# perform alterations on the gemspec when cross compiling
|
316
331
|
ext.cross_compiling do |gem_spec|
|
332
|
+
# such as packaging a file that isn't specified in the gemspec
|
333
|
+
gem_spec.files << 'lib/generated_file.rb'
|
334
|
+
# or adding a new installation message
|
317
335
|
gem_spec.post_install_message = "You installed the binary version of this gem!"
|
318
336
|
end
|
319
337
|
end
|
320
338
|
|
321
|
-
By default, cross compilation targets 'i386-mingw32' which is the default
|
322
|
-
platform for Ruby.
|
339
|
+
By default, cross compilation targets 'i386-mingw32' which is the default
|
340
|
+
GCC platform for Ruby. MRI Ruby's current official distribution uses
|
341
|
+
<tt>i386-mswin32-60</tt>. The RubyInstaller distribution uses
|
342
|
+
<tt>x86-mingw32</tt> and <tt>x64-mingw32</tt> for 32-bit and 64-bit
|
343
|
+
Windows targets, respectively. Note that <tt>i386</tt> and <tt>x86</tt>
|
344
|
+
are synonymous here; <tt>x86</tt> is preferred going forward.
|
323
345
|
|
324
|
-
|
325
|
-
|
346
|
+
The format for <tt>cross_config_options</tt> is an array of strings and
|
347
|
+
hashes. Hashes will be fetched for each value of <tt>cross_platform</tt>
|
348
|
+
as the build iterates, or ignored if there is no value for that platform.
|
349
|
+
You can mix-and-match strings and hashes to get desired option ordering.
|
326
350
|
|
327
351
|
==== Warning, magician about to do some tricks, don't blink!
|
328
352
|
|
@@ -330,7 +354,7 @@ Cross compiling is still very simple:
|
|
330
354
|
|
331
355
|
rake cross compile
|
332
356
|
|
333
|
-
And now, building gems for your Windows users is just
|
357
|
+
And now, building gems for your Windows users is just 6 more letters:
|
334
358
|
|
335
359
|
rake cross native gem
|
336
360
|
|
@@ -366,7 +390,7 @@ NOTE: building "fat" gems is currently only supported by rake-compiler when
|
|
366
390
|
cross compiling from a Linux or OSX host. Patches are welcome if building
|
367
391
|
"fat" gems from Windows hosts is desired, or natively for your platform :-)
|
368
392
|
|
369
|
-
Now
|
393
|
+
Now it's up to you to make your gem load the proper binary at runtime:
|
370
394
|
|
371
395
|
begin
|
372
396
|
RUBY_VERSION =~ /(\d+.\d+)/
|
@@ -1,6 +1,6 @@
|
|
1
|
-
# Naive way of looking into platforms
|
1
|
+
# Naive way of looking into platforms
|
2
2
|
Given %r{^I'm running a POSIX operating system$} do
|
3
|
-
unless RbConfig::CONFIG['host_os'] =~ /linux|darwin/ then
|
3
|
+
unless RbConfig::CONFIG['host_os'] =~ /linux|darwin|bsd|dragonfly/ then
|
4
4
|
raise Cucumber::Pending.new("You need a POSIX operating system, no cheating ;-)")
|
5
5
|
end
|
6
6
|
end
|
data/lib/rake/extensiontask.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
1
|
require 'rake/baseextensiontask'
|
4
2
|
require "rubygems/package_task"
|
5
3
|
|
@@ -8,7 +6,6 @@ require "rubygems/package_task"
|
|
8
6
|
|
9
7
|
module Rake
|
10
8
|
class ExtensionTask < BaseExtensionTask
|
11
|
-
|
12
9
|
attr_accessor :config_script
|
13
10
|
attr_accessor :cross_compile
|
14
11
|
attr_accessor :cross_platform
|
@@ -172,8 +169,8 @@ Java extension should be preferred.
|
|
172
169
|
# now add the extconf script
|
173
170
|
cmd << abs_extconf.relative_path_from(abs_tmp_path)
|
174
171
|
|
175
|
-
#
|
176
|
-
if t.prerequisites.include?("#{tmp_path}/
|
172
|
+
# fake.rb will be present if we are cross compiling
|
173
|
+
if t.prerequisites.include?("#{tmp_path}/fake.rb") then
|
177
174
|
options.push(*cross_config_options(platf))
|
178
175
|
end
|
179
176
|
|
@@ -368,39 +365,30 @@ Java extension should be preferred.
|
|
368
365
|
# define compilation tasks for cross platform!
|
369
366
|
define_compile_tasks(for_platform, ruby_ver)
|
370
367
|
|
371
|
-
# chain fake.rb
|
368
|
+
# chain fake.rb and mkmf.rb to Makefile generation
|
372
369
|
file "#{tmp_path}/Makefile" => ["#{tmp_path}/fake.rb",
|
373
|
-
"#{tmp_path}/rbconfig.rb",
|
374
370
|
"#{tmp_path}/mkmf.rb"]
|
375
371
|
|
376
|
-
# copy the
|
377
|
-
|
372
|
+
# copy the rbconfig from the cross-ruby location and
|
373
|
+
# genearte fake.rb for different ruby versions
|
374
|
+
file "#{tmp_path}/fake.rb" => [rbconfig_file] do |t|
|
378
375
|
File.open(t.name, 'w') do |f|
|
379
|
-
f.write
|
376
|
+
f.write fake_rb(for_platform, ruby_ver)
|
380
377
|
f.write File.read(t.prerequisites.first)
|
381
378
|
end
|
382
379
|
end
|
383
380
|
|
384
381
|
# copy mkmf from cross-ruby location
|
385
382
|
file "#{tmp_path}/mkmf.rb" => [mkmf_file] do |t|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
383
|
+
File.open(t.name, 'w') do |f|
|
384
|
+
content = File.read(t.prerequisites.first)
|
385
|
+
content.sub!(/^(require ')rbconfig(')$/, '\\1fake\\2')
|
386
|
+
if ruby_ver < "1.9" && "1.9" <= RUBY_VERSION
|
390
387
|
content.sub!(/^( break )\*(defaults)$/, '\\1\\2.first')
|
391
388
|
content.sub!(/^( return )\*(defaults)$/, '\\1\\2.first')
|
392
389
|
content.sub!(/^( mfile\.)print( configuration\(srcprefix\))$/, '\\1puts\\2')
|
393
|
-
f.rewind
|
394
|
-
f.write content
|
395
|
-
f.truncate(f.tell)
|
396
390
|
end
|
397
|
-
|
398
|
-
end
|
399
|
-
|
400
|
-
# genearte fake.rb for different ruby versions
|
401
|
-
file "#{tmp_path}/fake.rb" do |t|
|
402
|
-
File.open(t.name, 'w') do |f|
|
403
|
-
f.write fake_rb(for_platform, ruby_ver)
|
391
|
+
f.write content
|
404
392
|
end
|
405
393
|
end
|
406
394
|
|
@@ -455,9 +443,7 @@ Java extension should be preferred.
|
|
455
443
|
if RUBY_PLATFORM =~ /mswin/ then
|
456
444
|
'nmake'
|
457
445
|
else
|
458
|
-
ENV['MAKE'] ||
|
459
|
-
system("#{c} -v >> #{dev_null} 2>&1")
|
460
|
-
}
|
446
|
+
ENV['MAKE'] || find_make
|
461
447
|
end
|
462
448
|
end
|
463
449
|
|
@@ -468,8 +454,18 @@ Java extension should be preferred.
|
|
468
454
|
@make
|
469
455
|
end
|
470
456
|
|
471
|
-
def
|
472
|
-
|
457
|
+
def find_make
|
458
|
+
candidates = ["gmake", "make"]
|
459
|
+
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
|
460
|
+
|
461
|
+
candidates.each do |candidate|
|
462
|
+
paths.each do |path|
|
463
|
+
make = File.join(path, candidate)
|
464
|
+
return make if File.executable?(make)
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
nil
|
473
469
|
end
|
474
470
|
|
475
471
|
def compiled_files
|
@@ -490,8 +486,10 @@ Java extension should be preferred.
|
|
490
486
|
# "cannot load such file -- win32/resolv" when it is required later on.
|
491
487
|
# See also: https://github.com/tjschuck/rake-compiler-dev-box/issues/5
|
492
488
|
require 'resolv'
|
489
|
+
require 'rbconfig'
|
493
490
|
|
494
491
|
class Object
|
492
|
+
remove_const :RbConfig
|
495
493
|
remove_const :RUBY_PLATFORM
|
496
494
|
remove_const :RUBY_VERSION
|
497
495
|
remove_const :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
|
@@ -426,15 +426,9 @@ describe Rake::ExtensionTask do
|
|
426
426
|
it 'should chain fake task to Makefile generation' do
|
427
427
|
Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/fake.rb")
|
428
428
|
end
|
429
|
-
end
|
430
|
-
|
431
|
-
context 'rbconfig' do
|
432
|
-
it 'should chain rbconfig tasks to Makefile generation' do
|
433
|
-
Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/rbconfig.rb")
|
434
|
-
end
|
435
429
|
|
436
|
-
it 'should
|
437
|
-
Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/
|
430
|
+
it 'should chain rbconfig tasks to fake.rb generation' do
|
431
|
+
Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/fake.rb"].prerequisites.should include(@config_path)
|
438
432
|
end
|
439
433
|
end
|
440
434
|
|
data/tasks/bin/cross-ruby.rake
CHANGED
@@ -135,8 +135,7 @@ file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER
|
|
135
135
|
"--build=#{RUBY_BUILD}",
|
136
136
|
'--enable-shared',
|
137
137
|
'--disable-install-doc',
|
138
|
-
'--
|
139
|
-
'--without-tcl'
|
138
|
+
'--with-ext='
|
140
139
|
]
|
141
140
|
|
142
141
|
# Force Winsock2 for Ruby 1.8, 1.9 defaults to it
|
data/tasks/gem.rake
CHANGED
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: 0.9.
|
4
|
+
version: 0.9.6
|
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: 2016-03-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: 1.8.23
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project: rake-compiler
|
137
|
-
rubygems_version: 2.
|
137
|
+
rubygems_version: 2.5.1
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Rake-based Ruby Extension (C, Java) task generator.
|