Sha256: b3724f90b8c0b88cbb834f2844a0d387b0c558cb85af49a9475ee57c45546a37

Contents?: true

Size: 1.12 KB

Versions: 67

Compression:

Stored size: 1.12 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 ]

  file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
    Dir.chdir(ext) do ruby "extconf.rb" end
  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

67 entries across 67 versions & 9 rubygems

Version Path
newgem-0.21.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.22.1 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.22.2 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.23.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.23.1 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.25.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.24.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.22.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.28.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.27.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-0.29.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.3 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.1 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.2 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.4 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.5 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.6 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.0.7 rubygems_generators/extconf/templates/tasks/extconf_name.rake
newgem-1.1.0 rubygems_generators/extconf/templates/tasks/extconf_name.rake