diff --git a/Library/Contributions/cmd/brew-test-bot.rb b/Library/Contributions/cmd/brew-test-bot.rb index 8dc327484e..adcaf3d191 100755 --- a/Library/Contributions/cmd/brew-test-bot.rb +++ b/Library/Contributions/cmd/brew-test-bot.rb @@ -20,7 +20,6 @@ # --ci-testing-upload: Homebrew CI testing bottle upload. require 'formula' -require 'extend/ENV' require 'utils' require 'date' require 'rexml/document' diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index e603220606..2d9bb908fa 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -1,3 +1,8 @@ +module CompilerConstants + GNU_GCC_VERSIONS = 3..9 + GNU_GCC_REGEXP = /gcc-(4\.[3-9])/ +end + class Compiler < Struct.new(:name, :version, :priority) # The major version for non-Apple compilers. Used to indicate a compiler # series; for instance, if the version is 4.8.2, it would return "4.8". @@ -93,7 +98,7 @@ class CompilerSelector end # non-Apple GCC 4.x - SharedEnvExtension::GNU_GCC_VERSIONS.each do |v| + CompilerConstants::GNU_GCC_VERSIONS.each do |v| name = "gcc-4.#{v}" version = @versions.non_apple_gcc_version(name) unless version.nil? diff --git a/Library/Homebrew/cxxstdlib.rb b/Library/Homebrew/cxxstdlib.rb index 7525f6ab96..0fc9beacc2 100644 --- a/Library/Homebrew/cxxstdlib.rb +++ b/Library/Homebrew/cxxstdlib.rb @@ -1,3 +1,5 @@ +require "compilers" + class CxxStdlib attr_accessor :type, :compiler @@ -11,7 +13,7 @@ class CxxStdlib end def apple_compiler? - not compiler.to_s =~ SharedEnvExtension::GNU_GCC_REGEXP + not compiler.to_s =~ CompilerConstants::GNU_GCC_REGEXP end def compatible_with?(other) @@ -24,8 +26,8 @@ class CxxStdlib # libstdc++ is compatible across Apple compilers, but # not between Apple and GNU compilers, or between GNU compiler versions return false if apple_compiler? && !other.apple_compiler? - if compiler.to_s =~ SharedEnvExtension::GNU_GCC_REGEXP - return false unless other.compiler.to_s =~ SharedEnvExtension::GNU_GCC_REGEXP + if compiler.to_s =~ CompilerConstants::GNU_GCC_REGEXP + return false unless other.compiler.to_s =~ CompilerConstants::GNU_GCC_REGEXP return false unless compiler.to_s[4..6] == other.compiler.to_s[4..6] end diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 8208d185d1..9225b997f6 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -1,17 +1,18 @@ -require 'formula' +require "formula" +require "compilers" module SharedEnvExtension + include CompilerConstants + CC_FLAG_VARS = %w{CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS} FC_FLAG_VARS = %w{FCFLAGS FFLAGS} - # Update these every time a new GNU GCC branch is released - GNU_GCC_VERSIONS = (3..9) - GNU_GCC_REGEXP = /gcc-(4\.[3-9])/ - - COMPILER_SYMBOL_MAP = { 'gcc-4.0' => :gcc_4_0, - 'gcc-4.2' => :gcc, - 'llvm-gcc' => :llvm, - 'clang' => :clang } + COMPILER_SYMBOL_MAP = { + "gcc-4.0" => :gcc_4_0, + "gcc-4.2" => :gcc, + "llvm-gcc" => :llvm, + "clang" => :clang, + } COMPILERS = COMPILER_SYMBOL_MAP.values + GNU_GCC_VERSIONS.map { |n| "gcc-4.#{n}" }