-# $Id: Rakefile 320 2005-04-26 21:19:53Z tilman $
+# $Id: Rakefile 321 2005-04-27 14:01:11Z tilman $
require "library"
require "rake/clean"
CLOBBER.include("src/*/*.{s,}o")
ext_libs = ["ecore", "ecore_evas", "ecore_job", "ecore_x"].map do |lib|
- Library.new(lib, "src/#{lib}")
+ Library.new(lib, ENV["ECORE_PREFIX"] || "/usr/local", "src/#{lib}")
end
task :default => ext_libs.map { |l| l.so }
ext_libs.each do |lib|
file lib.so => lib.objects do |t|
- sh "cc #{lib.ldflags} -shared -Wl " +
- "-L #{Config::CONFIG['libdir']} " +
- Config::CONFIG["LIBRUBYARG_SHARED"] +
- " #{t.prerequisites.join(" ")} -o #{t.name}"
+ sh "cc #{lib.ldflags} #{t.prerequisites.join(" ")} -o #{t.name}"
end
lib.objects.each do |object|
file object => object.sub(/\.[^.]+$/, ".c") do |t|
- source = t.prerequisites.first
- sh "cc #{lib.cflags} -fPIC #{source} -c -o #{t.name}"
+ sh "cc #{lib.cflags} #{t.prerequisites.first} " +
+ "-c -o #{t.name}"
end
end
end
destdir = "#{ENV["DESTDIR"]}"
sitearchdir = Config::CONFIG['sitearchdir']
- FileUtils::Verbose.install(t.prerequisites, destdir + sitearchdir,
+ FileUtils::Verbose.install(t.prerequisites.to_a, destdir + sitearchdir,
:mode => 0755)
ddir = destdir + sitearchdir + "/ecore"
-# $Id: library.rb 319 2005-04-26 21:19:30Z tilman $
+# $Id: library.rb 321 2005-04-27 14:01:11Z tilman $
require "rbconfig"
class Library
- PREFIX = ENV["ECORE_PREFIX"] || "/usr/local/"
-
- def initialize(name, dir)
+ def initialize(name, prefix, dir, lib = name)
@name = name
+ @prefix = prefix
@dir = dir
+ @lib = lib
end
def ldflags
- "#{ENV["LDFLAGS"]} -L #{PREFIX}/lib -l#{@name}"
+ s = "#{ENV["LDFLAGS"]} -L #{@prefix}/lib -L " +
+ Config::CONFIG["libdir"] + " " +
+ Config::CONFIG["LIBRUBYARG_SHARED"] +
+ " -shared -Wl"
+ s << " -l#{@lib}" unless @lib.nil?
+ s
end
def cflags
- "#{ENV["CFLAGS"]} -I #{PREFIX}/include " +
+ "#{ENV["CFLAGS"]} -I #{@prefix}/include " +
"-I #{Config::CONFIG['archdir']} " +
- "-I #{Config::CONFIG['sitearchdir']}"
+ "-I #{Config::CONFIG['sitearchdir']} -fPIC"
end
def so