Class: Detroit::ExtConf
- Inherits:
-
Tool
- Object
- Tool
- Detroit::ExtConf
- Includes:
- Standard
- Defined in:
- lib/detroit-extconf.rb
Overview
Can we implement a win32 cross-compile?
By neccessity this tool shells out to the command line.
The ExtConf tool utilizes extconf.rb script and Autotools standard Makefile to compile native extensions.
Targets the following standard toolchain stations:
-
compile
-
clean
-
purge
Constant Summary collapse
- MANPAGE =
Location of manpage for tool.
File.dirname(__FILE__) + '/../man/detroit-dnote.5'
- MAKE_COMMAND =
Platform specific make command.
ENV['make'] || (RUBY_PLATFORM =~ /(win|w)32$/ ? 'nmake' : 'make')
Instance Attribute Summary collapse
-
#static ⇒ Object
Compile statically? Applies only to compile method.
Instance Method Summary collapse
-
#assemble?(station, options = {}) ⇒ Boolean
This tool ties into the ‘compile`, `clean` and `purge` stations of the standard assembly.
-
#clean ⇒ Object
Remove enough compile products for a clean compile.
-
#compile ⇒ Object
Compile extensions.
-
#compiles? ⇒ Boolean
(also: #compile?, #clean?, #purge?)
Check to see if this project has extensions that need to be compiled.
-
#configure ⇒ void
Create Makefile(s).
-
#distclean ⇒ Object
(also: #purge)
Remove all compile products.
-
#extensions ⇒ Object
Extension directories.
-
#prerequisite ⇒ void
Set attribute defaults.
Instance Attribute Details
#static ⇒ Object
Compile statically? Applies only to compile method. (false)
41 42 43 |
# File 'lib/detroit-extconf.rb', line 41 def static @static end |
Instance Method Details
#assemble?(station, options = {}) ⇒ Boolean
This tool ties into the ‘compile`, `clean` and `purge` stations of the standard assembly.
107 108 109 110 111 112 |
# File 'lib/detroit-extconf.rb', line 107 def assemble?(station, ={}) return true if station == :compile return true if station == :clean return true if station == :purge return false end |
#clean ⇒ Object
Remove enough compile products for a clean compile.
67 68 69 |
# File 'lib/detroit-extconf.rb', line 67 def clean make 'clean' end |
#compile ⇒ Object
Compile extensions.
57 58 59 60 61 62 63 64 |
# File 'lib/detroit-extconf.rb', line 57 def compile configure if static make 'static' else make end end |
#compiles? ⇒ Boolean Also known as: compile?, clean?, purge?
Check to see if this project has extensions that need to be compiled.
83 84 85 |
# File 'lib/detroit-extconf.rb', line 83 def compiles? !extensions.empty? end |
#configure ⇒ void
This method returns an undefined value.
Create Makefile(s).
46 47 48 49 50 51 52 53 54 |
# File 'lib/detroit-extconf.rb', line 46 def configure extensions.each do |directory| next if File.exist?(File.join(directory, 'Makefile')) report "configuring #{directory}" cd(directory) do sh "ruby extconf.rb" end end end |
#distclean ⇒ Object Also known as: purge
Remove all compile products.
72 73 74 75 76 77 78 |
# File 'lib/detroit-extconf.rb', line 72 def distclean make 'distclean' extensions.each do |directory| makefile = File.join(directory, 'Makefile') rm(makefile) if File.exist?(makefile) end end |
#extensions ⇒ Object
Extension directories. Often this will simply be ‘ext’. but sometimes more then one extension is needed and are kept in separate directories. This works by looking for ext/*/.c files, where ever they are is considered an extension directory.
95 96 97 |
# File 'lib/detroit-extconf.rb', line 95 def extensions @extensions ||= Dir['ext/**/*.c'].collect{ |file| File.dirname(file) }.uniq end |
#prerequisite ⇒ void
This method returns an undefined value.
Set attribute defaults.
36 37 38 |
# File 'lib/detroit-extconf.rb', line 36 def prerequisite @static = false end |