rake-compiler 0.3.0 → 0.3.1
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 +13 -0
- data/Rakefile +1 -1
- data/features/step_definitions/cross_compilation.rb +7 -6
- data/features/step_definitions/gem.rb +2 -1
- data/lib/rake/extensiontask.rb +25 -12
- data/tasks/bin/cross-ruby.rake +19 -4
- data/tasks/common.rake +3 -0
- data/tasks/gem.rake +1 -1
- data/tasks/news.rake +80 -0
- data/tasks/rdoc.rake +1 -1
- data/tasks/rdoc_publish.rake +44 -0
- data/tasks/release.rake +1 -6
- metadata +4 -2
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 0.3.1 / 2009-01-09
|
2
|
+
|
3
|
+
* 2 Minor Enhancements:
|
4
|
+
|
5
|
+
* Download cross-ruby source code using HTTP instead of FTP.
|
6
|
+
* Disabled Tcl/Tk extension building on cross-ruby (helps with 1.9).
|
7
|
+
|
8
|
+
* 3 Bug fixes:
|
9
|
+
|
10
|
+
* Workaround bug introduced by lack of Gem::Specification cloning. Fixes DM LH #757.
|
11
|
+
* Use proper binary extension on OSX (reported by Dirkjan Bussink).
|
12
|
+
* Ensure lib/binary task is defined prior clear of requisites.
|
13
|
+
|
1
14
|
=== 0.3.0 / 2008-12-07
|
2
15
|
|
3
16
|
* 1 Major Enhancement:
|
data/Rakefile
CHANGED
@@ -6,13 +6,14 @@ Given %r{^I'm running a POSIX operating system$} do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
Given %r{^I've installed cross compile toolchain$} do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
compilers = %w(i586-mingw32msvc-gcc i386-mingw32-gcc)
|
10
|
+
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
11
|
+
compiler = compilers.find do |comp|
|
12
|
+
paths.find do |path|
|
13
|
+
File.exist? File.join(path, comp)
|
14
|
+
end
|
14
15
|
end
|
15
|
-
raise "Cannot locate '#{compiler}' in the PATH." unless
|
16
|
+
raise "Cannot locate '#{compiler}' in the PATH." unless compiler
|
16
17
|
end
|
17
18
|
|
18
19
|
Then /^binaries for platform '(.*)' get generated$/ do |platform|
|
@@ -24,6 +24,7 @@ end
|
|
24
24
|
|
25
25
|
def gem_file_platform(folder, name, version, platform = nil)
|
26
26
|
file = "#{folder}/#{name}-#{version}"
|
27
|
-
file << "-" << (platform || Gem::Platform.
|
27
|
+
file << "-" << (platform || Gem::Platform.new(RUBY_PLATFORM).to_s)
|
28
28
|
file << ".gem"
|
29
|
+
file
|
29
30
|
end
|
data/lib/rake/extensiontask.rb
CHANGED
@@ -76,7 +76,7 @@ module Rake
|
|
76
76
|
|
77
77
|
# cleanup and clobbering
|
78
78
|
CLEAN.include(tmp_path)
|
79
|
-
CLOBBER.include("#{@lib_dir}/#{binary}")
|
79
|
+
CLOBBER.include("#{@lib_dir}/#{binary(platf)}")
|
80
80
|
CLOBBER.include("#{@tmp_dir}")
|
81
81
|
|
82
82
|
# directories we need
|
@@ -85,13 +85,13 @@ module Rake
|
|
85
85
|
|
86
86
|
# copy binary from temporary location to final lib
|
87
87
|
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
88
|
-
task "copy:#{@name}:#{platf}" => [lib_dir, "#{tmp_path}/#{binary}"] do
|
89
|
-
cp "#{tmp_path}/#{binary}", "#{@lib_dir}/#{binary}"
|
88
|
+
task "copy:#{@name}:#{platf}" => [lib_dir, "#{tmp_path}/#{binary(platf)}"] do
|
89
|
+
cp "#{tmp_path}/#{binary(platf)}", "#{@lib_dir}/#{binary(platf)}"
|
90
90
|
end
|
91
91
|
|
92
92
|
# binary in temporary folder depends on makefile and source files
|
93
93
|
# tmp/extension_name/extension_name.{so,bundle}
|
94
|
-
file "#{tmp_path}/#{binary}" => ["#{tmp_path}/Makefile"] + source_files do
|
94
|
+
file "#{tmp_path}/#{binary(platf)}" => ["#{tmp_path}/Makefile"] + source_files do
|
95
95
|
chdir tmp_path do
|
96
96
|
sh make
|
97
97
|
end
|
@@ -136,7 +136,7 @@ module Rake
|
|
136
136
|
# platform matches the indicated one.
|
137
137
|
if platf == RUBY_PLATFORM then
|
138
138
|
# ensure file is always copied
|
139
|
-
file "#{@lib_dir}/#{binary}" => ["copy:#{name}:#{platf}"]
|
139
|
+
file "#{@lib_dir}/#{binary(platf)}" => ["copy:#{name}:#{platf}"]
|
140
140
|
|
141
141
|
task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
|
142
142
|
task "compile" => ["compile:#{platf}"]
|
@@ -150,10 +150,12 @@ module Rake
|
|
150
150
|
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}"
|
151
151
|
|
152
152
|
# create 'native:gem_name' and chain it to 'native' task
|
153
|
-
spec = @gem_spec.dup
|
154
|
-
|
155
153
|
unless Rake::Task.task_defined?("native:#{@gem_spec.name}:#{platf}")
|
156
154
|
task "native:#{@gem_spec.name}:#{platf}" do |t|
|
155
|
+
# FIXME: truly duplicate the Gem::Specification
|
156
|
+
# workaround the lack of #dup for Gem::Specification
|
157
|
+
spec = Gem::Specification.from_yaml(gem_spec.to_yaml)
|
158
|
+
|
157
159
|
# adjust to specified platform
|
158
160
|
spec.platform = platf
|
159
161
|
|
@@ -185,7 +187,7 @@ module Rake
|
|
185
187
|
end
|
186
188
|
|
187
189
|
# add binaries to the dependency chain
|
188
|
-
task "native:#{@gem_spec.name}:#{platf}" => ["#{tmp_path}/#{binary}"]
|
190
|
+
task "native:#{@gem_spec.name}:#{platf}" => ["#{tmp_path}/#{binary(platf)}"]
|
189
191
|
|
190
192
|
# Allow segmented packaging by platfrom (open door for 'cross compile')
|
191
193
|
task "native:#{platf}" => ["native:#{@gem_spec.name}:#{platf}"]
|
@@ -240,8 +242,11 @@ module Rake
|
|
240
242
|
task 'compile' => ["compile:#{cross_platform}"]
|
241
243
|
|
242
244
|
# clear lib/binary dependencies and trigger cross platform ones
|
243
|
-
|
244
|
-
|
245
|
+
# check if lib/binary is defined (damn bundle versus so versus dll)
|
246
|
+
if Rake::Task.task_defined?("#{@lib_dir}/#{binary(cross_platform)}") then
|
247
|
+
Rake::Task["#{@lib_dir}/#{binary(cross_platform)}"].prerequisites.clear
|
248
|
+
end
|
249
|
+
file "#{@lib_dir}/#{binary(cross_platform)}" => ["copy:#{@name}:#{cross_platform}"]
|
245
250
|
|
246
251
|
# if everything for native task is in place
|
247
252
|
if @gem_spec && @gem_spec.platform == 'ruby' then
|
@@ -259,8 +264,16 @@ module Rake
|
|
259
264
|
RUBY_PLATFORM =~ /mswin/ ? 'nmake' : 'make'
|
260
265
|
end
|
261
266
|
|
262
|
-
def binary
|
263
|
-
|
267
|
+
def binary(platform = nil)
|
268
|
+
ext = case platform
|
269
|
+
when /darwin/
|
270
|
+
'bundle'
|
271
|
+
when /mingw|mswin|linux/
|
272
|
+
'so'
|
273
|
+
else
|
274
|
+
RbConfig::CONFIG['DLEXT']
|
275
|
+
end
|
276
|
+
"#{@name}.#{ext}"
|
264
277
|
end
|
265
278
|
|
266
279
|
def source_files
|
data/tasks/bin/cross-ruby.rake
CHANGED
@@ -27,6 +27,18 @@ RUBY_CC_VERSION = "ruby-#{ENV['VERSION'] || '1.8.6-p287'}"
|
|
27
27
|
# grab the major "1.8" or "1.9" part of the version number
|
28
28
|
MAJOR = RUBY_CC_VERSION.match(/.*-(\d.\d).\d/)[1]
|
29
29
|
|
30
|
+
# Sorry!
|
31
|
+
# On some systems (linux) you get i586 targets, on others i386 targets, at
|
32
|
+
# present, I only know to search for them.
|
33
|
+
compilers = %w(i586-mingw32msvc-gcc i386-mingw32-gcc)
|
34
|
+
paths = ENV['PATH'].split(File::PATH_SEPARATOR)
|
35
|
+
compiler = compilers.find do |comp|
|
36
|
+
paths.find do |path|
|
37
|
+
File.exist? File.join(path, comp)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
MINGW_HOST = compiler[0..-5]
|
41
|
+
|
30
42
|
# define a location where sources will be stored
|
31
43
|
directory "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
|
32
44
|
directory "#{USER_HOME}/builds/#{RUBY_CC_VERSION}"
|
@@ -45,7 +57,7 @@ CLOBBER.include("#{USER_HOME}/config.yml")
|
|
45
57
|
file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.gz" => ["#{USER_HOME}/sources"] do |t|
|
46
58
|
# download the source file using wget or curl
|
47
59
|
chdir File.dirname(t.name) do
|
48
|
-
url = "
|
60
|
+
url = "http://ftp.ruby-lang.org/pub/ruby/#{MAJOR}/#{File.basename(t.name)}"
|
49
61
|
sh "wget #{url} || curl -O #{url}"
|
50
62
|
end
|
51
63
|
end
|
@@ -82,7 +94,7 @@ file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in" => ["#{USER_HOME}/sou
|
|
82
94
|
end
|
83
95
|
|
84
96
|
task :mingw32 do
|
85
|
-
unless
|
97
|
+
unless MINGW_HOST then
|
86
98
|
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
87
99
|
warn "Please refer to your distro documentation about installation."
|
88
100
|
fail
|
@@ -103,10 +115,13 @@ file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/
|
|
103
115
|
|
104
116
|
# set the configure options
|
105
117
|
options = [
|
106
|
-
|
118
|
+
"--host=#{MINGW_HOST}",
|
107
119
|
'--target=i386-mingw32',
|
108
120
|
'--build=i686-linux',
|
109
|
-
'--enable-shared'
|
121
|
+
'--enable-shared',
|
122
|
+
'--disable-install-doc',
|
123
|
+
'--without-tk',
|
124
|
+
'--without-tcl'
|
110
125
|
]
|
111
126
|
|
112
127
|
chdir File.dirname(t.name) do
|
data/tasks/common.rake
CHANGED
data/tasks/gem.rake
CHANGED
data/tasks/news.rake
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rubyforge', '~> 1.0.1'
|
3
|
+
require 'rubyforge'
|
4
|
+
rescue Exception
|
5
|
+
nil
|
6
|
+
end
|
7
|
+
|
8
|
+
if defined?(RubyForge) then
|
9
|
+
if defined?(GEM_SPEC) then
|
10
|
+
desc 'Create news email file and post to RubyForge.'
|
11
|
+
task :announce do |t|
|
12
|
+
ver = ENV['VERSION'] or fail "Must supply VERSION (rake announce VERSION=x.y.z)."
|
13
|
+
|
14
|
+
# compare versions to avoid mistakes
|
15
|
+
unless ver == GEM_SPEC.version.to_s then
|
16
|
+
fail "Version mismatch (supplied and specification versions differ)."
|
17
|
+
end
|
18
|
+
|
19
|
+
# no homepage? why announce it then?!
|
20
|
+
if GEM_SPEC.homepage == 'TODO' or GEM_SPEC.homepage.nil? then
|
21
|
+
fail "Must define homepage in your gem specification."
|
22
|
+
end
|
23
|
+
|
24
|
+
# no rubyforge project? no release for you!
|
25
|
+
if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
|
26
|
+
fail "Must define rubyforge_project in your gem specification."
|
27
|
+
end
|
28
|
+
|
29
|
+
# instantiate a RubyForge object
|
30
|
+
rf = RubyForge.new.configure
|
31
|
+
|
32
|
+
# read project info and overview
|
33
|
+
notes = begin
|
34
|
+
r = File.read("README.rdoc")
|
35
|
+
r.split(/^(=+ .*)/)[1..4].join.strip
|
36
|
+
rescue
|
37
|
+
warn "Missing README.rdoc"
|
38
|
+
''
|
39
|
+
end
|
40
|
+
|
41
|
+
# read changes
|
42
|
+
changes = begin
|
43
|
+
h = File.read("History.txt")
|
44
|
+
h.split(/^(==.*)/)[1..2].join.strip
|
45
|
+
rescue
|
46
|
+
warn "Missing History.txt"
|
47
|
+
''
|
48
|
+
end
|
49
|
+
|
50
|
+
# standard fields
|
51
|
+
subject = "#{GEM_SPEC.name} #{GEM_SPEC.version} Released"
|
52
|
+
title = "#{GEM_SPEC.name} version #{GEM_SPEC.version} has been released!"
|
53
|
+
body = "#{notes}\n\nChanges:\n\n#{changes}"
|
54
|
+
urls = [GEM_SPEC.homepage, "http://rubyforge.org/projects/#{GEM_SPEC.rubyforge_project}"].map { |u| "* <#{u.strip}>" }.join("\n")
|
55
|
+
|
56
|
+
puts "Logging in RubyForge..."
|
57
|
+
rf.login
|
58
|
+
|
59
|
+
puts "Generating email.txt..."
|
60
|
+
File.open("email.txt", "w") do |mail|
|
61
|
+
mail.puts "Subject: [ANN] #{subject}"
|
62
|
+
mail.puts
|
63
|
+
mail.puts title
|
64
|
+
mail.puts
|
65
|
+
mail.puts urls
|
66
|
+
mail.puts
|
67
|
+
mail.puts body
|
68
|
+
end
|
69
|
+
puts "Created email.txt"
|
70
|
+
|
71
|
+
puts "Posting news for #{GEM_SPEC.name} version #{GEM_SPEC.version}..."
|
72
|
+
rf.post_news GEM_SPEC.rubyforge_project, subject, "#{title}\n\n#{body}"
|
73
|
+
puts "Done."
|
74
|
+
end
|
75
|
+
else
|
76
|
+
warn "no GEM_SPEC is found or defined. 'announce' task cannot work without it."
|
77
|
+
end
|
78
|
+
else
|
79
|
+
warn "rubyforge gem is required to generate announces, please install it (gem install rubyforge)."
|
80
|
+
end
|
data/tasks/rdoc.rake
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
begin
|
2
|
+
gem 'rubyforge', '~> 1.0.1'
|
3
|
+
require 'rubyforge'
|
4
|
+
rescue Exception
|
5
|
+
nil
|
6
|
+
end
|
7
|
+
|
8
|
+
if defined?(RubyForge) then
|
9
|
+
if defined?(DOC) && defined?(GEM_SPEC) then
|
10
|
+
desc "Publish RDoc to RubyForge"
|
11
|
+
task :publish => [:clobber_rdoc, :rdoc] do
|
12
|
+
config_file = File.expand_path('~/.rubyforge/user-config.yml')
|
13
|
+
fail "You need rubyforge properly configured." unless File.exist?(config_file)
|
14
|
+
|
15
|
+
# no rubyforge project? no release for you!
|
16
|
+
if GEM_SPEC.rubyforge_project == 'TODO' or GEM_SPEC.rubyforge_project.nil? then
|
17
|
+
fail "Must define rubyforge_project in your gem specification."
|
18
|
+
end
|
19
|
+
|
20
|
+
# use YAML to load configuration file
|
21
|
+
config = YAML.load_file(config_file)
|
22
|
+
|
23
|
+
host = "#{config['username']}@rubyforge.org"
|
24
|
+
remote_dir = "/var/www/gforge-projects/#{GEM_SPEC.rubyforge_project}/"
|
25
|
+
local_dir = DOC.rdoc_dir
|
26
|
+
|
27
|
+
# use PuTTY pscp or scp on other platforms
|
28
|
+
ssh_exe = RUBY_PLATFORM =~ /mswin|mingw/ ? 'pscp' : 'scp'
|
29
|
+
|
30
|
+
# construct the command
|
31
|
+
cmd = [ssh_exe]
|
32
|
+
cmd << '-r' << '-q' # recursive and quiet options
|
33
|
+
cmd << "#{local_dir}/*"
|
34
|
+
cmd << "#{host}:#{remote_dir}"
|
35
|
+
|
36
|
+
puts "Publishing RDocs to RubyForge..."
|
37
|
+
sh cmd.join(' ')
|
38
|
+
end
|
39
|
+
else
|
40
|
+
warn "You need a GEM_SPEC and DOC rdoc definitions present. task publish not defined."
|
41
|
+
end
|
42
|
+
else
|
43
|
+
warn "rubyforge gem is required to generate releases, please install it (gem install rubyforge)."
|
44
|
+
end
|
data/tasks/release.rake
CHANGED
@@ -7,6 +7,7 @@ end
|
|
7
7
|
|
8
8
|
if defined?(RubyForge) then
|
9
9
|
if defined?(GEM_SPEC) then
|
10
|
+
desc 'Package and upload to RubyForge'
|
10
11
|
task :release => [:clobber, :package] do |t|
|
11
12
|
ver = ENV['VERSION'] or fail "Must supply VERSION (rake release VERSION=x.y.z)."
|
12
13
|
|
@@ -50,12 +51,6 @@ if defined?(RubyForge) then
|
|
50
51
|
# prepare configuration
|
51
52
|
rf.configure config
|
52
53
|
|
53
|
-
# ensure this was not released before
|
54
|
-
releases = rf.autoconfig['release_ids']
|
55
|
-
if releases.has_key?(GEM_SPEC.name) and releases[GEM_SPEC.name][GEM_SPEC.version] then
|
56
|
-
fail "Release #{GEM_SPEC.version} already exist. Unable to release."
|
57
|
-
end
|
58
|
-
|
59
54
|
files = FileList["pkg/#{GEM_SPEC.name}-#{GEM_SPEC.version}*.*"].to_a
|
60
55
|
fail "No files found for the release." if files.empty?
|
61
56
|
|
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Lavena
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-09 00:00:00 -02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -56,7 +56,9 @@ files:
|
|
56
56
|
- tasks/common.rake
|
57
57
|
- tasks/cucumber.rake
|
58
58
|
- tasks/gem.rake
|
59
|
+
- tasks/news.rake
|
59
60
|
- tasks/rdoc.rake
|
61
|
+
- tasks/rdoc_publish.rake
|
60
62
|
- tasks/release.rake
|
61
63
|
- tasks/rspec.rake
|
62
64
|
- Rakefile
|