Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Host configuration #1929

Closed
wants to merge 2 commits into from

2 participants

@voxik

These configure options mimic standard autoconf options. The --build is
guessed by default, but it has no real meaning ATM. The --host defaults
to BUILD value, but can be overridden, to specify the platform Rubinius will
run on. This could be used for cross-compilation in the future. At now,
it helps to recognize vendor properly.

voxik added some commits
@voxik voxik Dealy initialization of configuration options.
This allows to specify host by configuration parameters.
01c7a3d
@voxik voxik Add --build and --host configure options.
These configure options mimic standard autoconf options. The --build is
guessed by default, but it has no real meaning ATM. The --host defaults
to BUILD value, but can be overridden, to specify the platform Rubinius will
run on. This could be used for cross-compilation in the future. At now,
it helps to recognize vendor properly.
f0ca61f
@voxik

Just for illustration, Rubinius reported itself as

rubinius 2.0.0dev (1.8.7 release yyyy-mm-dd JI) [x86_64-unknown-linux-gnu]

while with this configuration option, it reports

rubinius 2.0.0dev (1.9.3 release yyyy-mm-dd JI) [x86_64-redhat-linux-gnu]

This applies to Fedora builds using standard configuration options.

@brixen
Owner

Why did you move the code out of #initialize?

@voxik

I moved it, because there are done some actions based on detected host. But since the host can be overridden by the --host flag, they have to be done later.

@brixen
Owner

There are a number of places where multiple values have to be updated when an option is processed. Just update what needs to be set in the --host option.

@brixen
Owner

There is a terrible tangle of dependencies around the code in #initialize. I mostly untangled them. I'll push a commit that adds --host shortly. Unless you give me a compelling reason for --build right now, I'm not adding it. "We might need something like this" won't suffice.

@voxik

Well, the truth is that I'd love to see merged this [1] branch. This would allow to feed in various standard options which can be consumed by typical configure script generated by autotools and it would make packaging for Fedora more foolproof (i.e. I would be able to use standard %{configure} macro instead of specifying each configuration option one by one). So I would not cry for the --build all that much.

[1] https://github.com/voxik/rubinius/commits/accept-standard-configure-options/

@brixen brixen closed this in a1d6985
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2012
  1. @voxik

    Dealy initialization of configuration options.

    voxik authored
    This allows to specify host by configuration parameters.
  2. @voxik

    Add --build and --host configure options.

    voxik authored
    These configure options mimic standard autoconf options. The --build is
    guessed by default, but it has no real meaning ATM. The --host defaults
    to BUILD value, but can be overridden, to specify the platform Rubinius will
    run on. This could be used for cross-compilation in the future. At now,
    it helps to recognize vendor properly.
This page is out of date. Refresh to see the latest.
Showing with 76 additions and 37 deletions.
  1. +76 −37 configure
