Class: Xot::ExtConf
Constant Summary
Constants included from Rake
Instance Attribute Summary collapse
-
#defs ⇒ Object
readonly
Returns the value of attribute defs.
-
#frameworks ⇒ Object
readonly
Returns the value of attribute frameworks.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#inc_dirs ⇒ Object
readonly
Returns the value of attribute inc_dirs.
-
#lib_dirs ⇒ Object
readonly
Returns the value of attribute lib_dirs.
-
#libs ⇒ Object
readonly
Returns the value of attribute libs.
-
#local_libs ⇒ Object
readonly
Returns the value of attribute local_libs.
-
#modules ⇒ Object
readonly
Returns the value of attribute modules.
Instance Method Summary collapse
- #create_makefile(*args) ⇒ Object
- #debug ⇒ Object
-
#initialize(*modules, &block) ⇒ ExtConf
constructor
A new instance of ExtConf.
- #setup ⇒ Object
Methods included from Rake
#append_env, #ar, #arflags, #build_application, #build_native_library, #build_ruby_extension, #build_ruby_gem, #bump_version, #bump_version_file, #cd_sh, #clang?, #compile_erb, #compile_erb_str, #cppflags, #cxx, #cxxflags, #cygwin?, #debug?, #define_placeholder_tasks, #doc_dir, #env, #env_array, #erbs_map, #excluded?, #excludes, #ext_dir, #ext_lib_dir, #filter_file, #gcc?, #get_env, #get_version, #glob, #inc_dir, #ios?, #lib_dir, #make_cflags, #make_cppflags, #make_cppflags_defs, #make_cppflags_incdirs, #make_ldflags, #make_path_map, #ming?, #modified_files, #mswin?, #osx?, #params, #ruby_inc_dirs, #src_dir, #src_dirs, #src_ext_map, #src_exts, #srcs_map, #target, #target_name, #test_alones, #test_dir, #test_excludes, #test_ruby_extension, #update_and_tag_version, #use_boost_library, #use_external_library, #vendor_dir, #vendor_srcs_map, #version_path, #win32?
Constructor Details
#initialize(*modules, &block) ⇒ ExtConf
Returns a new instance of ExtConf.
17 18 19 20 21 22 |
# File 'lib/xot/extconf.rb', line 17 def initialize (*modules, &block) @modules = modules.map {|m| m.const_get :Module} @defs, @inc_dirs, @lib_dirs, @headers, @libs, @local_libs, @frameworks = ([[]] * 7).map &:dup Xot::BlockUtil.instance_eval_or_block_call self, &block if block end |
Instance Attribute Details
#defs ⇒ Object (readonly)
Returns the value of attribute defs.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def defs @defs end |
#frameworks ⇒ Object (readonly)
Returns the value of attribute frameworks.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def frameworks @frameworks end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def headers @headers end |
#inc_dirs ⇒ Object (readonly)
Returns the value of attribute inc_dirs.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def inc_dirs @inc_dirs end |
#lib_dirs ⇒ Object (readonly)
Returns the value of attribute lib_dirs.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def lib_dirs @lib_dirs end |
#libs ⇒ Object (readonly)
Returns the value of attribute libs.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def libs @libs end |
#local_libs ⇒ Object (readonly)
Returns the value of attribute local_libs.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def local_libs @local_libs end |
#modules ⇒ Object (readonly)
Returns the value of attribute modules.
15 16 17 |
# File 'lib/xot/extconf.rb', line 15 def modules @modules end |
Instance Method Details
#create_makefile(*args) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/xot/extconf.rb', line 46 def create_makefile (*args) modules.each do |m| dir_config m.name.downcase, m.inc_dir, m.lib_dir end exit 1 unless headers.all? {|s| have_header s} exit 1 unless libs.all? {|s| have_library s, 't'} super end |
#setup ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/xot/extconf.rb', line 28 def setup () yield if block_given? modules.each do |m| name = m.name.downcase headers << "#{name}.h" libs << name end local_libs << (clang? ? 'c++' : 'stdc++') $CPPFLAGS = make_cppflags $CPPFLAGS, defs, inc_dirs $CFLAGS = make_cflags $CFLAGS + ' -x c++' $CXXFLAGS = make_cflags $CXXFLAGS + ' -x c++' if $CXXFLAGS $LDFLAGS = make_ldflags $LDFLAGS, lib_dirs, frameworks $LOCAL_LIBS << local_libs.map {|s| " -l#{s}"}.join end |