Skip to content

Commit

Permalink
Added archdir, removed thens.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Oct 23, 2017
1 parent e4de0dc commit d975826
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 24 deletions.
14 changes: 12 additions & 2 deletions configure
Expand Up @@ -92,6 +92,7 @@ class Configure
@codedbdir = nil
@coredir = nil
@sitedir = nil
@archdir = nil
@vendordir = nil
@mandir = nil
@gemsdir = nil
Expand Down Expand Up @@ -193,6 +194,7 @@ class Configure
@codedbdir = dir + "/codedb"
@coredir = dir + "/core"
@sitedir = dir + "/site"
@archdir = dir + "/site/#{@cpu}-#{@os}"
@vendordir = dir + "/vendor"
end

Expand All @@ -202,15 +204,16 @@ class Configure
@codedbdir = @prefixdir + "/codedb" unless @codedbdir
@coredir = @prefixdir + "/core" unless @coredir
@sitedir = @prefixdir + "/site" unless @sitedir
@archdir = @prefixdir + "/site/#{@cpu}-#{@os}" unless @archdir
@vendordir = @prefixdir + "/vendor" unless @vendordir
@mandir = @prefixdir + "/man" unless @mandir
@gemsdir = @prefixdir + "/gems" unless @gemsdir
@includedir = @prefixdir + "/machine/include/capi" unless @includedir

@encdir = @codedbdir + "/extensions/encoding/converter"
@encdir = @prefixdir + "#{@archdir}/encoding/converter"

dirs = [@bindir, @libdir, @runtimedir, @codedbdir, @coredir, @sitedir,
@vendordir, @mandir, @gemsdir, @includedir, @encdir]
@archdir, @vendordir, @mandir, @gemsdir, @includedir, @encdir]

parts = dirs.map { |d| d.split "/" }

Expand Down Expand Up @@ -406,6 +409,10 @@ class Configure
@sitedir = expand dir
end

o.on "--archdir", "PATH", "Install arch-specific native extensions in PATH" do |dir|
@archdir = expand dir
end