View
113 configure
@@ -25,33 +25,27 @@ class Configure
@defines = []
@config = File.join(root, "config.rb")
- @host = `sh -c ./rakelib/config.guess`.chomp
- /([^-]+)-([^-]+)-(.*)/ =~ @host
- @cpu, @vendor, @os = $1, $2, $3
+ @build = nil
+ @host = nil
+ @cpu = nil
+ @vendor = nil
+ @os = nil
@little_endian = false
@sizeof = {}
# TODO: For better cross-compiling support, it may be necessary to
# use the feature facility to check for a define in the compiler.
- @windows = (@host =~ /mingw|mswin/) != nil
- @darwin = (@host =~ /darwin/) != nil
- @bsd = (@host =~ /bsd/) != nil
- @linux = (@host =~ /linux/) != nil
-
- # Set up system commands to run in cmd.exe on Windows.
- if @windows
- alias :old_system :system
- alias :old_backquote :`
- alias :system :msys_system
- alias :` :msys_backquote
- end
+ @windows = nil
+ @darwin = nil
+ @bsd = nil
+ @linux = nil
# Compiler / build settings
- @cc = ENV['CC'] || 'gcc'
- @cxx = ENV['CXX'] || 'g++'
- @rake = ENV['RAKE'] || 'rake'
- @tar = ENV['TAR'] || (@windows ? 'bsdtar' : 'tar')
- @perl = ENV['PERL'] || 'perl'
+ @cc = nil
+ @cxx = nil
+ @rake = nil
+ @tar = nil
+ @perl = nil
@default_version = "18"
@version_list = ["18", "19"]
@supported_versions = ["18", "19", "20"]
@@ -75,16 +69,8 @@ class Configure
@llvm_asset_path = "http://asset.rubini.us/prebuilt"
@llvm_source_build = false
- check_tool_version @cc, '-dumpversion', [4, 1]
- check_tool_version @cxx, '-dumpversion', [4, 1]
- check_tool_version 'bison', '--version', [2, 3]
-
- @gcc_major = `#{@cc} -dumpversion`.strip.split(".")[0,2].join(".")
- if @host == "i686-pc-linux-gnu" || @host == "x86_64-unknown-linux-gnu"
- @llvm_generic_prebuilt = "llvm-#{@llvm_version}-#{@host}-#{@gcc_major}.tar.bz2"
- else
- @llvm_generic_prebuilt = "llvm-#{@llvm_version}-#{@host}.tar.bz2"
- end
+ @gcc_major = nil
+ @llvm_generic_prebuilt = nil
@llvm_parent_path = File.join(root, "vendor")
@llvm_default = File.join(@llvm_parent_path, "llvm")
@@ -132,12 +118,7 @@ class Configure
@release_date = "yyyy-mm-dd"
@config_version = 162
- # TODO: add conditionals for platforms
- if RbConfig::CONFIG["build_os"] =~ /darwin/
- @ldshared = "#{@cc} -bundle -undefined suppress -flat_namespace"
- else
- @ldshared = "#{@cc} -shared"
- end
+ @ldshared = nil
import_env
end
@@ -217,6 +198,53 @@ class Configure
end
end
+ def set_platform
+ @build ||= `sh -c ./rakelib/config.guess`.chomp
+ @host ||= @build
+ /([^-]+)-([^-]+)-(.*)/ =~ @host
+ @cpu, @vendor, @os = $1, $2, $3
+
+ # TODO: For better cross-compiling support, it may be necessary to
+ # use the feature facility to check for a define in the compiler.
+ @windows = (@host =~ /mingw|mswin/) != nil
+ @darwin = (@host =~ /darwin/) != nil
+ @bsd = (@host =~ /bsd/) != nil
+ @linux = (@host =~ /linux/) != nil
+
+ # Set up system commands to run in cmd.exe on Windows.
+ if @windows
+ alias :old_system :system
+ alias :old_backquote :`
+ alias :system :msys_system
+ alias :` :msys_backquote
+ end
+
+ # Compiler / build settings
+ @cc = ENV['CC'] || 'gcc'
+ @cxx = ENV['CXX'] || 'g++'
+ @rake = ENV['RAKE'] || 'rake'
+ @tar = ENV['TAR'] || (@windows ? 'bsdtar' : 'tar')
+ @perl = ENV['PERL'] || 'perl'
+
+ @gcc_major = `#{@cc} -dumpversion`.strip.split(".")[0,2].join(".")
+ if @host == "i686-pc-linux-gnu" || @host == "x86_64-unknown-linux-gnu"
+ @llvm_generic_prebuilt = "llvm-#{@llvm_version}-#{@host}-#{@gcc_major}.tar.bz2"
+ else
+ @llvm_generic_prebuilt = "llvm-#{@llvm_version}-#{@host}.tar.bz2"
+ end
+
+ check_tool_version @cc, '-dumpversion', [4, 1]
+ check_tool_version @cxx, '-dumpversion', [4, 1]
+ check_tool_version 'bison', '--version', [2, 3]
+
+ # TODO: add conditionals for platforms
+ if RbConfig::CONFIG["build_os"] =~ /darwin/
+ @ldshared = "#{@cc} -bundle -undefined suppress -flat_namespace"
+ else
+ @ldshared = "#{@cc} -shared"
+ end
+ end
+
def options
o = Rubinius::Options.new "Usage: configure [options]", 30
o.left_align
@@ -308,6 +336,16 @@ class Configure
update_prebuilt @llvm_generic_prebuilt, true
end
+ o.doc "\n System types"
+
+ o.on "--build", "BUILD", "configure for building on BUILD [guessed]" do |build|
+ @build = build
+ end
+
+ o.on "--host", "HOST", "build programs to run on HOST [BUILD]" do |host|
+ @host = host
+ end
+
o.doc "\n System settings"
o.on "--with-include-dir", "DIR", "Add DIR to the default include search paths" do |dir|
@@ -399,7 +437,7 @@ class Configure
feature "execinfo", default_on
feature "C-readline", true
feature "ruby-readline", false
- feature "vendor-zlib", !!@windows
+ feature "vendor-zlib", RUBY_PLATFORM =~ /mingw|mswin/
feature "alloc-tracking", false
feature "fibers", true
@@ -1657,6 +1695,7 @@ end
parse ARGV
set_filesystem_paths
+ set_platform
if File.join(@bindir, @program_name) == build_ruby
@log.error "\nYou are attempting to build using the instance of Rubinius that you are building.\n\n"
Something went wrong with that request. Please try again.