Permalink
Browse files

use rake-compiler instead of own rakefile hacks for compilation

  • Loading branch information...
pietern committed Feb 10, 2010
1 parent 52009f4 commit b0f47c2f038dee34565969caa8d2948ed91dce50
Showing with 16 additions and 36 deletions.
  1. +1 −6 .gitignore
  2. +11 −25 Rakefile
  3. +0 −5 ext/extconf.rb
  4. +4 −0 ext/simple_mmap/extconf.rb
  5. 0 ext/{ → simple_mmap}/mapped_file.c
View
@@ -1,11 +1,6 @@
-/ext/*.o
-/ext/*.bundle
-/ext/*.so
-/ext/*.dll
-/ext/mkmf.log
+/tmp
/lib/simple_mmap/*.bundle
/lib/simple_mmap/*.so
/lib/simple_mmap/*.dll
-/ext/Makefile
/pkg
/doc/*
View
@@ -7,43 +7,29 @@ begin
gem.name = "simple-mmap"
gem.email = "pcnoordhuis@gmail.com"
gem.homepage = "http://github.com/pietern/simple-mmap"
- gem.summary = "Read-only wrapper for mmap"
+ gem.summary = "A simplistic interface for reading memory mapped files"
gem.authors = ["Johan Sørensen", "Pieter Noordhuis"]
- gem.extensions = ["ext/extconf.rb"]
- gem.files = FileList['ext/Makefile', 'ext/*.{c,rb}', 'lib/**/*.rb', 'test/**/*.rb']
+ gem.extensions = ["ext/**/extconf.rb"]
+ gem.files = FileList['Rakefile', 'ext/**/*.{c,rb}', 'lib/**/*.rb', 'test/**/*.rb']
gem.require_paths = ["ext", "lib"]
+
+ gem.add_development_dependency "rake-compiler", "0.7.0"
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
-DLEXT = Config::CONFIG['DLEXT']
-file 'ext/Makefile' => FileList['ext/{*.c,*.h,*.rb}'] do
- chdir('ext') { ruby 'extconf.rb' }
-end
-
-file "ext/mapped_file.#{DLEXT}" => FileList['ext/Makefile', 'ext/*.{c,h,rb}'] do |f|
- sh 'cd ext && make'
-end
-
-namespace :ext do
- task :clean do
- %W[
- ext/Makefile
- ext/mapped_file.#{DLEXT}
- ].each do |file|
- sh "rm -f #{file}"
- end
- end
-
- desc 'Build the mapped_file extension'
- task :build => [:clean, "ext/mapped_file.#{DLEXT}"]
+gem 'rake-compiler', '>= 0.7.0'
+require 'rake/extensiontask'
+Rake::ExtensionTask.new('simple_mmap') do |ext|
+ ext.name = "mapped_file"
+ ext.lib_dir = File.join('lib', 'simple_mmap')
end
require 'rake/testtask'
-Rake::TestTask.new(:test => "ext:build") do |test|
+Rake::TestTask.new(:test => :compile) do |test|
test.libs << 'ext'
test.verbose = true
end
View
@@ -1,5 +0,0 @@
-require 'mkmf'
-
-dir_config('mapped_file')
-have_func('mmap')
-create_makefile('mapped_file')
@@ -0,0 +1,4 @@
+require 'mkmf'
+
+have_func('mmap')
+create_makefile('simple_mmap/mapped_file')
File renamed without changes.

0 comments on commit b0f47c2

Please sign in to comment.