linux: use preferred_gcc instead of gcc
This commit is contained in:
parent
b1c5394628
commit
0a292c7041
@ -110,16 +110,16 @@ class CompilerSelector
|
||||
raise CompilerSelectionError, formula
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
sig { returns(String) }
|
||||
def preferred_gcc
|
||||
def self.preferred_gcc
|
||||
"gcc"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def gnu_gcc_versions
|
||||
# prioritize gcc version provided by gcc formula.
|
||||
v = Formulary.factory(preferred_gcc).version.to_s.slice(/\d+/)
|
||||
v = Formulary.factory(CompilerSelector.preferred_gcc).version.to_s.slice(/\d+/)
|
||||
GNU_GCC_VERSIONS - [v] + [v] # move the version to the end of the list
|
||||
rescue FormulaUnavailableError
|
||||
GNU_GCC_VERSIONS
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
class CompilerSelector
|
||||
sig { returns(String) }
|
||||
def preferred_gcc
|
||||
def self.preferred_gcc
|
||||
# gcc-5 is the lowest gcc version we support on Linux.
|
||||
# gcc-5 is the default gcc in Ubuntu 16.04 (used for our CI)
|
||||
"gcc@5"
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "compilers"
|
||||
|
||||
class Keg
|
||||
def relocate_dynamic_linkage(relocation)
|
||||
# Patching the dynamic linker of glibc breaks it.
|
||||
@ -84,7 +86,7 @@ class Keg
|
||||
def self.bottle_dependencies
|
||||
@bottle_dependencies ||= begin
|
||||
formulae = relocation_formulae
|
||||
gcc = Formula["gcc"]
|
||||
gcc = Formulary.factory(CompilerSelector.preferred_gcc)
|
||||
if !Homebrew::EnvConfig.force_homebrew_on_linux? &&
|
||||
DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i
|
||||
formulae += gcc.recursive_dependencies.map(&:name)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "compilers"
|
||||
|
||||
class LinkageChecker
|
||||
# Libraries provided by glibc and gcc.
|
||||
SYSTEM_LIBRARY_ALLOWLIST = %w[
|
||||
@ -30,6 +32,6 @@ class LinkageChecker
|
||||
@unwanted_system_dylibs = @system_dylibs.reject do |s|
|
||||
SYSTEM_LIBRARY_ALLOWLIST.include? File.basename(s)
|
||||
end
|
||||
@undeclared_deps -= ["gcc", "glibc"]
|
||||
@undeclared_deps -= [CompilerSelector.preferred_gcc, "glibc"]
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "compilers"
|
||||
require "os/linux/glibc"
|
||||
require "system_command"
|
||||
|
||||
@ -46,7 +47,7 @@ module SystemConfig
|
||||
out.puts "Host glibc: #{host_glibc_version}"
|
||||
out.puts "/usr/bin/gcc: #{host_gcc_version}"
|
||||
out.puts "/usr/bin/ruby: #{host_ruby_version}" if RUBY_PATH != HOST_RUBY_PATH
|
||||
["glibc", "gcc", "xorg"].each do |f|
|
||||
["glibc", CompilerSelector.preferred_gcc, "xorg"].each do |f|
|
||||
out.puts "#{f}: #{formula_linked_version(f)}"
|
||||
end
|
||||
end
|
||||
|
||||
@ -24,6 +24,7 @@ describe FormulaInstaller do
|
||||
|
||||
stub_formula_loader formula
|
||||
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
||||
stub_formula_loader formula("gcc@5") { url "gcc-5.0" }
|
||||
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
|
||||
allow(Formula["patchelf"]).to receive(:latest_version_installed?).and_return(true)
|
||||
|
||||
|
||||
@ -142,6 +142,7 @@ describe Formulary do
|
||||
before do
|
||||
allow(described_class).to receive(:loader_for).and_call_original
|
||||
stub_formula_loader formula("gcc") { url "gcc-1.0" }
|
||||
stub_formula_loader formula("gcc@5") { url "gcc-5.0" }
|
||||
stub_formula_loader formula("patchelf") { url "patchelf-1.0" }
|
||||
allow(Formula["patchelf"]).to receive(:latest_version_installed?).and_return(true)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user