2000-08-03 13:50:41 +04:00
|
|
|
#!./miniruby -s
|
1998-01-16 15:19:09 +03:00
|
|
|
|
2015-11-16 10:16:16 +03: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 16:55:35 +04:00
|
|
|
# avoid warnings with -d.
|
|
|
|
$install_name ||= nil
|
|
|
|
$so_name ||= nil
|
2016-06-14 19:44:45 +03:00
|
|
|
$unicode_version ||= nil
|
2018-12-07 11:51:26 +03:00
|
|
|
$unicode_emoji_version ||= nil
|
2015-03-07 05:06:11 +03:00
|
|
|
arch = $arch or raise "missing -arch"
|
|
|
|
version = $version or raise "missing -version"
|
2003-07-27 16:55:35 +04:00
|
|
|
|
2009-05-25 06:47:07 +04:00
|
|
|
srcdir = File.expand_path('../..', __FILE__)
|
2007-12-27 17:56:04 +03:00
|
|
|
$:.unshift(".")
|
2004-12-04 18:56:34 +03:00
|
|
|
|
2002-10-27 05:09:23 +03:00
|
|
|
mkconfig = File.basename($0)
|
1998-01-16 15:19:09 +03:00
|
|
|
|
2016-07-09 05:44:39 +03:00
|
|
|
fast = {'prefix'=>true, 'ruby_install_name'=>true, 'INSTALL'=>true, 'EXEEXT'=>true}
|
1998-01-16 15:19:09 +03:00
|
|
|
|
2010-09-21 17:20:07 +04:00
|
|
|
win32 = /mswin/ =~ arch
|
2010-12-16 15:46:44 +03:00
|
|
|
universal = /universal.*darwin/ =~ arch
|
1998-01-16 15:19:09 +03:00
|
|
|
v_fast = []
|
|
|
|
v_others = []
|
2006-05-24 20:52:00 +04:00
|
|
|
vars = {}
|
2007-01-30 06:06:02 +03:00
|
|
|
continued_name = nil
|
|
|
|
continued_line = nil
|
2013-12-27 09:46:06 +04:00
|
|
|
install_name = nil
|
|
|
|
so_name = nil
|
2021-03-21 18:20:27 +03:00
|
|
|
platform = nil
|
2000-12-28 08:00:47 +03:00
|
|
|
File.foreach "config.status" do |line|
|
|
|
|
next if /^#/ =~ line
|
2007-01-30 06:06:02 +03:00
|
|
|
name = nil
|
|
|
|
case line
|
|
|
|
when /^s([%,])@(\w+)@\1(?:\|\#_!!_\#\|)?(.*)\1/
|
2006-06-25 18:03:10 +04:00
|
|
|
name = $2
|
|
|
|
val = $3.gsub(/\\(?=,)/, '')
|
2007-01-30 06:06:02 +03:00
|
|
|
when /^S\["(\w+)"\]\s*=\s*"(.*)"\s*(\\)?$/
|
|
|
|
name = $1
|
|
|
|
val = $2
|
|
|
|
if $3
|
2010-09-16 21:28:42 +04:00
|
|
|
continued_line = [val]
|
2007-01-30 06:06:02 +03:00
|
|
|
continued_name = name
|
|
|
|
next
|
|
|
|
end
|
2008-12-08 21:21:47 +03:00
|
|
|
when /^"(.*)"\s*(\\)?$/
|
2010-09-16 21:28:42 +04:00
|
|
|
next if !continued_line
|
|
|
|
continued_line << $1
|
|
|
|
next if $2
|
2012-12-10 08:18:11 +04:00
|
|
|
continued_line.each {|s| s.sub!(/\\n\z/, "\n")}
|
2010-09-16 21:28:42 +04:00
|
|
|
val = continued_line.join
|
|
|
|
name = continued_name
|
|
|
|
continued_line = nil
|
2007-01-30 06:06:02 +03:00
|
|
|
when /^(?:ac_given_)?INSTALL=(.*)/
|
|
|
|
v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
if name
|
2009-04-04 02:38:54 +04:00
|
|
|
case name
|
|
|
|
when /^(?:ac_.*|configure_input|(?:top_)?srcdir|\w+OBJS)$/; next
|
2015-03-07 05:06:06 +03:00
|
|
|
when /^(?:X|(?:MINI|RUN|(?:HAVE_)?BASE|BOOTSTRAP|BTEST)RUBY(?:_COMMAND)?$)/; next
|
2015-03-01 05:17:13 +03:00
|
|
|
when /^INSTALLDOC|TARGET$/; next
|
|
|
|
when /^DTRACE/; next
|
2019-12-05 09:18:42 +03:00
|
|
|
when /^MJIT_(CC|SUPPORT)$/; # pass
|
2018-02-08 18:19:01 +03:00
|
|
|
when /^MJIT_/; next
|
2013-12-31 10:34:35 +04:00
|
|
|
when /^(?:MAJOR|MINOR|TEENY)$/; vars[name] = val; next
|
2013-02-19 07:49:37 +04:00
|
|
|
when /^LIBRUBY_D?LD/; next
|
2013-12-27 09:46:06 +04: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-04 02:38:54 +04:00
|
|
|
when /^arch$/; if val.empty? then val = arch else arch = val end
|
2013-02-06 11:47:45 +04:00
|
|
|
when /^sitearch$/; val = '$(arch)' if val.empty?
|
2015-02-25 12:17:33 +03:00
|
|
|
when /^DESTDIR$/; next
|
2018-06-22 07:13:02 +03:00
|
|
|
when /RUBYGEMS/; next
|
2009-04-04 02:38:54 +04:00
|
|
|
end
|
|
|
|
case val
|
|
|
|
when /^\$\(ac_\w+\)$/; next
|
|
|
|
when /^\$\{ac_\w+\}$/; next
|
|
|
|
when /^\$ac_\w+$/; next
|
|
|
|
end
|
2009-04-09 22:01:26 +04:00
|
|
|
if /^program_transform_name$/ =~ name
|
2009-08-26 12:00:37 +04:00
|
|
|
val.sub!(/\As(\\?\W)(?:\^|\${1,2})\1\1(;|\z)/, '')
|
2009-04-09 22:01:26 +04:00
|
|
|
if val.empty?
|
|
|
|
$install_name ||= "ruby"
|
|
|
|
next
|
|
|
|
end
|
|
|
|
unless $install_name
|
|
|
|
$install_name = "ruby"
|
|
|
|
val.gsub!(/\$\$/, '$')
|
2021-10-29 18:40:21 +03:00
|
|
|
val.scan(%r[\G[\s;]*(/(?:\\.|[^/])*+/)?([sy])(\\?\W)((?:(?!\3)(?:\\.|.))*+)\3((?:(?!\3)(?:\\.|.))*+)\3([gi]*)]) do
|
2009-04-09 22: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 18:03:10 +04:00
|
|
|
end
|
2013-02-07 11:21:30 +04:00
|
|
|
eq = win32 && vars[name] ? '<< "\n"' : '='
|
2013-02-06 12:32:53 +04:00
|
|
|
vars[name] = val
|
2010-02-18 16:33:25 +03:00
|
|
|
if name == "configure_args"
|
|
|
|
val.gsub!(/--with-out-ext/, "--without-ext")
|
|
|
|
end
|
2006-06-25 18:03:10 +04:00
|
|
|
val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump
|
2010-12-16 15:46:44 +03:00
|
|
|
case name
|
|
|
|
when /^prefix$/
|
2006-06-25 18:03:10 +04:00
|
|
|
val = "(TOPDIR || DESTDIR + #{val})"
|
2010-12-16 15:46:44 +03:00
|
|
|
when /^ARCH_FLAG$/
|
|
|
|
val = "arch_flag || #{val}" if universal
|
|
|
|
when /^UNIVERSAL_ARCHNAMES$/
|
|
|
|
universal, val = val, 'universal' if universal
|
|
|
|
when /^arch$/
|
|
|
|
if universal
|
2023-01-25 10:09:40 +03:00
|
|
|
platform = val.sub(/universal/, '$(arch)')
|
2010-12-16 15:46:44 +03:00
|
|
|
end
|
2022-11-04 12:19:30 +03:00
|
|
|
when /^target_cpu$/
|
|
|
|
if universal
|
2023-01-25 10:09:40 +03:00
|
|
|
val = 'cpu'
|
2022-11-04 12:19:30 +03:00
|
|
|
end
|
|
|
|
when /^target$/
|
|
|
|
val = '"$(target_cpu)-$(target_vendor)-$(target_os)"'
|
|
|
|
when /^host(?:_(?:os|vendor|cpu|alias))?$/
|
|
|
|
val = %["$(#{name.sub(/^host/, 'target')})"]
|
2021-04-15 06:49:06 +03:00
|
|
|
when /^includedir$/
|
2015-02-10 11:30:16 +03:00
|
|
|
val = '"$(SDKROOT)"'+val if /darwin/ =~ arch
|
2006-06-25 18:03:10 +04:00
|
|
|
end
|
2013-02-07 11:21:30 +04:00
|
|
|
v = " CONFIG[\"#{name}\"] #{eq} #{val}\n"
|
1998-01-16 15:19:09 +03:00
|
|
|
if fast[name]
|
|
|
|
v_fast << v
|
|
|
|
else
|
|
|
|
v_others << v
|
|
|
|
end
|
2018-12-28 06:09:29 +03:00
|
|
|
#case name
|
|
|
|
#when "RUBY_PROGRAM_VERSION"
|
|
|
|
# version = val[/\A"(.*)"\z/, 1]
|
|
|
|
#end
|
1998-01-16 15:19:09 +03: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 18:17:44 +04:00
|
|
|
drive = File::PATH_SEPARATOR == ';'
|
|
|
|
|
2013-02-06 12:32:53 +04: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-28 02:52:46 +04:00
|
|
|
prefix = vars.expand(vars["prefix"] ||= "")
|
|
|
|
rubyarchdir = vars.expand(vars["rubyarchdir"] ||= "")
|
2014-06-27 19:35:15 +04:00
|
|
|
relative_archdir = rubyarchdir.rindex(prefix, 0) ? rubyarchdir[prefix.size..-1] : rubyarchdir
|
2018-12-28 06:09:29 +03:00
|
|
|
|
2015-03-07 05:06:11 +03:00
|
|
|
puts %[\
|
2016-11-17 10:19:49 +03:00
|
|
|
# encoding: ascii-8bit
|
2015-12-09 23:53:21 +03:00
|
|
|
# frozen-string-literal: false
|
2016-11-05 09:59:31 +03:00
|
|
|
#
|
|
|
|
# The module storing Ruby interpreter configurations on building.
|
|
|
|
#
|
2015-11-16 10:16:16 +03: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-07 05:06:11 +03:00
|
|
|
|
|
|
|
module RbConfig
|
2015-03-26 03:30:07 +03:00
|
|
|
RUBY_VERSION.start_with?("#{version[/^[0-9]+\.[0-9]+\./] || version}") or
|
2015-03-07 05:06:11 +03:00
|
|
|
raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})"
|
|
|
|
|
|
|
|
]
|
2016-11-05 09:59:31 +03:00
|
|
|
print " # Ruby installed directory.\n"
|
2014-06-27 19:35:15 +04:00
|
|
|
print " TOPDIR = File.dirname(__FILE__).chomp!(#{relative_archdir.dump})\n"
|
2016-11-05 10:14:19 +03: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 18:17:44 +04:00
|
|
|
print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n"
|
2023-01-25 10:09:40 +03:00
|
|
|
print <<"UNIVERSAL", <<'ARCH' if universal
|
|
|
|
universal = #{universal}
|
|
|
|
UNIVERSAL
|
2010-12-16 15:46:44 +03:00
|
|
|
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]
|
2023-01-25 10:09:40 +03:00
|
|
|
cpu = arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || RUBY_PLATFORM[/\A[^-]*/]
|
2010-12-16 15:46:44 +03:00
|
|
|
ARCH
|
2016-11-05 09:59:31 +03: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 18:17:44 +04:00
|
|
|
print " CONFIG = {}\n"
|
|
|
|
print " CONFIG[\"DESTDIR\"] = DESTDIR\n"
|
|
|
|
|
2009-03-25 01:44:17 +03:00
|
|
|
versions = {}
|
|
|
|
IO.foreach(File.join(srcdir, "version.h")) do |l|
|
2010-08-24 01:08:19 +04:00
|
|
|
m = /^\s*#\s*define\s+RUBY_(PATCHLEVEL)\s+(-?\d+)/.match(l)
|
2009-03-25 01:44:17 +03:00
|
|
|
if m
|
2010-08-24 01:08:19 +04:00
|
|
|
versions[m[1]] = m[2]
|
2016-01-09 04:02:17 +03:00
|
|
|
break if versions.size == 4
|
|
|
|
next
|
2010-08-24 01:08:19 +04:00
|
|
|
end
|
2019-01-11 07:58:33 +03: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-09 04:02:17 +03:00
|
|
|
m = /^\s*#\s*define\s+RUBY_VERSION\s+\W?([.\d]+)/.match(l)
|
2010-08-24 01:08:19 +04:00
|
|
|
if m
|
2016-01-09 04:02:17 +03:00
|
|
|
versions['MAJOR'], versions['MINOR'], versions['TEENY'] = m[1].split('.')
|
2009-03-25 01:44:17 +03:00
|
|
|
break if versions.size == 4
|
2016-01-09 04:02:17 +03:00
|
|
|
next
|
2009-03-25 01:44:17 +03:00
|
|
|
end
|
2009-02-03 01:01:26 +03:00
|
|
|
end
|
2019-01-11 07:58:33 +03: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-25 01:44:17 +03:00
|
|
|
%w[MAJOR MINOR TEENY PATCHLEVEL].each do |v|
|
2018-12-28 05:12:34 +03:00
|
|
|
print " CONFIG[#{v.dump}] = #{(versions[v]||vars[v]).dump}\n"
|
1999-08-13 09:45:20 +04:00
|
|
|
end
|
|
|
|
|
2011-08-13 17: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 18:17:44 +04:00
|
|
|
v_others.collect! do |x|
|
2011-08-13 17: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 18:17:44 +04:00
|
|
|
x.sub(dest, '= "$(DESTDIR)')
|
2000-06-19 07:37:55 +04:00
|
|
|
else
|
|
|
|
x
|
|
|
|
end
|
|
|
|
end
|
2011-08-13 17:17:30 +04:00
|
|
|
v_others.compact!
|
2000-06-19 07:37:55 +04:00
|
|
|
|
2000-08-03 13:50:41 +04:00
|
|
|
if $install_name
|
2013-12-27 09:46:06 +04:00
|
|
|
if install_name and vars.expand("$(RUBY_INSTALL_NAME)") == $install_name
|
|
|
|
$install_name = install_name
|
|
|
|
end
|
2000-08-03 13: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 09:46:06 +04:00
|
|
|
if so_name and vars.expand("$(RUBY_SO_NAME)") == $so_name
|
|
|
|
$so_name = so_name
|
|
|
|
end
|
2000-08-03 13:50:41 +04:00
|
|
|
v_fast << " CONFIG[\"RUBY_SO_NAME\"] = \"" + $so_name + "\"\n"
|
|
|
|
end
|
|
|
|
|
2006-09-08 23:48:22 +04:00
|
|
|
print(*v_fast)
|
|
|
|
print(*v_others)
|
2016-06-14 19:44:45 +03:00
|
|
|
print <<EOS if $unicode_version
|
|
|
|
CONFIG["UNICODE_VERSION"] = #{$unicode_version.dump}
|
|
|
|
EOS
|
2018-12-07 11:51:26 +03:00
|
|
|
print <<EOS if $unicode_emoji_version
|
|
|
|
CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump}
|
|
|
|
EOS
|
2023-01-10 15:19:58 +03:00
|
|
|
print prefix.start_with?("/System/") ? <<EOS : <<EOS if /darwin/ =~ arch
|
2021-04-15 06:49:06 +03: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
|
2023-01-10 15:19:58 +03:00
|
|
|
EOS
|
|
|
|
CONFIG["SDKROOT"] = ""
|
2015-02-10 11:30:16 +03:00
|
|
|
EOS
|
1999-08-13 09:45:20 +04:00
|
|
|
print <<EOS
|
2021-03-21 18:20:27 +03:00
|
|
|
CONFIG["platform"] = #{platform || '"$(arch)"'}
|
2013-02-06 12:32:53 +04:00
|
|
|
CONFIG["archdir"] = "$(rubyarchdir)"
|
2004-03-18 12:50:14 +03:00
|
|
|
CONFIG["topdir"] = File.dirname(__FILE__)
|
2016-11-05 09:59:31 +03: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 09:51:40 +03:00
|
|
|
# prefix = \#{RbConfig::MAKEFILE_CONFIG['prefix']}
|
|
|
|
# exec_prefix = \#{RbConfig::MAKEFILE_CONFIG['exec_prefix']}
|
|
|
|
# bindir = \#{RbConfig::MAKEFILE_CONFIG['bindir']}
|
2016-11-05 09:59:31 +03: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 09:51:40 +03:00
|
|
|
# p RbConfig.expand(RbConfig::MAKEFILE_CONFIG["bindir"])
|
2016-11-05 09:59:31 +03:00
|
|
|
# # => "/usr/local/bin"
|
2000-07-31 13:43:14 +04:00
|
|
|
MAKEFILE_CONFIG = {}
|
|
|
|
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
2016-11-05 09:59:31 +03: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 11:34:53 +03:00
|
|
|
def RbConfig::expand(val, config = CONFIG)
|
2009-06-30 11:55:36 +04:00
|
|
|
newval = val.gsub(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) {
|
2008-02-12 09:28:23 +03: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 18:17:44 +04:00
|
|
|
if !(v = $1 || $2)
|
|
|
|
'$'
|
2005-11-11 02:22:03 +03: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 18:17:44 +04:00
|
|
|
config[v] = false
|
2009-06-30 11:55:36 +04:00
|
|
|
config[v] = RbConfig::expand(key, config)
|
2008-02-13 10:26:52 +03:00
|
|
|
key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
|
2005-11-11 02:22:03 +03:00
|
|
|
key
|
2000-07-31 13:43:14 +04:00
|
|
|
else
|
|
|
|
var
|
|
|
|
end
|
2009-06-30 11:55:36 +04:00
|
|
|
}
|
|
|
|
val.replace(newval) unless newval == val
|
2000-07-31 13: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 11:34:53 +03:00
|
|
|
RbConfig::expand(val)
|
2000-07-31 13:43:14 +04:00
|
|
|
end
|
2009-12-31 18:00:04 +03:00
|
|
|
|
2018-11-14 07:42:14 +03:00
|
|
|
# call-seq:
|
|
|
|
#
|
2020-03-21 03:22:11 +03:00
|
|
|
# RbConfig.fire_update!(key, val) -> array
|
|
|
|
# RbConfig.fire_update!(key, val, mkconf, conf) -> array
|
2018-11-14 07:42:14 +03: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 21:28:39 +03:00
|
|
|
def RbConfig.fire_update!(key, val, mkconf = MAKEFILE_CONFIG, conf = CONFIG) # :nodoc:
|
2019-06-28 06:36:03 +03:00
|
|
|
return if mkconf[key] == val
|
2018-11-14 07:42:14 +03: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 09:59:31 +03:00
|
|
|
# call-seq:
|
|
|
|
#
|
|
|
|
# RbConfig.ruby -> path
|
|
|
|
#
|
2009-12-31 18:00:04 +03: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 09:45:20 +04:00
|
|
|
end
|
2002-12-31 15:31:12 +03:00
|
|
|
CROSS_COMPILING = nil unless defined? CROSS_COMPILING
|
1999-08-13 09:45:20 +04:00
|
|
|
EOS
|
2005-11-11 02:22:03 +03:00
|
|
|
|
1998-01-16 15:19:09 +03:00
|
|
|
# vi:set sw=2:
|