1 # $Id: Rakefile 55 2005-06-02 20:16:44Z 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
20 cc = ENV["CC"] || "cc"
22 ext_lib = "ext/eet_ext.so"
24 CLOBBER.include(ext_obj, ext_lib, "test/*.eet")
26 task :default => [ext_lib]
28 rule ".o" => [".c"] do |t|
29 archdir = Config::CONFIG["archdir"]
30 cflags = "#{ENV["CFLAGS"]} #{`eet-config --cflags`.strip} " +
33 sh "#{cc} #{cflags} -fPIC #{t.source} -c -o #{t.name}"
36 file ext_lib => ext_obj do |t|
37 libdir = Config::CONFIG["libdir"]
38 rubylib = Config::CONFIG["LIBRUBYARG_SHARED"]
39 ldflags = "#{ENV["LDFLAGS"]} #{`eet-config --libs`.strip} " +
40 "-L#{libdir} #{rubylib}"
42 sh "#{cc} #{ldflags} -shared -Wl #{t.prerequisites.join(" ")} " +
46 task :install => [ext_lib] do |t|
47 destdir = ENV["DESTDIR"] || ""
49 ddir = destdir + Config::CONFIG["sitearchdir"]
50 FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
51 FileUtils::Verbose.install(ext_lib, ddir, :mode => 0755)
53 ddir = destdir + Config::CONFIG["sitelibdir"]
54 FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir)
55 FileUtils::Verbose.install("lib/eet.rb", ddir, :mode => 0644)
58 task :test => [ext_lib]
60 Rake::TestTask.new do |t|
61 t.libs = ["lib", "ext", "test"]
62 t.test_files = FileList["test/test_*.rb"]
66 Rake::RDocTask.new do |t|
68 t.title = "Ruby-EET - EET bindings for Ruby"
69 t.options = ["--line-numbers", "--inline-source", "--main", "README"]
70 t.rdoc_files.include("README", "COPYING", "AUTHORS", "ChangeLog",
71 "NEWS", "ext/ext.c", "lib/eet.rb")
74 Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |t|
76 t.package_files.include("[A-Z]*", "ext/*.c", "lib/*.rb", "test/*.rb")
79 task :publish => [:rdoc, :package] do
80 p = Rake::CompositePublisher.new
81 p.add(Rake::SshFreshDirPublisher.new("code-monkey.de",
84 p.add(Rake::SshFilePublisher.new("code-monkey.de",
86 "#{PKG_NAME}-#{PKG_VERSION}.tar.gz"))