Default compiler is gcc on Linux
This commit is contained in:
parent
47fdc3dfc9
commit
1cdc34eec3
@ -3,6 +3,7 @@ module CompilerConstants
|
||||
GNU_GCC_VERSIONS = %w[4.3 4.4 4.5 4.6 4.7 4.8 4.9 5 6 7 8].freeze
|
||||
GNU_GCC_REGEXP = /^gcc-(4\.[3-9]|[5-8])$/
|
||||
COMPILER_SYMBOL_MAP = {
|
||||
"gcc" => :gcc,
|
||||
"gcc-4.0" => :gcc_4_0,
|
||||
"gcc-4.2" => :gcc_4_2,
|
||||
"clang" => :clang,
|
||||
@ -101,6 +102,7 @@ class CompilerSelector
|
||||
clang: [:clang, :gcc_4_2, :gnu, :gcc_4_0, :llvm_clang],
|
||||
gcc_4_2: [:gcc_4_2, :gnu, :clang, :gcc_4_0],
|
||||
gcc_4_0: [:gcc_4_0, :gcc_4_2, :gnu, :clang],
|
||||
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2, :gcc_4_0],
|
||||
}.freeze
|
||||
|
||||
def self.select_for(formula, compilers = self.compilers)
|
||||
@ -150,9 +152,9 @@ class CompilerSelector
|
||||
end
|
||||
|
||||
def compiler_version(name)
|
||||
case name
|
||||
when GNU_GCC_REGEXP
|
||||
versions.non_apple_gcc_version(name)
|
||||
case name.to_s
|
||||
when "gcc", GNU_GCC_REGEXP
|
||||
versions.non_apple_gcc_version(name.to_s)
|
||||
else
|
||||
versions.send("#{name}_build_version")
|
||||
end
|
||||
|
||||
@ -99,7 +99,7 @@ class DevelopmentTools
|
||||
path = HOMEBREW_PREFIX/"opt/gcc/bin"/cc
|
||||
path = locate(cc) unless path.exist?
|
||||
version = if path &&
|
||||
build_version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1]
|
||||
build_version = `#{path} --version`[/gcc(?:(?:-\d(?:\.\d)?)? \(.+\))? (\d\.\d\.\d)/, 1]
|
||||
Version.new build_version
|
||||
else
|
||||
Version::NULL
|
||||
|
||||
@ -319,7 +319,11 @@ module SharedEnvExtension
|
||||
def compiler_with_cxx11_support?(cc)
|
||||
return if compiler_any_clang?(cc)
|
||||
|
||||
version = cc[/^gcc-(\d+(?:\.\d+)?)$/, 1]
|
||||
version = if cc == :gcc
|
||||
non_apple_gcc_version "gcc"
|
||||
else
|
||||
cc[/^gcc-(\d+(?:\.\d+)?)$/, 1]
|
||||
end
|
||||
version && Version.create(version) >= Version.create("4.8")
|
||||
end
|
||||
|
||||
|
||||
@ -1 +1,5 @@
|
||||
require "extend/os/mac/development_tools" if OS.mac?
|
||||
if OS.mac?
|
||||
require "extend/os/mac/development_tools"
|
||||
elsif OS.linux?
|
||||
require "extend/os/linux/development_tools"
|
||||
end
|
||||
|
||||
7
Library/Homebrew/extend/os/linux/development_tools.rb
Normal file
7
Library/Homebrew/extend/os/linux/development_tools.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class DevelopmentTools
|
||||
class << self
|
||||
def default_compiler
|
||||
:gcc
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user