Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use RbConfig instead of Config

  • Loading branch information...
commit bd6aef7fcda541f3da68677688aa1d05f923d5f7 1 parent b3033b4
Dirkjan Bussink dbussink authored
2  Rakefile
View
@@ -33,7 +33,7 @@ unless BUILD_CONFIG[:which_ruby] == :ruby or BUILD_CONFIG[:which_ruby] == :rbx
exit 1
end
-$dlext = Config::CONFIG["DLEXT"]
+$dlext = RbConfig::CONFIG["DLEXT"]
task :default => %w[build vm:test] do
unless File.directory? BUILD_CONFIG[:runtime]
4 benchmark/yarv/report.rb
View
@@ -25,8 +25,8 @@ def exec_command type, file, w
def benchmark cmd
rubybin = ENV['RUBY'] || File.join(
- Config::CONFIG["bindir"],
- Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"])
+ RbConfig::CONFIG["bindir"],
+ RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"])
IO.popen(rubybin, 'r+'){|io|
io.write cmd
4 benchmark/yarv/runc.rb
View
@@ -6,8 +6,8 @@
require 'rbconfig'
$rubybin = ENV['RUBY'] || File.join(
- Config::CONFIG["bindir"],
- Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"])
+ RbConfig::CONFIG["bindir"],
+ RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"])
def runfile file
puts file
8 configure
View
@@ -70,7 +70,7 @@ class Configure
end
# TODO: add conditionals for platforms
- if Config::CONFIG["build_os"] =~ /darwin/
+ if RbConfig::CONFIG["build_os"] =~ /darwin/
@ldshared = "cc -dynamic -bundle -undefined suppress -flat_namespace"
else
@ldshared = "cc -shared"
@@ -571,9 +571,9 @@ class Configure
# script. That path will be made available to the rest of the build system
# so the same version of ruby is invoked as needed.
def build_ruby
- bin = Config::CONFIG["RUBY_INSTALL_NAME"] || Config::CONFIG["ruby_install_name"]
- bin << (Config::CONFIG['EXEEXT'] || Config::CONFIG['exeext'] || '')
- File.join(Config::CONFIG['bindir'], bin)
+ bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
+ bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
+ File.join(RbConfig::CONFIG['bindir'], bin)
end
def get_system_name
2  lib/ext/dl/extconf.rb
View
@@ -22,7 +22,7 @@
($CPPFLAGS || $CFLAGS) << " -I."
-if (Config::CONFIG['CC'] =~ /gcc/) # from Win32API
+if (RbConfig::CONFIG['CC'] =~ /gcc/) # from Win32API
$CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer"
end
4 lib/ext/melbourne/Rakefile
View
@@ -46,8 +46,8 @@ when ["build:mri"]
puts "Building Melbourne for MRI"
add_mri_capi
set_ext_dir "ruby"
- add_link_dir Config::CONFIG["libdir"]
- add_ldflag Config::CONFIG["LIBRUBYARG"]
+ add_link_dir RbConfig::CONFIG["libdir"]
+ add_ldflag RbConfig::CONFIG["LIBRUBYARG"]
end
add_objects project_files, ext_dir
52 lib/mkmf.rb
View
@@ -5,7 +5,7 @@
require 'fileutils'
require 'shellwords'
-CONFIG = Config::MAKEFILE_CONFIG
+CONFIG = RbConfig::MAKEFILE_CONFIG
ORIG_LIBPATH = ENV['LIB']
CXX_EXT = %w[cc cxx cpp]
@@ -326,28 +326,28 @@ def try_do(src, command, &b)
end
def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
- conf = Config::CONFIG.merge('hdrdir' => $hdrdir.quote,
- 'src' => CONFTEST_C,
- 'INCFLAGS' => $INCFLAGS,
- 'CPPFLAGS' => $CPPFLAGS,
- 'CFLAGS' => "#$CFLAGS",
- 'ARCH_FLAG' => "#$ARCH_FLAG",
- 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
- 'LIBPATH' => libpathflag(libpath),
- 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
- 'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
- Config::expand(TRY_LINK.dup, conf)
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,
+ 'src' => CONFTEST_C,
+ 'INCFLAGS' => $INCFLAGS,
+ 'CPPFLAGS' => $CPPFLAGS,
+ 'CFLAGS' => "#$CFLAGS",
+ 'ARCH_FLAG' => "#$ARCH_FLAG",
+ 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
+ 'LIBPATH' => libpathflag(libpath),
+ 'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
+ 'LIBS' => "#$LIBRUBYARG_STATIC #{opt} #$LIBS")
+ RbConfig::expand(TRY_LINK.dup, conf)
end
def cc_command(opt="")
- conf = Config::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)
- Config::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)
+ RbConfig::expand("$(CC) #$INCFLAGS #$CPPFLAGS #$CFLAGS #$ARCH_FLAG #{opt} -c #{CONFTEST_C}",
conf)
end
def cpp_command(outfile, opt="")
- conf = Config::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)
- Config::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
+ conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote, 'srcdir' => $srcdir.quote)
+ RbConfig::expand("$(CPP) #$INCFLAGS #$CPPFLAGS #$CFLAGS #{opt} #{CONFTEST_C} #{outfile}",
conf)
end
@@ -551,7 +551,7 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
ifiles or return
ifiles.empty? and return
srcprefix ||= '$(srcdir)'
- Config::expand(srcdir = srcprefix.dup)
+ RbConfig::expand(srcdir = srcprefix.dup)
dirs = []
path = Hash.new {|h, i| h[i] = dirs.push([i])[-1]}
ifiles.each do |files, dir, prefix|
@@ -1338,7 +1338,7 @@ def configuration(srcdir)
RUBY_SO_NAME = #{CONFIG['RUBY_SO_NAME']}
arch = #{CONFIG['arch']}
sitearch = #{CONFIG['sitearch']}
-ruby_version = #{Config::CONFIG['ruby_version']}
+ruby_version = #{RbConfig::CONFIG['ruby_version']}
ruby = #{$ruby}
RUBY = $(ruby#{sep})
RM = #{config_string('RM') || '$(RUBY) -run -e rm -- -f'}
@@ -1401,7 +1401,7 @@ def dummy_makefile(srcdir)
# Makefile.
#
# Setting the +target_prefix+ will, in turn, install the generated binary in
-# a directory under your Config::CONFIG['sitearchdir'] that mimics your local
+# a directory under your RbConfig::CONFIG['sitearchdir'] that mimics your local
# filesystem when you run 'make install'.
#
# For example, given the following file tree:
@@ -1449,7 +1449,7 @@ def create_makefile(target, srcprefix = nil)
end
srcprefix ||= '$(srcdir)'
- Config::expand(srcdir = srcprefix.dup)
+ RbConfig::expand(srcdir = srcprefix.dup)
if not $objs
$objs = []
@@ -1721,7 +1721,7 @@ def init_mkmf(config = CONFIG)
$objs = nil
$srcs = nil
$libs = ""
- if $enable_shared or Config.expand(config["LIBRUBY"].dup) != Config.expand(config["LIBRUBY_A"].dup)
+ if $enable_shared or RbConfig.expand(config["LIBRUBY"].dup) != RbConfig.expand(config["LIBRUBY_A"].dup)
$LIBRUBYARG = config['LIBRUBYARG']
end
@@ -1772,20 +1772,20 @@ def mkmf_failed(path)
$nmake = ?b if /Borland/i =~ `#{make} -h`
end
-Config::CONFIG["srcdir"] = CONFIG["srcdir"] =
+RbConfig::CONFIG["srcdir"] = CONFIG["srcdir"] =
$srcdir = arg_config("--srcdir", File.dirname($0))
$configure_args["--topsrcdir"] ||= $srcdir
if $curdir = arg_config("--curdir")
- Config.expand(curdir = $curdir.dup)
+ RbConfig.expand(curdir = $curdir.dup)
else
curdir = $curdir = "."
end
-unless File.expand_path(Config::CONFIG["topdir"]) == File.expand_path(curdir)
+unless File.expand_path(RbConfig::CONFIG["topdir"]) == File.expand_path(curdir)
CONFIG["topdir"] = $curdir
- Config::CONFIG["topdir"] = curdir
+ RbConfig::CONFIG["topdir"] = curdir
end
$configure_args["--topdir"] ||= $curdir
-$ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
+$ruby = arg_config("--ruby", File.join(RbConfig::CONFIG["bindir"], CONFIG["ruby_install_name"]))
split = Shellwords.method(:shellwords).to_proc
10 lib/rbconfig.rb
View
@@ -1,6 +1,6 @@
require 'rubinius/build_config'
-module Config
+module RbConfig
unless defined? RUBY_ENGINE and RUBY_ENGINE == "rbx" then
raise "Looks like you loaded the Rubinius rbconfig, but this is not Rubinius."
end
@@ -168,7 +168,7 @@ module Config
MAKEFILE_CONFIG = {}
CONFIG.each { |k,v| MAKEFILE_CONFIG[k] = v.kind_of?(String) ? v.dup : v }
- def Config.expand(val, config = CONFIG)
+ def RbConfig.expand(val, config = CONFIG)
return val unless val.kind_of? String
val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
@@ -177,7 +177,7 @@ def Config.expand(val, config = CONFIG)
elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
pat, sub = $1, $2
config[v] = false
- Config.expand(key, config)
+ RbConfig.expand(key, config)
config[v] = key
key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
key
@@ -189,9 +189,9 @@ def Config.expand(val, config = CONFIG)
end
CONFIG.each_value do |val|
- Config.expand(val)
+ RbConfig.expand(val)
end
end
CROSS_COMPILING = nil unless defined? CROSS_COMPILING
-RbConfig = Config
+Config = RbConfig
2  rakelib/ext_helper.rb
View
@@ -9,7 +9,7 @@ def env(name, default = "")
# Common settings. These can be augmented or overridden
# by the particular extension Rakefile.
#
-DEFAULT = Config::CONFIG
+DEFAULT = RbConfig::CONFIG
# Don't like the globals? Too bad, they are simple and the
# duration of this process is supposed to be short.
18 spec/library/config/rbconfig_spec.rb
View
@@ -6,7 +6,7 @@
# However, the specs are valuable in that they will ensure
# that rbconfig loads and contains required values.
#
-# The Config entries fall into two general categories:
+# The RbConfig entries fall into two general categories:
# 1) the static-value entries; and 2) the configured-
# value entries. For the second one, the specs check
# only for the existence of a key.
@@ -39,14 +39,14 @@ def it_has_entries(name, entries)
end
end
-describe "RbConfig" do
- it "is equal to Config" do
- RbConfig.should eql(Config)
+describe "Config" do
+ it "is equal to RbConfig" do
+ Config.should eql(RbConfig)
end
end
# TODO: many more specs needed
-describe "Config::CONFIG" do
+describe "RbConfig::CONFIG" do
keys = [
"LDSHARED",
"DLEXT",
@@ -61,7 +61,7 @@ def it_has_entries(name, entries)
"bindir"
]
- it_has_keys 'Config::CONFIG', keys
+ it_has_keys 'RbConfig::CONFIG', keys
entries = {
"RUBY_SO_NAME" => "rubinius-#{Rubinius::VERSION}",
@@ -69,10 +69,10 @@ def it_has_entries(name, entries)
"ruby_version" => "1.8",
}
- it_has_entries 'Config::CONFIG', entries
+ it_has_entries 'RbConfig::CONFIG', entries
end
-describe "Config::MAKEFILE_CONFIG" do
+describe "RbConfig::MAKEFILE_CONFIG" do
sitedir = Rubinius::SITE_PATH
sitelibdir = Rubinius::SITE_PATH
arch = "#{Rubinius::CPU}-#{Rubinius::OS}"
@@ -105,5 +105,5 @@ def it_has_entries(name, entries)
"rubyhdrdir" => "#{Rubinius::HDR_PATH}"
}
- it_has_entries 'Config::MAKEFILE_CONFIG', entries
+ it_has_entries 'RbConfig::MAKEFILE_CONFIG', entries
end
14 spec/ruby/optional/capi/spec_helper.rb
View
@@ -6,14 +6,14 @@ def compile_extension(path, name)
ext = File.join(path, "#{name}_spec")
source = "#{ext}.c"
obj = "#{ext}.o"
- lib = "#{ext}.#{Config::CONFIG['DLEXT']}"
+ lib = "#{ext}.#{RbConfig::CONFIG['DLEXT']}"
signature = "#{ext}.sig"
# TODO use rakelib/ext_helper.rb?
if RUBY_NAME == 'rbx'
hdrdir = Rubinius::HDR_PATH
elsif RUBY_NAME =~ /^ruby/
- hdrdir = Config::CONFIG["archdir"]
+ hdrdir = RbConfig::CONFIG["archdir"]
else
raise "Don't know how to build C extensions with #{RUBY_NAME}"
end
@@ -30,17 +30,17 @@ def compile_extension(path, name)
# avoid problems where compilation failed but previous shlib exists
File.delete lib if File.exists? lib
- cc = Config::CONFIG["CC"]
- cflags = (ENV["CFLAGS"] || Config::CONFIG["CFLAGS"]).dup
+ cc = RbConfig::CONFIG["CC"]
+ cflags = (ENV["CFLAGS"] || RbConfig::CONFIG["CFLAGS"]).dup
cflags += " -fPIC" unless cflags.include?("-fPIC")
incflags = "-I#{path} -I#{hdrdir}"
`#{cc} #{incflags} #{cflags} -c #{source} -o #{obj}`
- ldshared = Config::CONFIG["LDSHARED"]
+ ldshared = RbConfig::CONFIG["LDSHARED"]
libpath = "-L#{path}"
- libs = Config::CONFIG["LIBS"]
- dldflags = Config::CONFIG["DLDFLAGS"]
+ libs = RbConfig::CONFIG["LIBS"]
+ dldflags = RbConfig::CONFIG["DLDFLAGS"]
`#{ldshared} #{obj} #{libpath} #{dldflags} #{libs} -o #{lib}`
Please sign in to comment.
Something went wrong with that request. Please try again.