Created
December 30, 2012 01:43
-
-
Save oscardelben/4410470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mkmf' | |
create_makefile('ruby_http_parser') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oscar: ~/code/http-parser % ls -R ext | |
ruby_http_parser | |
ext/ruby_http_parser: | |
Makefile extconf.rb ruby_http_parser.bundle ruby_http_parser.c ruby_http_parser.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rake/testtask' | |
require 'rake/clean' | |
# rule to build the extension: this says | |
# that the extension should be rebuilt | |
# after any change to the files in ext | |
file "lib/http-parser/ruby_http_parser.so" => | |
Dir.glob("ext/ruby_http_parser/*{.rb,.c}") do | |
Dir.chdir("ext/ruby_http_parser") do | |
# this does essentially the same thing | |
# as what RubyGems does | |
ruby "extconf.rb" | |
sh "make" | |
end | |
cp "ext/ruby_http_parser/ruby_http_parser.so", "lib/http-parser" | |
end | |
# make the :test task depend on the shared | |
# object, so it will be built automatically | |
# before running the tests | |
task :test => "lib/http-parser/ruby_http_parser.so" | |
# use 'rake clean' and 'rake clobber' to | |
# easily delete generated files | |
CLEAN.include('ext/**/*{.o,.log,.so}') | |
CLEAN.include('ext/**/Makefile') | |
CLOBBER.include('lib/**/*.so') | |
# the same as before | |
Rake::TestTask.new do |t| | |
t.libs << 'test' | |
end | |
desc "Run tests" | |
task :default => :test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment