2000-08-03 05:50:41 -04:00
|
|
|
#!./miniruby -s
|
1998-01-16 07:19:09 -05:00
|
|
|
|
2015-11-16 02:16:16 -05:00
|
|
|
# This script, which is run when ruby is built, generates rbconfig.rb by
|
|
|
|
# parsing information from config.status. rbconfig.rb contains build
|
|
|
|
# information for ruby (compiler flags, paths, etc.) and is used e.g. by
|
|
|
|
# mkmf to build compatible native extensions.
|
|
|
|
|
2003-07-27 08:55:35 -04:00
|
|
|
# avoid warnings with -d.
|
|
|
|
$install_name ||= nil
|
|
|
|
$so_name ||= nil
|
2016-06-14 12:44:45 -04:00
|
|
|
$unicode_version ||= nil
|
2018-12-07 03:51:26 -05:00
|
|
|
$unicode_emoji_version ||= nil
|
2015-03-06 21:06:11 -05:00
|
|
|
arch = $arch or raise "missing -arch"
|
|
|
|
version = $version or raise "missing -version"
|
2003-07-27 08:55:35 -04:00
|
|
|
|
2009-05-24 22:47:07 -04:00
|
|
|
srcdir = File.expand_path('../..', __FILE__)
|
2007-12-27 09:56:04 -05:00
|
|
|
$:.unshift(".")
|
2004-12-04 10:56:34 -05:00
|
|
|
|
2002-10-26 22:09:23 -04:00
|
|
|
mkconfig = File.basename($0)
|
1998-01-16 07:19:09 -05:00
|
|
|
|
2016-07-08 22:44:39 -04:00
|
|
|
fast = {'prefix'=>true, 'ruby_install_name'=>true, 'INSTALL'=>true, 'EXEEXT'=>true}
|
1998-01-16 07:19:09 -05:00
|
|
|
|
2010-09-21 09:20:07 -04:00
|
|
|
win32 = /mswin/ =~ arch
|
2010-12-16 07:46:44 -05:00
|
|
|
universal = /universal.*darwin/ =~ arch
|
1998-01-16 07:19:09 -05:00
|
|
|
v_fast = []
|
|
|
|
v_others = []
|
2006-05-24 12:52:00 -04:00
|
|
|
vars = {}
|
2007-01-29 22:06:02 -05:00
|
|
|
continued_name = nil
|
|
|
|
continued_line = nil
|
2013-12-27 00:46:06 -05:00
|
|
|
install_name = nil
|
|
|
|
so_name = nil
|
2021-03-21 11:20:27 -04:00
|
|
|
platform = nil
|
2000-12-28 00:00:47 -05:00
|
|
|
File.foreach "config.status" do |line|
|
|
|
|
next if /^#/ =~ line
|
2007-01-29 22:06:02 -05:00
|
|
|
name = nil
|
|
|
|
case line
|
|
|
|
when /^s([%,])@(\w+)@\1(?:\|\#_!!_\#\|)?(.*)\1/
|
2006-06-25 10:03:10 -04:00
|
|
|
name = $2
|
|
|
|
val = $3.gsub(/\\(?=,)/, '')
|
2007-01-29 22:06:02 -05:00
|
|
|
when /^S\["(\w+)"\]\s*=\s*"(.*)"\s*(\\)?$/
|
|
|
|
name = $1
|
|
|
|
val = $2
|
|
|
|
if $3
|
2010-09-16 13:28:42 -04:00
|
|
|
continued_line = [val]
|
2007-01-29 22:06:02 -05:00
|
|
|
continued_name = name
|
|
|
|
next
|
|
|
|
end
|
2008-12-08 13:21:47 -05:00
|
|
|
when /^"(.*)"\s*(\\)?$/
|
2010-09-16 13:28:42 -04:00
|
|
|
next if !continued_line
|
|
|
|
continued_line << $1
|
|
|
|
next if $2
|
2012-12-09 23:18:11 -05:00
|
|
|
continued_line.each {|s| s.sub!(/\\n\z/, "\n")}
|
2010-09-16 13:28:42 -04:00
|
|
|
val = continued_line.join
|
|
|
|
name = continued_name
|
|
|
|
continued_line = nil
|
2007-01-29 22:06:02 -05:00
|
|
|
when /^(?:ac_given_)?INSTALL=(.*)/
|
|
|
|
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
if name
|
2009-04-03 18:38:54 -04:00
|
|
|
case name
|
|
|
|
when /^(?:ac_.*|configure_input|(?:top_)?srcdir|\w+OBJS)$/; next
|
2015-03-06 21:06:06 -05:00
|
|
|
when /^(?:X|(?:MINI|RUN|(?:HAVE_)?BASE|BOOTSTRAP|BTEST)RUBY(?:_COMMAND)?$)/; next
|
2015-02-28 21:17:13 -05:00
|
|
|
when /^INSTALLDOC|TARGET$/; next
|
|
|
|
when /^DTRACE/; next
|
2019-12-05 01:18:42 -05:00
|
|
|
when /^MJIT_(CC|SUPPORT)$/; # pass
|
2018-02-08 10:19:01 -05:00
|
|
|
when /^MJIT_/; next
|
2013-12-31 01:34:35 -05:00
|
|
|
when /^(?:MAJOR|MINOR|TEENY)$/; vars[name] = val; next
|
2013-02-18 22:49:37 -05:00
|
|
|
when /^LIBRUBY_D?LD/; next
|
2013-12-27 00:46:06 -05:00
|
|
|
when /^RUBY_INSTALL_NAME$/; next vars[name] = (install_name = val).dup if $install_name
|
|
|
|
when /^RUBY_SO_NAME$/; next vars[name] = (so_name = val).dup if $so_name
|
2009-04-03 18:38:54 -04:00
|
|
|
when /^arch$/; if val.empty? then val = arch else arch = val end
|
2013-02-06 02:47:45 -05:00
|
|
|
when /^sitearch$/; val = '$(arch)' if val.empty?
|
2015-02-25 04:17:33 -05:00
|
|
|
when /^DESTDIR$/; next
|
2018-06-22 00:13:02 -04:00
|
|
|
when /RUBYGEMS/; next
|
2009-04-03 18:38:54 -04:00
|
|
|
end
|
|
|
|
case val
|
|
|
|
when /^\$\(ac_\w+\)$/; next
|
|
|
|
when /^\$\{ac_\w+\}$/; next
|
|
|
|
when /^\$ac_\w+$/; next
|
|
|
|
end
|
2009-04-09 14:01:26 -04:00
|
|
|
if /^program_transform_name$/ =~ name
|
2009-08-26 04:00:37 -04:00
|
|
|
val.sub!(/\As(\\?\W)(?:\^|\${1,2})\1\1(;|\z)/, '')
|
2009-04-09 14:01:26 -04:00
|
|
|
if val.empty?
|
|
|
|
$install_name ||= "ruby"
|
|
|
|
next
|
|
|
|
end
|
|
|
|
unless $install_name
|
|
|
|
$install_name = "ruby"
|
|
|
|
val.gsub!(/\$\$/, '$')
|
2021-10-29 11:40:21 -04:00
|
|
|
val.scan(%r[\G[\s;]*(/(?:\\.|[^/])*+/)?([sy])(\\?\W)((?:(?!\3)(?:\\.|.))*+)\3((?:(?!\3)(?:\\.|.))*+)\3([gi]*)]) do
|
2009-04-09 14:01:26 -04:00
|
|
|
|addr, cmd, sep, pat, rep, opt|
|
|
|
|
if addr
|
|
|
|
Regexp.new(addr[/\A\/(.*)\/\z/, 1]) =~ $install_name or next
|
|
|
|
end
|
|
|
|
case cmd
|
|
|
|
when 's'
|
|
|
|
pat = Regexp.new(pat, opt.include?('i'))
|
|
|
|
if opt.include?('g')
|
|
|
|
$install_name.gsub!(pat, rep)
|
|
|
|
else
|
|
|
|
$install_name.sub!(pat, rep)
|
|
|
|
end
|
|
|
|
when 'y'
|
|
|
|
$install_name.tr!(Regexp.quote(pat), rep)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2006-06-25 10:03:10 -04:00
|
|
|
end
|
2013-02-07 02:21:30 -05:00
|
|
|
eq = win32 && vars[name] ? '<< "\n"' : '='
|
2013-02-06 03:32:53 -05:00
|
|
|
vars[name] = val
|
2010-02-18 08:33:25 -05:00
|
|
|
if name == "configure_args"
|
|
|
|
val.gsub!(/--with-out-ext/, "--without-ext")
|
|
|
|
end
|
2006-06-25 10:03:10 -04:00
|
|
|
val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
|
2010-12-16 07:46:44 -05:00
|
|
|
case name
|
|
|
|
when /^prefix$/
|
2006-06-25 10:03:10 -04:00
|
|
|
val = "(TOPDIR || DESTDIR + #{val})"
|
2010-12-16 07:46:44 -05:00
|
|
|
when /^ARCH_FLAG$/
|
|
|
|
val = "arch_flag || #{val}" if universal
|
|
|
|
when /^UNIVERSAL_ARCHNAMES$/
|
|
|
|
universal, val = val, 'universal' if universal
|
|
|
|
when /^arch$/
|
|
|
|
if universal
|
2021-03-21 11:20:27 -04:00
|
|
|
platform = val.sub(/universal/, %q[#{arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || RUBY_PLATFORM[/\A[^-]*/]}])
|
2010-12-16 07:46:44 -05:00
|
|
|
end
|
2022-11-04 05:19:30 -04:00
|
|
|
when /^target_cpu$/
|
|
|
|
if universal
|
|
|
|
val = 'arch'
|
|
|
|
end
|
|
|
|
when /^target$/
|
|
|
|
val = '"$(target_cpu)-$(target_vendor)-$(target_os)"'
|
|
|
|
when /^host(?:_(?:os|vendor|cpu|alias))?$/
|
|
|
|
val = %["$(#{name.sub(/^host/, 'target')})"]
|
2021-04-14 23:49:06 -04:00
|
|
|
when /^includedir$/
|
2015-02-10 03:30:16 -05:00
|
|
|
val = '"$(SDKROOT)"'+val if /darwin/ =~ arch
|
2006-06-25 10:03:10 -04:00
|
|
|
end
|
2013-02-07 02:21:30 -05:00
|
|
|
v = " CONFIG[\"#{name}\"] #{eq} #{val}\n"
|
1998-01-16 07:19:09 -05:00
|
|
|
if fast[name]
|
|
|
|
v_fast << v
|
|
|
|
else
|
|
|
|
v_others << v
|
|
|
|
end
|
2018-12-27 22:09:29 -05:00
|
|
|
#case name
|
|
|
|
#when "RUBY_PROGRAM_VERSION"
|
|
|
|
# version = val[/\A"(.*)"\z/, 1]
|
|
|
|
#end
|
1998-01-16 07:19:09 -05:00
|
|
|
end
|
|
|
|
# break if /^CEOF/
|
|
|
|
end
|
|
|
|
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
drive = File::PATH_SEPARATOR == ';'
|
|
|
|
|
2013-02-06 03:32:53 -05:00
|
|
|
def vars.expand(val, config = self)
|
|
|
|
newval = val.gsub(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) {
|
|
|
|
var = $&
|
|
|
|
if !(v = $1 || $2)
|
|
|
|
'$'
|
|
|
|
elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
|
|
|
|
pat, sub = $1, $2
|
|
|
|
config[v] = false
|
|
|
|
config[v] = expand(key, config)
|
|
|
|
key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
|
|
|
|
key
|
|
|
|
else
|
|
|
|
var
|
|
|
|
end
|
|
|
|
}
|
|
|
|
val.replace(newval) unless newval == val
|
|
|
|
val
|
|
|
|
end
|
2014-06-27 18:52:46 -04:00
|
|
|
prefix = vars.expand(vars["prefix"] ||= "")
|
|
|
|
rubyarchdir = vars.expand(vars["rubyarchdir"] ||= "")
|
2014-06-27 11:35:15 -04:00
|
|
|
relative_archdir = rubyarchdir.rindex(prefix, 0) ? rubyarchdir[prefix.size..-1] : rubyarchdir
|
2018-12-27 22:09:29 -05:00
|
|
|
|
2015-03-06 21:06:11 -05:00
|
|
|
puts %[\
|
2016-11-17 02:19:49 -05:00
|
|
|
# encoding: ascii-8bit
|
2015-12-09 15:53:21 -05:00
|
|
|
# frozen-string-literal: false
|
2016-11-05 02:59:31 -04:00
|
|
|
#
|
|
|
|
# The module storing Ruby interpreter configurations on building.
|
|
|
|
#
|
2015-11-16 02:16:16 -05:00
|
|
|
# This file was created by #{mkconfig} when ruby was built. It contains
|
|
|
|
# build information for ruby which is used e.g. by mkmf to build
|
|
|
|
# compatible native extensions. Any changes made to this file will be
|
|
|
|
# lost the next time ruby is built.
|
2015-03-06 21:06:11 -05:00
|
|
|
|
|
|
|
module RbConfig
|
2015-03-25 20:30:07 -04:00
|
|
|
RUBY_VERSION.start_with?("#{version[/^[0-9]+\.[0-9]+\./] || version}") or
|
2015-03-06 21:06:11 -05:00
|
|
|
raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})"
|
|
|
|
|
|
|
|
]
|
2016-11-05 02:59:31 -04:00
|
|
|
print " # Ruby installed directory.\n"
|
2014-06-27 11:35:15 -04:00
|
|
|
print " TOPDIR = File.dirname(__FILE__).chomp!(#{relative_archdir.dump})\n"
|
2016-11-05 03:14:19 -04:00
|
|
|
print " # DESTDIR on make install.\n"
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n"
|
2010-12-16 07:46:44 -05:00
|
|
|
print <<'ARCH' if universal
|
|
|
|
arch_flag = ENV['ARCHFLAGS'] || ((e = ENV['RC_ARCHS']) && e.split.uniq.map {|a| "-arch #{a}"}.join(' '))
|
|
|
|
arch = arch_flag && arch_flag[/\A\s*-arch\s+(\S+)\s*\z/, 1]
|
|
|
|
ARCH
|
2010-12-17 04:35:42 -05:00
|
|
|
print " universal = #{universal}\n" if universal
|
2016-11-05 02:59:31 -04:00
|
|
|
print " # The hash configurations stored.\n"
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
print " CONFIG = {}\n"
|
|
|
|
print " CONFIG[\"DESTDIR\"] = DESTDIR\n"
|
|
|
|
|
2009-03-24 18:44:17 -04:00
|
|
|
versions = {}
|
|
|
|
IO.foreach(File.join(srcdir, "version.h")) do |l|
|
2010-08-23 17:08:19 -04:00
|
|
|
m = /^\s*#\s*define\s+RUBY_(PATCHLEVEL)\s+(-?\d+)/.match(l)
|
2009-03-24 18:44:17 -04:00
|
|
|
if m
|
2010-08-23 17:08:19 -04:00
|
|
|
versions[m[1]] = m[2]
|
2016-01-08 20:02:17 -05:00
|
|
|
break if versions.size == 4
|
|
|
|
next
|
2010-08-23 17:08:19 -04:00
|
|
|
end
|
2019-01-10 23:58:33 -05:00
|
|
|
m = /^\s*#\s*define\s+RUBY_VERSION_(\w+)\s+(-?\d+)/.match(l)
|
|
|
|
if m
|
|
|
|
versions[m[1]] = m[2]
|
|
|
|
break if versions.size == 4
|
|
|
|
next
|
|
|
|
end
|
2016-01-08 20:02:17 -05:00
|
|
|
m = /^\s*#\s*define\s+RUBY_VERSION\s+\W?([.\d]+)/.match(l)
|
2010-08-23 17:08:19 -04:00
|
|
|
if m
|
2016-01-08 20:02:17 -05:00
|
|
|
versions['MAJOR'], versions['MINOR'], versions['TEENY'] = m[1].split('.')
|
2009-03-24 18:44:17 -04:00
|
|
|
break if versions.size == 4
|
2016-01-08 20:02:17 -05:00
|
|
|
next
|
2009-03-24 18:44:17 -04:00
|
|
|
end
|
2009-02-02 17:01:26 -05:00
|
|
|
end
|
2019-01-10 23:58:33 -05:00
|
|
|
if versions.size != 4
|
|
|
|
IO.foreach(File.join(srcdir, "include/ruby/version.h")) do |l|
|
|
|
|
m = /^\s*#\s*define\s+RUBY_API_VERSION_(\w+)\s+(-?\d+)/.match(l)
|
|
|
|
if m
|
|
|
|
versions[m[1]] ||= m[2]
|
|
|
|
break if versions.size == 4
|
|
|
|
next
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2009-03-24 18:44:17 -04:00
|
|
|
%w[MAJOR MINOR TEENY PATCHLEVEL].each do |v|
|
2018-12-27 21:12:34 -05:00
|
|
|
print " CONFIG[#{v.dump}] = #{(versions[v]||vars[v]).dump}\n"
|
1999-08-13 01:45:20 -04:00
|
|
|
end
|
|
|
|
|
2011-08-13 09:17:30 -04:00
|
|
|
dest = drive ? %r'= "(?!\$[\(\{])(?i:[a-z]:)' : %r'= "(?!\$[\(\{])'
|
|
|
|
v_disabled = {}
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
v_others.collect! do |x|
|
2011-08-13 09:17:30 -04:00
|
|
|
if /^\s*CONFIG\["((?!abs_|old)[a-z]+(?:_prefix|dir))"\]/ === x
|
|
|
|
name = $1
|
|
|
|
if /= "no"$/ =~ x
|
|
|
|
v_disabled[name] = true
|
|
|
|
v_others.delete(name)
|
|
|
|
next
|
|
|
|
end
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
x.sub(dest, '= "$(DESTDIR)')
|
2000-06-18 23:37:55 -04:00
|
|
|
else
|
|
|
|
x
|
|
|
|
end
|
|
|
|
end
|
2011-08-13 09:17:30 -04:00
|
|
|
v_others.compact!
|
2000-06-18 23:37:55 -04:00
|
|
|
|
2000-08-03 05:50:41 -04:00
|
|
|
if $install_name
|
2013-12-27 00:46:06 -05:00
|
|
|
if install_name and vars.expand("$(RUBY_INSTALL_NAME)") == $install_name
|
|
|
|
$install_name = install_name
|
|
|
|
end
|
2000-08-03 05:50:41 -04:00
|
|
|
v_fast << " CONFIG[\"ruby_install_name\"] = \"" + $install_name + "\"\n"
|
|
|
|
v_fast << " CONFIG[\"RUBY_INSTALL_NAME\"] = \"" + $install_name + "\"\n"
|
|
|
|
end
|
|
|
|
if $so_name
|
2013-12-27 00:46:06 -05:00
|
|
|
if so_name and vars.expand("$(RUBY_SO_NAME)") == $so_name
|
|
|
|
$so_name = so_name
|
|
|
|
end
|
2000-08-03 05:50:41 -04:00
|
|
|
v_fast << " CONFIG[\"RUBY_SO_NAME\"] = \"" + $so_name + "\"\n"
|
|
|
|
end
|
|
|
|
|
2006-09-08 15:48:22 -04:00
|
|
|
print(*v_fast)
|
|
|
|
print(*v_others)
|
2016-06-14 12:44:45 -04:00
|
|
|
print <<EOS if $unicode_version
|
|
|
|
CONFIG["UNICODE_VERSION"] = #{$unicode_version.dump}
|
|
|
|
EOS
|
2018-12-07 03:51:26 -05:00
|
|
|
print <<EOS if $unicode_emoji_version
|
|
|
|
CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump}
|
|
|
|
EOS
|
2015-02-10 03:30:16 -05:00
|
|
|
print <<EOS if /darwin/ =~ arch
|
2021-04-14 23:49:06 -04:00
|
|
|
if sdkroot = ENV["SDKROOT"]
|
|
|
|
sdkroot = sdkroot.dup
|
|
|
|
elsif File.exist?(File.join(CONFIG["prefix"], "include")) ||
|
|
|
|
!(sdkroot = (IO.popen(%w[/usr/bin/xcrun --sdk macosx --show-sdk-path], in: IO::NULL, err: IO::NULL, &:read) rescue nil))
|
|
|
|
sdkroot = +""
|
|
|
|
else
|
|
|
|
sdkroot.chomp!
|
|
|
|
end
|
|
|
|
CONFIG["SDKROOT"] = sdkroot
|
2015-02-10 03:30:16 -05:00
|
|
|
EOS
|
1999-08-13 01:45:20 -04:00
|
|
|
print <<EOS
|
2021-03-21 11:20:27 -04:00
|
|
|
CONFIG["platform"] = #{platform || '"$(arch)"'}
|
2013-02-06 03:32:53 -05:00
|
|
|
CONFIG["archdir"] = "$(rubyarchdir)"
|
2004-03-18 04:50:14 -05:00
|
|
|
CONFIG["topdir"] = File.dirname(__FILE__)
|
2016-11-05 02:59:31 -04:00
|
|
|
# Almost same with CONFIG. MAKEFILE_CONFIG has other variable
|
|
|
|
# reference like below.
|
|
|
|
#
|
|
|
|
# MAKEFILE_CONFIG["bindir"] = "$(exec_prefix)/bin"
|
|
|
|
#
|
|
|
|
# The values of this constant is used for creating Makefile.
|
|
|
|
#
|
|
|
|
# require 'rbconfig'
|
|
|
|
#
|
|
|
|
# print <<-END_OF_MAKEFILE
|
2020-03-30 02:51:40 -04:00
|
|
|
# prefix = \#{RbConfig::MAKEFILE_CONFIG['prefix']}
|
|
|
|
# exec_prefix = \#{RbConfig::MAKEFILE_CONFIG['exec_prefix']}
|
|
|
|
# bindir = \#{RbConfig::MAKEFILE_CONFIG['bindir']}
|
2016-11-05 02:59:31 -04:00
|
|
|
# END_OF_MAKEFILE
|
|
|
|
#
|
|
|
|
# => prefix = /usr/local
|
|
|
|
# exec_prefix = $(prefix)
|
|
|
|
# bindir = $(exec_prefix)/bin MAKEFILE_CONFIG = {}
|
|
|
|
#
|
|
|
|
# RbConfig.expand is used for resolving references like above in rbconfig.
|
|
|
|
#
|
|
|
|
# require 'rbconfig'
|
2020-03-30 02:51:40 -04:00
|
|
|
# p RbConfig.expand(RbConfig::MAKEFILE_CONFIG["bindir"])
|
2016-11-05 02:59:31 -04:00
|
|
|
# # => "/usr/local/bin"
|
2000-07-31 05:43:14 -04:00
|
|
|
MAKEFILE_CONFIG = {}
|
|
|
|
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
2016-11-05 02:59:31 -04:00
|
|
|
|
|
|
|
# call-seq:
|
|
|
|
#
|
|
|
|
# RbConfig.expand(val) -> string
|
|
|
|
# RbConfig.expand(val, config) -> string
|
|
|
|
#
|
|
|
|
# expands variable with given +val+ value.
|
|
|
|
#
|
|
|
|
# RbConfig.expand("$(bindir)") # => /home/foobar/all-ruby/ruby19x/bin
|
* mkconfig.rb: generate RbConfig instead of Config.
* instruby.rb, rubytest.rb, runruby.rb, bcc32/Makefile.sub,
ext/extmk.rb, ext/dl/extconf.rb, ext/iconv/charset_alias.rb,
lib/mkmf.rb, lib/rdoc/ri/ri_paths.rb,
lib/webrick/httpservlet/cgihandler.rb,
test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb,
test/ruby/envutil.rb, test/soap/calc/test_calc_cgi.rb,
test/soap/header/test_authheader_cgi.rb, test/soap/ssl/test_ssl.rb,
win32/mkexports.rb, win32/resource.rb: Use RbConfig instead of
Config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 03:34:53 -05:00
|
|
|
def RbConfig::expand(val, config = CONFIG)
|
2009-06-30 03:55:36 -04:00
|
|
|
newval = val.gsub(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) {
|
2008-02-12 01:28:23 -05:00
|
|
|
var = $&
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
if !(v = $1 || $2)
|
|
|
|
'$'
|
2005-11-10 18:22:03 -05:00
|
|
|
elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
|
|
|
|
pat, sub = $1, $2
|
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
* configure.in (LIBEXT): suffix for static libraries.
* configure.in (LIBPATHFLAG): switch template to specify library
path.
* configure.in (LINK_SO): command to link shared objects.
* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
files.
* configure.in (EXPORT_PREFIX): prefix to exported symbols on
Windows.
* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
libraries, macros and headers used in common.
* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
excutable name.
* Makefile.in (CFLAGS): append XCFLAGS.
* Makefile.in (PREP): miscellaneous system dependent files.
* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.
* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.
* Makefile.in (MAKEFILES): depend on *.in and config.status.
* Makefile.in (parse.c): replace "y.tab.c" with actual name for
byacc.
* ext/extmk.rb, lib/mkmf.rb: integrated.
* ext/extmk.rb: propagate MFLAGS.
* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
Makefile is made.
* lib/mkmf.rb (older): accept multiple file names and Time
objects.
* lib/mkmf.rb (xsystem): split and qoute.
* lib/mkmf.rb (cpp_include): make include directives.
* lib/mkmf.rb (try_func): try wheather specified function is
available.
* lib/mkmf.rb (install_files): default to site-install.
* lib/mkmf.rb (checking_for): added.
* lib/mkmf.rb (find_executable0): just find executable file with
no message.
* lib/mkmf.rb (create_header): output header file is variable.
* lib/mkmf.rb (create_makefile): separate sections.
* lib/mkmf.rb (init_mkmf): initialize global variables.
* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.
* bcc32/Makefile.sub (ARCH): fixed to i386.
* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
link EXTOBJS.
* ext/dl/extconf.rb: use try_cpp to cross compile.
* ext/dl/extconf.rb: not modify files in source directory.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-10-21 10:17:44 -04:00
|
|
|
config[v] = false
|
2009-06-30 03:55:36 -04:00
|
|
|
config[v] = RbConfig::expand(key, config)
|
2008-02-13 02:26:52 -05:00
|
|
|
key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
|
2005-11-10 18:22:03 -05:00
|
|
|
key
|
2000-07-31 05:43:14 -04:00
|
|
|
else
|
|
|
|
var
|
|
|
|
end
|
2009-06-30 03:55:36 -04:00
|
|
|
}
|
|
|
|
val.replace(newval) unless newval == val
|
2000-07-31 05:43:14 -04:00
|
|
|
val
|
|
|
|
end
|
|
|
|
CONFIG.each_value do |val|
|
* mkconfig.rb: generate RbConfig instead of Config.
* instruby.rb, rubytest.rb, runruby.rb, bcc32/Makefile.sub,
ext/extmk.rb, ext/dl/extconf.rb, ext/iconv/charset_alias.rb,
lib/mkmf.rb, lib/rdoc/ri/ri_paths.rb,
lib/webrick/httpservlet/cgihandler.rb,
test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb,
test/ruby/envutil.rb, test/soap/calc/test_calc_cgi.rb,
test/soap/header/test_authheader_cgi.rb, test/soap/ssl/test_ssl.rb,
win32/mkexports.rb, win32/resource.rb: Use RbConfig instead of
Config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 03:34:53 -05:00
|
|
|
RbConfig::expand(val)
|
2000-07-31 05:43:14 -04:00
|
|
|
end
|
2009-12-31 10:00:04 -05:00
|
|
|
|
2018-11-13 23:42:14 -05:00
|
|
|
# call-seq:
|
|
|
|
#
|
2020-03-20 20:22:11 -04:00
|
|
|
# RbConfig.fire_update!(key, val) -> array
|
|
|
|
# RbConfig.fire_update!(key, val, mkconf, conf) -> array
|
2018-11-13 23:42:14 -05:00
|
|
|
#
|
|
|
|
# updates +key+ in +mkconf+ with +val+, and all values depending on
|
|
|
|
# the +key+ in +mkconf+.
|
|
|
|
#
|
|
|
|
# RbConfig::MAKEFILE_CONFIG.values_at("CC", "LDSHARED") # => ["gcc", "$(CC) -shared"]
|
|
|
|
# RbConfig::CONFIG.values_at("CC", "LDSHARED") # => ["gcc", "gcc -shared"]
|
|
|
|
# RbConfig.fire_update!("CC", "gcc-8") # => ["CC", "LDSHARED"]
|
|
|
|
# RbConfig::MAKEFILE_CONFIG.values_at("CC", "LDSHARED") # => ["gcc-8", "$(CC) -shared"]
|
|
|
|
# RbConfig::CONFIG.values_at("CC", "LDSHARED") # => ["gcc-8", "gcc-8 -shared"]
|
|
|
|
#
|
|
|
|
# returns updated keys list, or +nil+ if nothing changed.
|
2022-04-25 14:28:39 -04:00
|
|
|
def RbConfig.fire_update!(key, val, mkconf = MAKEFILE_CONFIG, conf = CONFIG) # :nodoc:
|
2019-06-27 23:36:03 -04:00
|
|
|
return if mkconf[key] == val
|
2018-11-13 23:42:14 -05:00
|
|
|
mkconf[key] = val
|
|
|
|
keys = [key]
|
|
|
|
deps = []
|
|
|
|
begin
|
|
|
|
re = Regexp.new("\\\\$\\\\((?:%1$s)\\\\)|\\\\$\\\\{(?:%1$s)\\\\}" % keys.join('|'))
|
|
|
|
deps |= keys
|
|
|
|
keys.clear
|
|
|
|
mkconf.each {|k,v| keys << k if re =~ v}
|
|
|
|
end until keys.empty?
|
|
|
|
deps.each {|k| conf[k] = mkconf[k].dup}
|
|
|
|
deps.each {|k| expand(conf[k])}
|
|
|
|
deps
|
|
|
|
end
|
|
|
|
|
2016-11-05 02:59:31 -04:00
|
|
|
# call-seq:
|
|
|
|
#
|
|
|
|
# RbConfig.ruby -> path
|
|
|
|
#
|
2009-12-31 10:00:04 -05:00
|
|
|
# returns the absolute pathname of the ruby command.
|
|
|
|
def RbConfig.ruby
|
|
|
|
File.join(
|
|
|
|
RbConfig::CONFIG["bindir"],
|
|
|
|
RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
|
|
|
|
)
|
|
|
|
end
|
1999-08-13 01:45:20 -04:00
|
|
|
end
|
2002-12-31 07:31:12 -05:00
|
|
|
CROSS_COMPILING = nil unless defined? CROSS_COMPILING
|
1999-08-13 01:45:20 -04:00
|
|
|
EOS
|
2005-11-10 18:22:03 -05:00
|
|
|
|
1998-01-16 07:19:09 -05:00
|
|
|
# vi:set sw=2:
|