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