Feature #5658 » mkmf.rb.in_a_module.no_whitespace.patch
| lib/mkmf.rb (working copy) | ||
|---|---|---|
| require 'fileutils' | ||
| require 'shellwords' | ||
| # :stopdoc: | ||
| class String | ||
|   # Wraps a string in escaped quotes if it contains whitespace. | ||
|   def quote | ||
|     /\s/ =~ self ? "\"#{self}\"" : "#{self}" | ||
|   end | ||
|   # Generates a string used as cpp macro name. | ||
|   def tr_cpp | ||
|     strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P") | ||
|   end | ||
|   def funcall_style | ||
|     /\)\z/ =~ self ? dup : "#{self}()" | ||
|   end | ||
|   def sans_arguments | ||
|     self[/\A[^()]+/] | ||
|   end | ||
| end | ||
| class Array | ||
|   # Wraps all strings in escaped quotes if they contain whitespace. | ||
|   def quote | ||
|     map {|s| s.quote} | ||
|   end | ||
| end | ||
| # :startdoc: | ||
| module MakeMakefile | ||
| CONFIG = RbConfig::MAKEFILE_CONFIG | ||
| ORIG_LIBPATH = ENV['LIB'] | ||
| ... | ... | |
| def config_string(key, config = CONFIG) | ||
|   s = config[key] and !s.empty? and block_given? ? yield(s) : s | ||
| end | ||
|   module_function :config_string | ||
| def dir_re(dir) | ||
|   Regexp.new('\$(?:\('+dir+'\)|\{'+dir+'\})(?:\$(?:\(target_prefix\)|\{target_prefix\}))?') | ||
| end | ||
|   module_function :dir_re | ||
| def relative_from(path, base) | ||
|   dir = File.join(path, "") | ||
| ... | ... | |
| CONFTEST_C = "conftest.c".freeze | ||
| class String | ||
|   # Wraps a string in escaped quotes if it contains whitespace. | ||
|   def quote | ||
|     /\s/ =~ self ? "\"#{self}\"" : "#{self}" | ||
|   end | ||
|   # Generates a string used as cpp macro name. | ||
|   def tr_cpp | ||
|     strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P") | ||
|   end | ||
|   def funcall_style | ||
|     /\)\z/ =~ self ? dup : "#{self}()" | ||
|   end | ||
|   def sans_arguments | ||
|     self[/\A[^()]+/] | ||
|   end | ||
| end | ||
| class Array | ||
|   # Wraps all strings in escaped quotes if they contain whitespace. | ||
|   def quote | ||
|     map {|s| s.quote} | ||
|   end | ||
| end | ||
| def rm_f(*files) | ||
|   opt = (Hash === files.last ? [files.pop] : []) | ||
|   FileUtils.rm_f(Dir[*files.flatten], *opt) | ||
| ... | ... | |
|   rm_f "conftest*" | ||
| end | ||
| class Object | ||
|   alias_method :try_header, (config_string('try_header') || :try_cpp) | ||
| end | ||
| def cpp_include(header) | ||
|   if header | ||
| ... | ... | |
| # :startdoc: | ||
|   def make_makefile | ||
| init_mkmf | ||
| $make = with_config("make-prog", ENV["MAKE"] || "make") | ||
| ... | ... | |
| $configure_args["--topdir"] ||= $curdir | ||
| $ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"])) | ||
|   end | ||
| split = Shellwords.method(:shellwords).to_proc | ||
| EXPORT_PREFIX = config_string('EXPORT_PREFIX') {|s| s.strip} | ||
| ... | ... | |
| realclean: distclean | ||
| " | ||
| end | ||
| include MakeMakefile | ||
| if not $extmk and /\A(extconf|makefile).rb\z/ =~ File.basename($0) | ||
|   END {mkmf_failed($0)} | ||
| end | ||
| make_makefile | ||
- « Previous
- 1
- 2
- 3
- Next »