projects
/
ruby-eet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use ConfigureTask and ExtensionTask for the build.
[ruby-eet.git]
/
Rakefile
diff --git
a/Rakefile
b/Rakefile
index 43d7a3abf0dc1badf01cba2c3891e69c731402b3..3ab381d3ba8638f7bb89fb2b34d7a08fe77a4d91 100644
(file)
--- a/
Rakefile
+++ b/
Rakefile
@@
-1,5
+1,3
@@
-# $Id: Rakefile 55 2005-06-02 20:16:44Z tilman $
-
require "rbconfig"
require "rake/clean"
require "rake/testtask"
require "rbconfig"
require "rake/clean"
require "rake/testtask"
@@
-8,6
+6,9
@@
require "rake/packagetask"
require "rake/contrib/compositepublisher"
require "rake/contrib/sshpublisher"
require "rake/contrib/compositepublisher"
require "rake/contrib/sshpublisher"
+require "rake/configuretask"
+require "rake/extensiontask"
+
# make sure we run at least Rake 0.5.0
if (RAKEVERSION.split(".").map { |p| p.to_i } <=> [0, 5, 0]) < 0
raise("Rake 0.5.0 or greater required")
# make sure we run at least Rake 0.5.0
if (RAKEVERSION.split(".").map { |p| p.to_i } <=> [0, 5, 0]) < 0
raise("Rake 0.5.0 or greater required")
@@
-17,45
+18,46
@@
PKG_NAME = "ruby-eet"
PKG_VERSION = File.read("lib/eet.rb").
match(/^\s*VERSION = \"(.*)\"\s$/).captures.first
PKG_VERSION = File.read("lib/eet.rb").
match(/^\s*VERSION = \"(.*)\"\s$/).captures.first
-cc = ENV["CC"] || "cc"
-ext_obj = "ext/ext.o"
-ext_lib = "ext/eet_ext.so"
+CLOBBER.include("test/*.eet")
-CLOBBER.include(ext_obj, ext_lib, "test/*.eet")
+task :default => [:ext]
-task :default => [ext_lib]
+config = Rake::ConfigureTask.new do |t|
+ t.tests << Rake::ConfigureTask::
+ PkgConfigTest.new("eet", :is_critical => true)
+end
-rule ".o" => [".c"] do |t|
- archdir = Config::CONFIG["archdir"]
- cflags = "#{ENV["CFLAGS"]} #{`eet-config --cflags`.strip} " +
- "-I#{archdir}"
+task :ext => [:pre_ext]
- sh "#{cc} #{cflags} -fPIC #{t.source} -c -o #{t.name}"
+ext = Rake::ExtensionTask.new :ext => [:ext] do |t|
+ t.dir = "ext"
+ t.lib_name = "#{t.dir}/eet_ext.so"
end
end
-file ext_lib => ext_obj do |t|
- libdir = Config::CONFIG["libdir"]
- rubylib = Config::CONFIG["LIBRUBYARG_SHARED"]
- ldflags = "#{ENV["LDFLAGS"]} #{`eet-config --libs`.strip} " +
- "-L#{libdir} #{rubylib}"
+task :pre_ext => [:configure] do
+ ext.link_libs << config.eet.libs
+
+ cflags = [
+ ext.env[:cflags],
+ config.eet.cflags
+ ]
- sh "#{cc} #{ldflags} -shared -Wl #{t.prerequisites.join(" ")} " +
- "-o #{t.name}"
+ ext.env.update(:cflags => cflags)
end
end
-task :install => [
ext_lib
] do |t|
+task :install => [
:ext
] do |t|
destdir = ENV["DESTDIR"] || ""
ddir = destdir + Config::CONFIG["sitearchdir"]
FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
destdir = ENV["DESTDIR"] || ""
ddir = destdir + Config::CONFIG["sitearchdir"]
FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
- FileUtils::Verbose.install(ext
_lib
, ddir, :mode => 0755)
+ FileUtils::Verbose.install(ext
.lib_name
, ddir, :mode => 0755)
ddir = destdir + Config::CONFIG["sitelibdir"]
FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
FileUtils::Verbose.install("lib/eet.rb", ddir, :mode => 0644)
end
ddir = destdir + Config::CONFIG["sitelibdir"]
FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
FileUtils::Verbose.install("lib/eet.rb", ddir, :mode => 0644)
end
-task :test => [
ext_lib
]
+task :test => [
:ext
]
Rake::TestTask.new do |t|
t.libs = ["lib", "ext", "test"]
Rake::TestTask.new do |t|
t.libs = ["lib", "ext", "test"]
@@
-67,19
+69,27
@@
Rake::RDocTask.new do |t|
t.rdoc_dir = "doc"
t.title = "Ruby-EET - EET bindings for Ruby"
t.options = ["--line-numbers", "--inline-source", "--main", "README"]
t.rdoc_dir = "doc"
t.title = "Ruby-EET - EET bindings for Ruby"
t.options = ["--line-numbers", "--inline-source", "--main", "README"]
- t.rdoc_files.include("README", "COPYING", "AUTHORS",
"ChangeLog",
+ t.rdoc_files.include("README", "COPYING", "AUTHORS",
"NEWS", "ext/ext.c", "lib/eet.rb")
end
"NEWS", "ext/ext.c", "lib/eet.rb")
end
+CLOBBER.include("ChangeLog")
+
+file "ChangeLog" do
+ `git log > ChangeLog`
+end
+
Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |t|
t.need_tar_gz = true
Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |t|
t.need_tar_gz = true
- t.package_files.include("[A-Z]*", "ext/*.c", "lib/*.rb", "test/*.rb")
+ t.package_files.include("AUTHORS", "ChangeLog", "COPYING", "NEWS",
+ "README", "Rakefile",
+ "ext/*.c", "lib/*.rb", "test/*.rb")
end
task :publish => [:rdoc, :package] do
p = Rake::CompositePublisher.new
p.add(Rake::SshFreshDirPublisher.new("code-monkey.de",
end
task :publish => [:rdoc, :package] do
p = Rake::CompositePublisher.new
p.add(Rake::SshFreshDirPublisher.new("code-monkey.de",
- "public_
html/
docs/" +
+ "public_docs/" +
PKG_NAME, "doc"))
p.add(Rake::SshFilePublisher.new("code-monkey.de",
".", "pkg",
PKG_NAME, "doc"))
p.add(Rake::SshFilePublisher.new("code-monkey.de",
".", "pkg",