o.on "--vendordir", "PATH", "Install vendor-specific Ruby code in PATH" do |dir|
@vendordir = expand dir
end
Expand Down Expand Up @@ -1593,6 +1600,7 @@ int main(int argc, char* argv[]) {
:codedbdir => @codedbdir,
:coredir => @coredir,
:sitedir => @sitedir,
:archdir => @archdir,
:vendordir => @vendordir,
:includedir => @includedir,
:mandir => @mandir,
Expand Down Expand Up @@ -1636,6 +1644,7 @@ int main(int argc, char* argv[]) {
#define RBX_ENC_PATH "#{@encdir}"
#define RBX_HDR_PATH "#{@includedir}"
#define RBX_SITE_PATH "#{@sitedir}"
#define RBX_ARCH_PATH "#{@archdir}"
#define RBX_VENDOR_PATH "#{@vendordir}"
EOF
end
Expand Down Expand Up @@ -1920,6 +1929,7 @@ runtime: #{@prefixdir}#{@runtimedir}
codedb: #{@prefixdir}#{@codedbdir}
core: #{@prefixdir}#{@coredir}
site: #{@prefixdir}#{@sitedir}
arch: #{@prefixdir}#{@archdir}
vendor: #{@prefixdir}#{@vendordir}
man: #{@prefixdir}#{@mandir}
gems: #{@prefixdir}#{@gemsdir}
Expand Down
18 changes: 5 additions & 13 deletions core/loader.rb
Expand Up @@ -48,24 +48,16 @@ def preamble
$VERBOSE = false
end

# Setup $LOAD_PATH.
# Set up $LOAD_PATH.
def system_load_path
@stage = "setting up system load path"

@lib_bin = "#{Rubinius::CODEDB_PATH}/source/bin"

# This conforms more closely to MRI. It is necessary to support
# paths that mkmf adds when compiling and installing native exts.
additions = [
"#{Rubinius::CODEDB_PATH}/extensions",
Rubinius::SITE_PATH,
"#{Rubinius::SITE_PATH}/#{RUBY_VERSION}",
"#{Rubinius::SITE_PATH}/#{Rubinius::CPU}-#{Rubinius::OS}",
Rubinius::VENDOR_PATH,
]
additions.uniq!

$LOAD_PATH.unshift(*additions)
$LOAD_PATH.unshift(Rubinius::ARCH_PATH,
Rubinius::SITE_PATH,
"#{Rubinius::SITE_PATH}/#{RUBY_VERSION}",
Rubinius::VENDOR_PATH)

if libs = ENV['RUBYLIB']
Rubinius::Logger.system.write "RUBYLIB: #{libs}"
Expand Down
5 changes: 3 additions & 2 deletions core/rbconfig.rb
@@ -1,6 +1,7 @@
module RbConfig
unless defined? RUBY_ENGINE and RUBY_ENGINE == "rbx" then
raise "Looks like you loaded the Rubinius rbconfig, but this is not Rubinius."
unless defined? RUBY_ENGINE and RUBY_ENGINE == "rbx"
raise "This RbConfig is only compatible with Rubinius. " \
"Your RUBY_ENGINE is #{RUBY_ENGINE or "undefined"}"
end

CONFIG = {}
Expand Down
2 changes: 1 addition & 1 deletion core/string.rb
Expand Up @@ -2490,7 +2490,7 @@ def insert(index, other)
index = Rubinius::Type.coerce_to index, Fixnum, :to_int
index = length + 1 + index if index < 0

if index > length or index < 0 then
if index > length or index < 0
raise IndexError, "index #{index} out of string"
end

Expand Down
4 changes: 2 additions & 2 deletions core/time.rb
Expand Up @@ -288,7 +288,7 @@ def self._load(data)

major, minor = data.unpack 'VV'

if (major & (1 << 31)) == 0 then
if (major & (1 << 31)) == 0
at major, minor
else
major &= ~(1 << 31)
Expand Down Expand Up @@ -322,7 +322,7 @@ class << self
def _dump(limit = nil)
tm = getgm.to_a

if (year & 0xffff) != year || year < 1900 then
if (year & 0xffff) != year || year < 1900
raise ArgumentError, "year too big to marshal: #{year}"
end

Expand Down
2 changes: 2 additions & 0 deletions machine/ontology.cpp
Expand Up @@ -375,6 +375,8 @@ namespace rubinius {
G(rubinius)->set_const(state, "ENC_PATH", String::create(state, path.c_str()));
path = prefix + RBX_SITE_PATH;
G(rubinius)->set_const(state, "SITE_PATH", String::create(state, path.c_str()));
path = prefix + RBX_ARCH_PATH;
G(rubinius)->set_const(state, "ARCH_PATH", String::create(state, path.c_str()));
path = prefix + RBX_VENDOR_PATH;
G(rubinius)->set_const(state, "VENDOR_PATH", String::create(state, path.c_str()));

Expand Down
9 changes: 5 additions & 4 deletions rakelib/core.rake
Expand Up @@ -20,6 +20,7 @@ def core_clean
"**/.*.rbc",
"codedb",
"spec/capi/ext/*.{o,sig,#{$dlext}}",
"#{BUILD_CONFIG[:prefixdir]}/#{BUILD_CONFIG[:archdir]}/**/*.*",
"#{BUILD_CONFIG[:bootstrap_gems_dir]}/**/Makefile",
],
:verbose => $verbose
Expand Down Expand Up @@ -108,12 +109,12 @@ melbourne_ext = FileList["#{bootstrap_gems_dir}/rubinius-melbourne*/ext/**/extco
extconf_source = FileList["#{bootstrap_gems_dir}/**/{lib,ext}/**/extconf.rb"
].exclude(melbourne_ext)

extensions_dir = "#{BUILD_CONFIG[:sourcedir]}/codedb/extensions"
extensions_dir = "#{BUILD_CONFIG[:prefixdir]}/#{BUILD_CONFIG[:archdir]}"
directory extensions_dir

signature_files = codedb_source + config_files + ext_source

def build_extension(gems_dir, ext_dir, file)
def build_extension(gems_dir, file)
extconf = %r[#{gems_dir}/[^/]+/(lib|ext)/(.*\.rb)$].match(file)[2]

Dir.chdir File.dirname(file) do
Expand Down Expand Up @@ -145,7 +146,7 @@ namespace :codedb do
# parsing so we just iterate based on files.

melbourne_ext.each do |file|
build_extension bootstrap_gems_dir, extensions_dir, file
build_extension bootstrap_gems_dir, file

ext_dir = %r[(#{bootstrap_gems_dir}/[^/]+)/.*$].match(file)[1]

Expand All @@ -160,7 +161,7 @@ namespace :codedb do
end

extconf_source.each do |file|
build_extension bootstrap_gems_dir, extensions_dir, file
build_extension bootstrap_gems_dir, file
end

ffi_cache = []
Expand Down

0 comments on commit d975826

Please sign in to comment.