Skip to content

Commit

Permalink
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -54,6 +54,8 @@ tmtags
/work
/staging
/bootstrap
/build/bin/cc
/build/bin/c++
Gemfile.installed.lock

# .revision tracks configure and code revision consistency
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -60,6 +60,10 @@ unless RedCard.check :ruby, :rubinius
exit 1
end

if BUILD_CONFIG[:build_bin]
ENV["PATH"] = "#{BUILD_CONFIG[:build_bin]}:#{ENV["PATH"]}"
end

def libprefixdir
if BUILD_CONFIG[:stagingdir]
"#{BUILD_CONFIG[:stagingdir]}#{BUILD_CONFIG[:libdir]}"
25 changes: 23 additions & 2 deletions configure
Original file line number Diff line number Diff line change
@@ -165,6 +165,8 @@ class Configure
@ruby_version = "2.2.2"
@ruby_libversion = @ruby_version.split(/\./)[0..1].join.to_i

@build_bin = "#{@sourcedir}/build/bin"

# Configure settings
@release_build = !in_git?
end
@@ -325,11 +327,11 @@ class Configure

o.doc "\n Compiler settings"

o.on "--cc", "COMPILER", "Compiler to use for C code (eg gcc, clang)" do |cc|
o.on "--cc", "COMPILER", "Compiler to use for C code (eg clang)" do |cc|
@cc = cc
end

o.on "--cxx", "COMPILER", "Compiler to use for C++ code (eg g++, clang++)" do |cxx|
o.on "--cxx", "COMPILER", "Compiler to use for C++ code (eg clang++)" do |cxx|
@cxx = cxx
end

@@ -712,6 +714,24 @@ please notify us.
EOM
end

if File.exist? @build_bin
if !File.directory? @build_bin
fail "#{@build_bin} already exists and is not a directory"
end
else
FileUtils.mkdir_p @build_bin
end

if @cc != "cc"
cc = "#{@build_bin}/cc"
File.symlink `which #{@cc}`.chomp, cc unless File.exist? cc
end

if @cxx != "c++"
cxx = "#{@build_bin}/c++"
File.symlink `which #{@cxx}`.chomp, cxx unless File.exist? cxx
end

@make ||= ENV['MAKE'] || 'make'
@rake ||= ENV['RAKE'] || 'rake'
@tar ||= ENV['TAR'] || (@windows ? 'bsdtar' : 'tar')
@@ -1572,6 +1592,7 @@ int main() { return tgetnum(""); }
:bootstrap_gems_dir => @bootstrap_gems_dir,
:capi_includedir => @capi_includedir,
:build_exe => "#{@build_prefix}#{@bindir}/#{@program_name}",
:build_bin => @build_bin,
:prefixdir => @prefixdir,
:bindir => @bindir,
:libdir => @libdir,

0 comments on commit 68e07cd

Please sign in to comment.