Class: Xot::ExtConf
Instance Attribute Summary collapse
-
#defs ⇒ Object
readonly
Returns the value of attribute defs.
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#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.
Instance Method Summary collapse
- #create_makefile(*args) ⇒ Object
- #debug ⇒ Object
-
#initialize(*extensions, &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, #cd_sh, #ci?, #clang?, #compile_erb, #compile_erb_str, #cppflags, #cxx, #cxxflags, #cygwin?, #debug?, #default_tasks, #define_placeholder_tasks, #doc_dir, #env, #env_array, #erbs_map, #excluded?, #excludes, #ext_dir, #ext_lib_dir, #filter_file, #gcc?, #get_env, #github_actions?, #glob, #inc_dir, #ios?, #lib_dir, #make_cflags, #make_cppflags, #make_cppflags_defs, #make_cppflags_incdirs, #make_cppflags_sys_incdirs, #make_ldflags, #make_path_map, #ming?, #mswin?, #noverbose_puts, #osx?, #params, #rake_puts, #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, #use_boost_library, #use_bundler, #use_external_library, #vendor_dir, #vendor_srcs_map, #verbose?, #verbose_puts, #win32?
Constructor Details
#initialize(*extensions, &block) ⇒ ExtConf
14 15 16 17 18 19 |
# File 'lib/xot/extconf.rb', line 14 def initialize(*extensions, &block) @extensions = extensions.map {|x| x.const_get :Extension} @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.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def defs @defs end |
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def extensions @extensions end |
#frameworks ⇒ Object (readonly)
Returns the value of attribute frameworks.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def frameworks @frameworks end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def headers @headers end |
#inc_dirs ⇒ Object (readonly)
Returns the value of attribute inc_dirs.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def inc_dirs @inc_dirs end |
#lib_dirs ⇒ Object (readonly)
Returns the value of attribute lib_dirs.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def lib_dirs @lib_dirs end |
#libs ⇒ Object (readonly)
Returns the value of attribute libs.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def libs @libs end |
#local_libs ⇒ Object (readonly)
Returns the value of attribute local_libs.
12 13 14 |
# File 'lib/xot/extconf.rb', line 12 def local_libs @local_libs end |
Instance Method Details
#create_makefile(*args) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/xot/extconf.rb', line 49 def create_makefile(*args) extensions.each do |ext| dir_config ext.name.downcase, ext.inc_dir, ext.lib_dir end exit 1 unless headers.all? {|s| have_header s} exit 1 unless libs.all? {|s| have_library s, 't'} super end |
#debug ⇒ Object
21 22 23 |
# File 'lib/xot/extconf.rb', line 21 def debug() env :DEBUG, false end |
#setup ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/xot/extconf.rb', line 25 def setup() yield if block_given? extensions.each do |ext| name = ext.name.downcase headers << "#{name}.h" libs << name end ldflags = $LDFLAGS.dup if osx? opt = '-Wl,-undefined,dynamic_lookup' ldflags << " #{opt}" unless ($DLDFLAGS || '').include?(opt) 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 |