Sha256: 01a53074eae04c3a85347435a2acb10325bf0b1ca4ced5492ecbeab7faa03535

Contents?: true

Size: 1.39 KB

Versions: 11

Compression:

Stored size: 1.39 KB

Contents

namespace :extconf do
  extension = File.basename(__FILE__, '.rake')

  ext = "ext/#{extension}"
  ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
  ext_files = FileList[
    "#{ext}/*.c",
    "#{ext}/*.h",
    "#{ext}/*.rl",
    "#{ext}/extconf.rb",
    "#{ext}/Makefile",
    # "lib"
  ]


  task :compile => extension do
    if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
      STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
      STDERR.puts "Gem actually failed to build.  Your system is"
      STDERR.puts "NOT configured properly to build #{GEM_NAME}."
      STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
      exit(1)
    end
  end

  desc "Builds just the #{extension} extension"
  task extension.to_sym => ["#{ext}/Makefile", ext_so, "lib/#{extension}.#{Config::CONFIG['DLEXT']}"]

  file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
    Dir.chdir(ext) do ruby "extconf.rb" end
  end
  
  file "lib/#{extension}.#{Config::CONFIG['DLEXT']}"  => ext_so do
    require "fileutils"
    puts "Copying #{ext_so} into lib directory for testing."
    FileUtils.cp(ext_so,"lib/#{extension}.#{Config::CONFIG['DLEXT']}")
  end

  file ext_so => ext_files do
    Dir.chdir(ext) do
      sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
        if !ok
          require "fileutils"
          FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rubypython-0.2.10 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.9 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.8 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.7 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.1 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.0 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.5 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.4 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.6 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.3 tasks/extconf/rubypython_bridge.rake
rubypython-0.2.2 tasks/extconf/rubypython_bridge.rake