Sha256: 43a2d7f8f3e399b05ba0bfcf1296373054d6ad644ae281ba7d987166688046c4

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

require 'rake/clean'
CLEAN.include '**/*.o'
CLEAN.include "**/*.#{Config::MAKEFILE_CONFIG['DLEXT']}"
CLOBBER.include 'doc'
CLOBBER.include '**/*.log'
CLOBBER.include '**/Makefile'
CLOBBER.include '**/extconf.h'

# Determine the current version of the software
def ruby_atk_version
  gem 'glib2'
  require 'glib2'
  GLib::BINDING_VERSION.join('.')
end

CURRENT_VERSION = ruby_atk_version

# Make tasks -----------------------------------------------------
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
MAKECMD = ENV['MAKE_CMD'] || make_program
MAKEOPTS = ENV['MAKE_OPTS'] || ''

ATK_SO = "src/atk.#{Config::MAKEFILE_CONFIG['DLEXT']}"

file 'Makefile' => 'extconf.rb' do
  sh "ruby extconf.rb #{ENV['EXTCONF_OPTS']}"
end

def make(target = '')
  pid = system("#{MAKECMD} #{MAKEOPTS} #{target}")
  $?.exitstatus
end

# Let make handle dependencies between c/o/so - we'll just run it. 
file ATK_SO => (['Makefile'] + Dir['src/*.c'] + Dir['src/*.h']) do
  m = make
  fail "Make failed (status #{m})" unless m == 0
end

desc "Configure atk"
task :configure => ['Makefile']

desc "Compile the shared object"
task :compile => [ATK_SO]

task :default => :compile

desc 'Generate gem specification'
task :gemspec do
  require 'erb'
  tspec = ERB.new(File.read(File.join(File.dirname(__FILE__),'src','atk.gemspec.erb')))
  File.open(File.join(File.dirname(__FILE__),'atk.gemspec'),'wb') do|f|
    f << tspec.result
  end
end

desc 'Build gem'
task :package => :gemspec do
  require 'rubygems/specification'
  spec_source = File.read File.join(File.dirname(__FILE__),'atk.gemspec')
  spec = nil
  # see: http://gist.github.com/16215
  Thread.new { spec = eval("$SAFE = 3\n#{spec_source}") }.join
  spec.validate
  Gem::Builder.new(spec).build
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
atk-0.20.0 Rakefile