HACK: Lousy API design, sue me. At least works ;-)
Define a series of helpers to aid in search and usage of MinGW (GCC) Compiler by gem developer/creators.
return the first compiler found that includes both mingw and gcc conditions (this assumes you have one installed)
# File lib/rake/extensioncompiler.rb, line 35 35: def self.mingw_gcc_executable 36: return @mingw_gcc_executable if @mingw_gcc_executable 37: 38: # grab the paths defined in the environment 39: paths = ENV['PATH'].split(File::PATH_SEPARATOR) 40: 41: # the pattern to look into (captures *nix and windows executables) 42: pattern = "*mingw*gcc{,.*}" 43: 44: @mingw_gcc_executable = paths.find do |path| 45: # cleanup paths before globbing 46: gcc = Dir.glob("#{File.expand_path(path)}/#{pattern}").first 47: break gcc if gcc 48: end 49: 50: @mingw_gcc_executable 51: end
return the host portion from the installed MinGW
# File lib/rake/extensioncompiler.rb, line 13 13: def self.mingw_host 14: return @mingw_host if @mingw_host 15: 16: # the mingw_gcc_executable is helpful here 17: if target = mingw_gcc_executable then 18: # we only care for the filename 19: target = File.basename(target) 20: 21: # now strip the extension (if present) 22: target.sub!(File.extname(target), '') 23: 24: # get rid of '-gcc' portion too ;-) 25: target.sub!('-gcc', '') 26: end 27: 28: raise "No MinGW tools or unknown setup platform?" unless target 29: 30: @mingw_host = target 31: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.