rake-compiler 0.7.7 → 0.7.8
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.
- data/History.txt +17 -0
- data/README.rdoc +20 -2
- data/lib/rake/extensiontask.rb +12 -4
- data/lib/rake/javaextensiontask.rb +1 -1
- data/spec/lib/rake/extensiontask_spec.rb +19 -4
- data/tasks/bin/cross-ruby.rake +4 -1
- data/tasks/gem.rake +1 -2
- metadata +5 -7
data/History.txt
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
=== 0.7.8 / 2011-04-26
|
2
|
+
|
3
|
+
* Enhancements:
|
4
|
+
* Bump default cross-ruby version to 1.8.7-p334.
|
5
|
+
* ExtensionTask now support config_includes to load additional directories.
|
6
|
+
[jfinkhaeuser]
|
7
|
+
|
8
|
+
Rake::ExtensionTask.new("myext", GEM_SPEC) do |ext|
|
9
|
+
ext.config_includes << File.expand_path("my", "custom", "dir")
|
10
|
+
end
|
11
|
+
|
12
|
+
* Bugfixes:
|
13
|
+
* Warn if compiled files exists in extension's source directory. Closes GH-35
|
14
|
+
* Workaround issue with WINE using proper build option. Closes GH-37
|
15
|
+
* Use FileUtils#install instead of cp. Closes GH-33 [Eric Wong]
|
16
|
+
* Update README instructions for OSX. Closes GH-29 [tmm1]
|
17
|
+
|
1
18
|
=== 0.7.7 / 2011-04-04
|
2
19
|
|
3
20
|
* Bugfixes:
|
data/README.rdoc
CHANGED
@@ -223,8 +223,26 @@ host machines, a simple <tt>apt-get install mingw32</tt> will be enough.
|
|
223
223
|
|
224
224
|
On Arch, <tt>mingw32</tt> is installed by running <tt>pacman -S mingw32-gcc</tt>
|
225
225
|
|
226
|
-
On OSX,
|
227
|
-
|
226
|
+
On OSX, we no longer recommend the usage of MacPorts <tt>mingw32</tt> package because
|
227
|
+
it stagnated in GCC version 3.4.5.
|
228
|
+
|
229
|
+
Instead we recommend you download mingw-w64 automated build packages available at
|
230
|
+
SourceForge:
|
231
|
+
|
232
|
+
http://sourceforge.net/downloads/mingw-w64/
|
233
|
+
|
234
|
+
Browse into <em>Toolchains targetting Win32</em> and then <em>Automated Builds</em>.
|
235
|
+
|
236
|
+
Files will be ordered by recency, find the latest one with version 1.0 in it,
|
237
|
+
like this one:
|
238
|
+
|
239
|
+
mingw-w32-1.0-bin_i686-darwin_20110422.tar.bz2
|
240
|
+
|
241
|
+
Download and extract. After that, make sure the bin directory is added to the PATH, eg:
|
242
|
+
|
243
|
+
export PATH=~/mingw-w64/w32/bin:$PATH
|
244
|
+
|
245
|
+
You can add this to your <tt>.profile</tt> to avoid the repitition.
|
228
246
|
|
229
247
|
=== I've got my tool-chain installed, now what?
|
230
248
|
|
data/lib/rake/extensiontask.rb
CHANGED
@@ -13,15 +13,18 @@ module Rake
|
|
13
13
|
attr_accessor :cross_platform
|
14
14
|
attr_accessor :cross_config_options
|
15
15
|
attr_accessor :no_native
|
16
|
+
attr_accessor :config_includes
|
16
17
|
|
17
18
|
def init(name = nil, gem_spec = nil)
|
18
19
|
super
|
19
20
|
@config_script = 'extconf.rb'
|
20
21
|
@source_pattern = "*.c"
|
22
|
+
@compiled_pattern = "*.{o,obj,so,bundle,dSYM}"
|
21
23
|
@cross_compile = false
|
22
24
|
@cross_config_options = []
|
23
25
|
@cross_compiling = nil
|
24
26
|
@no_native = false
|
27
|
+
@config_includes = []
|
25
28
|
end
|
26
29
|
|
27
30
|
def cross_platform
|
@@ -56,6 +59,10 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
56
59
|
|
57
60
|
super
|
58
61
|
|
62
|
+
unless compiled_files.empty?
|
63
|
+
warn "WARNING: rake-compiler found compiled files in '#{@ext_dir}' directory. Please remove them."
|
64
|
+
end
|
65
|
+
|
59
66
|
# only gems with 'ruby' platforms are allowed to define native tasks
|
60
67
|
define_native_tasks if !@no_native && (@gem_spec && @gem_spec.platform == 'ruby')
|
61
68
|
|
@@ -92,7 +99,7 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
92
99
|
# copy binary from temporary location to final lib
|
93
100
|
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
94
101
|
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_path, "#{tmp_path}/#{binary(platf)}"] do
|
95
|
-
|
102
|
+
install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
|
96
103
|
end
|
97
104
|
|
98
105
|
# binary in temporary folder depends on makefile and source files
|
@@ -109,7 +116,8 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
109
116
|
options = @config_options.dup
|
110
117
|
|
111
118
|
# include current directory
|
112
|
-
|
119
|
+
include_dirs = ['.'].concat(@config_includes).uniq.join(File::PATH_SEPARATOR)
|
120
|
+
cmd = [Gem.ruby, "-I#{include_dirs}"]
|
113
121
|
|
114
122
|
# if fake.rb is present, add to the command line
|
115
123
|
if t.prerequisites.include?("#{tmp_path}/fake.rb") then
|
@@ -361,8 +369,8 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
361
369
|
windows? ? 'NUL' : '/dev/null'
|
362
370
|
end
|
363
371
|
|
364
|
-
def
|
365
|
-
|
372
|
+
def compiled_files
|
373
|
+
FileList["#{@ext_dir}/#{@compiled_pattern}"]
|
366
374
|
end
|
367
375
|
|
368
376
|
def compiles_cross_platform
|
@@ -64,7 +64,7 @@ module Rake
|
|
64
64
|
# copy binary from temporary location to final lib
|
65
65
|
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
66
66
|
task "copy:#{@name}:#{platf}" => [lib_path, "#{tmp_path}/#{binary(platf)}"] do
|
67
|
-
|
67
|
+
install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
|
68
68
|
end
|
69
69
|
|
70
70
|
not_jruby_compile_msg = <<-EOF
|
@@ -80,6 +80,10 @@ describe Rake::ExtensionTask do
|
|
80
80
|
@ext.config_options.should be_empty
|
81
81
|
end
|
82
82
|
|
83
|
+
it "should have no includes preset to delegate" do
|
84
|
+
@ext.config_includes.should be_empty
|
85
|
+
end
|
86
|
+
|
83
87
|
it 'should default to current platform' do
|
84
88
|
@ext.platform.should == RUBY_PLATFORM
|
85
89
|
end
|
@@ -106,7 +110,7 @@ describe Rake::ExtensionTask do
|
|
106
110
|
|
107
111
|
context '(one extension)' do
|
108
112
|
before :each do
|
109
|
-
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
|
113
|
+
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
|
110
114
|
@ext = Rake::ExtensionTask.new('extension_one')
|
111
115
|
@ext_bin = ext_bin('extension_one')
|
112
116
|
@platform = RUBY_PLATFORM
|
@@ -190,11 +194,22 @@ describe Rake::ExtensionTask do
|
|
190
194
|
CLOBBER.should include('tmp')
|
191
195
|
end
|
192
196
|
end
|
197
|
+
|
198
|
+
it "should warn when pre-compiled files exist in extension directory" do
|
199
|
+
Rake::FileList.stub!(:[]).
|
200
|
+
and_return(["ext/extension_one/source.c"],
|
201
|
+
["ext/extension_one/source.o"])
|
202
|
+
|
203
|
+
_, err = capture_output do
|
204
|
+
Rake::ExtensionTask.new('extension_one')
|
205
|
+
end
|
206
|
+
err.should match(/rake-compiler found compiled files in 'ext\/extension_one' directory. Please remove them./)
|
207
|
+
end
|
193
208
|
end
|
194
209
|
|
195
210
|
context '(extension in custom location)' do
|
196
211
|
before :each do
|
197
|
-
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
|
212
|
+
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
|
198
213
|
@ext = Rake::ExtensionTask.new('extension_one') do |ext|
|
199
214
|
ext.ext_dir = 'custom/ext/foo'
|
200
215
|
end
|
@@ -212,7 +227,7 @@ describe Rake::ExtensionTask do
|
|
212
227
|
|
213
228
|
context '(native tasks)' do
|
214
229
|
before :each do
|
215
|
-
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
|
230
|
+
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
|
216
231
|
@spec = mock_gem_spec
|
217
232
|
@ext_bin = ext_bin('extension_one')
|
218
233
|
@platform = RUBY_PLATFORM
|
@@ -259,7 +274,7 @@ describe Rake::ExtensionTask do
|
|
259
274
|
before :each do
|
260
275
|
File.stub!(:exist?).and_return(true)
|
261
276
|
YAML.stub!(:load_file).and_return(mock_config_yml)
|
262
|
-
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"])
|
277
|
+
Rake::FileList.stub!(:[]).and_return(["ext/extension_one/source.c"], [])
|
263
278
|
@spec = mock_gem_spec
|
264
279
|
@config_file = File.expand_path("~/.rake-compiler/config.yml")
|
265
280
|
@ruby_ver = RUBY_VERSION
|
data/tasks/bin/cross-ruby.rake
CHANGED
@@ -26,6 +26,7 @@ rescue LoadError
|
|
26
26
|
end
|
27
27
|
|
28
28
|
require 'yaml'
|
29
|
+
require "rbconfig"
|
29
30
|
|
30
31
|
# load compiler helpers
|
31
32
|
# add lib directory to the search path
|
@@ -41,8 +42,9 @@ require 'rake/extensioncompiler'
|
|
41
42
|
|
42
43
|
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
|
43
44
|
USER_HOME = File.expand_path("~/.rake-compiler")
|
44
|
-
RUBY_CC_VERSION = "ruby
|
45
|
+
RUBY_CC_VERSION = "ruby-" << ENV.fetch("VERSION", "1.8.7-p334")
|
45
46
|
RUBY_SOURCE = ENV['SOURCE']
|
47
|
+
RUBY_BUILD = RbConfig::CONFIG["host"]
|
46
48
|
|
47
49
|
# grab the major "1.8" or "1.9" part of the version number
|
48
50
|
MAJOR = RUBY_CC_VERSION.match(/.*-(\d.\d).\d/)[1]
|
@@ -125,6 +127,7 @@ file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/
|
|
125
127
|
options = [
|
126
128
|
"--host=#{MINGW_HOST}",
|
127
129
|
"--target=#{MINGW_TARGET}",
|
130
|
+
"--build=#{RUBY_BUILD}",
|
128
131
|
'--enable-shared',
|
129
132
|
'--disable-install-doc',
|
130
133
|
'--without-tk',
|
data/tasks/gem.rake
CHANGED
@@ -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.7.
|
6
|
+
s.version = "0.7.8"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
|
9
9
|
# description and details
|
@@ -34,7 +34,6 @@ GEM_SPEC = Gem::Specification.new do |s|
|
|
34
34
|
s.require_path = 'lib'
|
35
35
|
|
36
36
|
# documentation
|
37
|
-
s.has_rdoc = true
|
38
37
|
s.rdoc_options << '--main' << 'README.rdoc' << '--title' << 'rake-compiler -- Documentation'
|
39
38
|
|
40
39
|
s.extra_rdoc_files = %w(README.rdoc LICENSE.txt History.txt)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 8
|
10
|
+
version: 0.7.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luis Lavena
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-04-26 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rake
|
@@ -119,7 +118,6 @@ files:
|
|
119
118
|
- History.txt
|
120
119
|
- LICENSE.txt
|
121
120
|
- cucumber.yml
|
122
|
-
has_rdoc: true
|
123
121
|
homepage: http://github.com/luislavena/rake-compiler
|
124
122
|
licenses:
|
125
123
|
- MIT
|
@@ -156,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
154
|
requirements: []
|
157
155
|
|
158
156
|
rubyforge_project: rake-compiler
|
159
|
-
rubygems_version: 1.
|
157
|
+
rubygems_version: 1.7.2
|
160
158
|
signing_key:
|
161
159
|
specification_version: 3
|
162
160
|
summary: Rake-based Ruby Extension (C, Java) task generator.
|