Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
namespace :extconf do | |||
desc "Compiles the Ruby extension" | |||
task :compile | |||
end | |||
|
|||
task :compile => "extconf:compile" | |||
|
|||
task :test => :compile | |||
|
|||
BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}" | |||
$hoe.clean_globs |= ["ext/**/#{BIN}", "lib/**/#{BIN}", 'ext/**/Makefile'] | |||
$hoe.spec.require_paths = Dir['{lib,ext/*}'] | |||
$hoe.spec.extensions = FileList["ext/**/extconf.rb"].to_a |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
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 |