1 # $Id: Rakefile 22 2005-04-09 16:18:02Z tilman $
5 require "rake/testtask"
6 require "rake/rdoctask"
7 require "rake/packagetask"
8 require "rake/contrib/compositepublisher"
9 require "rake/contrib/sshpublisher"
11 # make sure we run at least Rake 0.5.0
12 if (RAKEVERSION.split(".").map { |p| p.to_i } <=> [0, 5, 0]) < 0
13 raise("Rake 0.5.0 or greater required")
17 PKG_VERSION = File.read("lib/eet.rb").
18 match(/^\s*VERSION = \"(.*)\"\s$/).captures.first
21 ext_lib = "ext/eet_ext.so"
23 CLOBBER.include(ext_obj)
24 CLOBBER.include(ext_lib)
25 CLOBBER.include(FileList["test/*.eet"])
27 archdir = Config::CONFIG["archdir"]
28 sitearchdir = Config::CONFIG["sitearchdir"]
29 libdir = Config::CONFIG["libdir"]
30 sitelibdir = Config::CONFIG["sitelibdir"]
31 rubylib = Config::CONFIG["LIBRUBYARG_SHARED"]
32 destdir = "#{ENV["DESTDIR"]}"
33 eet_cflags = `eet-config --cflags`.strip
34 eet_libs = `eet-config --libs`.strip
35 cflags = "#{ENV["CFLAGS"]} #{eet_cflags}"
36 ldflags = "#{ENV["LDFLAGS"]} #{eet_libs}"
38 task :default => [ext_lib]
40 rule ".o" => [".c"] do |t|
41 sh "cc #{cflags} -fPIC -I #{archdir} #{t.source} -c -o #{t.name}"
44 file ext_lib => ext_obj do |t|
45 sh "cc #{ldflags} -shared -Wl -L #{libdir} #{rubylib} " +
46 "#{t.prerequisites.join(" ")} -o #{t.name}"
49 task :install => [ext_lib] do |t|
50 FileUtils::Verbose.install(ext_lib, destdir + sitearchdir,
52 FileUtils::Verbose.install("lib/eet.rb", destdir + sitelibdir,
56 task :test => [ext_lib]
58 Rake::TestTask.new do |t|
59 t.libs = ["lib", "ext", "test"]
60 t.test_files = FileList["test/test_*.rb"]
64 Rake::RDocTask.new do |t|
66 t.title = "Ruby-EET - EET bindings for Ruby"
67 t.options = ["--line-numbers", "--inline-source", "--main", "README"]
68 t.rdoc_files.include("README", "COPYING", "AUTHORS", "ChangeLog",
69 "NEWS", "ext/ext.c", "lib/eet.rb")
72 Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |t|
74 t.package_files.include("[A-Z]*", "ext/*.c", "lib/*.rb", "test/*.rb")
77 task :publish => [:rdoc, :package] do
78 p = Rake::CompositePublisher.new
79 p.add(Rake::SshFreshDirPublisher.new("code-monkey.de",
82 p.add(Rake::SshFilePublisher.new("code-monkey.de",
84 "#{PKG_NAME}-#{PKG_VERSION}.tar.gz"))