# -*- ruby -*- require 'pathname' require 'find' require 'rubygems' require 'rake/extensiontask' @top_dir = Pathname(__FILE__).dirname.parent.expand_path @rb_glib2_dir = @top_dir + "glib2" task :default => :build def version @version ||= ENV["VERSION"] || guess_version end def guess_version versions = {} rbglib_h_path = @rb_glib2_dir + "ext" + "glib2" + "rbglib.h" rbglib_h_path.open do |rbglib_h| rbglib_h.each_line do |line| if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line versions[$1.downcase] = $2.to_i end end end ["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".") end package_name = "poppler" spec = Gem::Specification.new do |s| s.name = package_name s.summary = "Ruby/Poppler is a Ruby binding of poppler-glib." s.description = "Ruby/Poppler is a Ruby binding of poppler-glib." s.author = "The Ruby-GNOME2 Proejct Team" s.email = "ruby-gnome2-devel-en@lists.sourceforge.net" s.homepage = "http://ruby-gnome2.sourceforge.jp/" s.version = version s.platform = Gem::Platform::RUBY s.add_dependency("cairo", ">= 1.10.0") s.add_dependency("glib2", "= #{version}") s.extensions = FileList["ext/#{package_name}/extconf.rb"] s.require_paths = ["lib"] s.files = FileList["ChangeLog", "README", "Rakefile", "extconf.rb", "lib/**/*.rb", "{ext,sample,test}/**/*"] end Rake::GemPackageTask.new(spec) do |pkg| end Rake::ExtensionTask.new(package_name, spec) do |ext| ext.cross_compile = true ext.cross_compiling do |spec| if /mingw|mswin/ =~ spec.platform.to_s win32_dir = File.join("vendor", "local") win32_files = [] Find.find(win32_dir) do |file| next if /\.zip\z/ =~ file win32_files << file end spec.files += win32_files end end end namespace :win32 do desc "download Windows binaries" task :download do $LOAD_PATH.unshift((@rb_glib2_dir + "lib").to_s) require 'gnome2-win32-binary-downloader' GNOME2Win32BinaryDownloader.download(:packages => ["gtk"], :dependencies => ["poppler"]) end end