#!./miniruby -s # avoid warnings with -d. $install_name ||= nil $so_name ||= nil srcdir = File.dirname(__FILE__) $:.replace [srcdir+"/lib", "."] require "fileutils" mkconfig = File.basename($0) rbconfig_rb = ARGV[0] || 'rbconfig.rb' unless File.directory?(dir = File.dirname(rbconfig_rb)) FileUtils.makedirs(dir, :verbose => true) end version = RUBY_VERSION def (config = "").write(arg) concat(arg.to_s) end $stdout = config fast = {'prefix'=>TRUE, 'ruby_install_name'=>TRUE, 'INSTALL'=>TRUE, 'EXEEXT'=>TRUE} print %[ # This file was created by #{mkconfig} when ruby was built. Any # changes made to this file will be lost the next time ruby is built. module Config RUBY_VERSION == "#{version}" or raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})" ] v_fast = [] v_others = [] vars = {} has_version = false continued_name = nil continued_line = nil File.foreach "config.status" do |line| next if /^#/ =~ line name = nil case line when /^s([%,])@(\w+)@\1(?:\|\#_!!_\#\|)?(.*)\1/ name = $2 val = $3.gsub(/\\(?=,)/, '') when /^S\["(\w+)"\]\s*=\s*"(.*)"\s*(\\)?$/ name = $1 val = $2 if $3 continued_line = [] continued_line << val continued_name = name next end when /^"(.+)"\s*(\\)?$/ if continued_line continued_line << $1 unless $2 val = continued_line.join("") name = continued_name continued_line = nil end end when /^(?:ac_given_)?INSTALL=(.*)/ v_fast << " CONFIG[\"INSTALL\"] = " + $1 + "\n" end if name next if /^(?:ac_.*|configure_input|(?:top_)?srcdir|\w+OBJS)$/ =~ name next if /^\$\(ac_\w+\)$/ =~ val next if /^\$\{ac_\w+\}$/ =~ val next if /^\$ac_\w+$/ =~ val next if $install_name and /^RUBY_INSTALL_NAME$/ =~ name next if $so_name and /^RUBY_SO_NAME$/ =~ name if /^program_transform_name$/ =~ name and /^s(\\?.)(.*)\1$/ =~ val next if $install_name sep = %r"#{Regexp.quote($1)}" ptn = $2.sub(/\$\$/, '$').split(sep, 2) name = "ruby_install_name" val = "ruby".sub(/#{ptn[0]}/, ptn[1]) end val.gsub!(/ +(?!-)/, "=") if name == "configure_args" && /mswin32/ =~ RUBY_PLATFORM val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump if /^prefix$/ =~ name val = "(TOPDIR || DESTDIR + #{val})" end v = " CONFIG[\"#{name}\"] #{vars[name] ? '<< "\n"' : '='} #{val}\n" vars[name] = true if fast[name] v_fast << v else v_others << v end has_version = true if name == "MAJOR" end # break if /^CEOF/ end drive = File::PATH_SEPARATOR == ';' prefix = '/lib/ruby/' + RUBY_VERSION.sub(/\.\d+$/, '') + '/' + RUBY_PLATFORM print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n" print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n" print " CONFIG = {}\n" print " CONFIG[\"DESTDIR\"] = DESTDIR\n" unless has_version RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) { print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n" print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n" print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n" } patchlevel = IO.foreach(File.join(srcdir, "version.h")) {|l| m = /^\s*#\s*define\s+RUBY_PATCHLEVEL\s+(\d+)/.match(l) and break m[1] } print " CONFIG[\"PATCHLEVEL\"] = \"#{patchlevel}\"\n" end dest = drive ? /= \"(?!\$[\(\{])(?:[a-z]:)?/i : /= \"(?!\$[\(\{])/ v_others.collect! do |x| if /^\s*CONFIG\["(?!abs_|old)[a-z]+(?:_prefix|dir)"\]/ === x x.sub(dest, '= "$(DESTDIR)') else x end end if $install_name v_fast << " CONFIG[\"ruby_install_name\"] = \"" + $install_name + "\"\n" v_fast << " CONFIG[\"RUBY_INSTALL_NAME\"] = \"" + $install_name + "\"\n" end if $so_name v_fast << " CONFIG[\"RUBY_SO_NAME\"] = \"" + $so_name + "\"\n" end print(*v_fast) print(*v_others) print <Koichi Sasada 2021-01-05enable constant cache on ractorsKoichi Sasada 2020-12-17add debug counters for gc start eventsKoichi Sasada 2020-12-17make RB_DEBUG_COUNTER_INC()_thread-safeKoichi Sasada 2020-12-16add vm_sync debug countersKoichi Sasada 2020-12-15add several debug countersKoichi Sasada 2020-12-14fix condition and add another debug counterKoichi Sasada 2020-12-14add ccs_not_found debug counterKoichi Sasada 2020-12-14add debug counters to survey the IMC missKoichi Sasada 2020-12-14add cc_invalidate_negative debug counterKoichi Sasada 2020-11-09Add debug counter for ivar inline cache misses that could hitAaron Patterson 2020-11-09remove unused debug counterAaron Patterson 2020-07-10Explicit conversion to boolean to suppress shorten-64-to-32 warningsNobuyoshi Nakada 2020-05-28Add a debug_counter for JIT cancel on leaveTakashi Kokubun 2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平 2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平 2020-04-13Make vm_call_cfunc_with_frame a fastpath (#3027)Takashi Kokubun 2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平 2020-03-30Optimize exivar access on JIT-ed getivarTakashi Kokubun 2020-03-16Fix typos [ci skip]Kazuhiro NISHIYAMA 2020-03-15Add debug counter for unload_unitsTakashi Kokubun 2020-02-22Introduce disposable call-cache.Koichi Sasada 2020-02-22VALUE size packed callinfo (ci).Koichi Sasada 2019-12-26debug_counter.h must be self-contained卜部昌平 2019-12-25add debug_counter access functions.Koichi Sasada 2019-12-23add more debug counters to count numeric objects.Koichi Sasada 2019-12-22Fixed misspellingsNobuyoshi Nakada 2019-12-18describe mc_miss_reuse_call [ci skip]卜部昌平 2019-12-17add debug counter to count `call` reusing cases.Koichi Sasada 2019-10-03add debug counters for vm_search_method_slowpath()卜部昌平 2019-09-25introduce `obj_ary_extracapa`.Koichi Sasada 2019-09-20Fix rb_define_singleton_method warningTakashi Kokubun