Sha256: 626e4e3f0e8b9f2eb4977815f3b8d09c5aa36c123b90c63a8938ccf68bea2f3a

Contents?: true

Size: 988 Bytes

Versions: 5

Compression:

Stored size: 988 Bytes

Contents

gem 'rake-compiler', '>= 0.7.5'
require "rake/extensiontask"

def gemspec
  @clean_gemspec ||= eval(File.read(File.expand_path('../../yajl-ruby.gemspec', __FILE__)))
end

Rake::ExtensionTask.new("yajl", gemspec) do |ext|
  # automatically add build options to avoid need of manual input
  ext.cross_compile = true
  ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']

  # inject 1.8/1.9 pure-ruby entry point when cross compiling only
  ext.cross_compiling do |spec|
    spec.files << 'lib/yajl/yajl.rb'
  end

  ext.lib_dir = File.join 'lib', 'yajl'

  # clean compiled extension
  CLEAN.include "#{ext.lib_dir}/*.#{RbConfig::CONFIG['DLEXT']}"
end
Rake::Task[:spec].prerequisites << :compile

file 'lib/yajl/yajl.rb' do |t|
  name = gemspec.name
  File.open(t.name, 'wb') do |f|
    f.write <<-eoruby
RUBY_VERSION =~ /(\\d+.\\d+)/
require "#{name}/\#{$1}/#{name}"
    eoruby
  end
end

if Rake::Task.task_defined?(:cross)
  Rake::Task[:cross].prerequisites << "lib/yajl/yajl.rb"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yajl-ruby-0.8.3 tasks/compile.rake
yajl-ruby-0.8.2 tasks/compile.rake
yajl-ruby-0.8.1 tasks/compile.rake
yajl-ruby-0.8.0 tasks/compile.rake
yajl-ruby-0.7.9 tasks/compile.rake