Merge pull request #20120 from Homebrew/remove_alias_generic
Remove `alias generic_*` definitions in favour of using `super`
This commit is contained in:
commit
e694e76857
@ -10,7 +10,6 @@ module Homebrew
|
|||||||
def analytics_api_path
|
def analytics_api_path
|
||||||
"analytics"
|
"analytics"
|
||||||
end
|
end
|
||||||
alias generic_analytics_api_path analytics_api_path
|
|
||||||
|
|
||||||
sig { params(category: String, days: T.any(Integer, String)).returns(T::Hash[String, T.untyped]) }
|
sig { params(category: String, days: T.any(Integer, String)).returns(T::Hash[String, T.untyped]) }
|
||||||
def fetch(category, days)
|
def fetch(category, days)
|
||||||
|
|||||||
@ -142,6 +142,7 @@ module Homebrew
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
sig { returns(String) }
|
||||||
def git_tags
|
def git_tags
|
||||||
tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname")
|
tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname")
|
||||||
if tags.blank?
|
if tags.blank?
|
||||||
|
|||||||
@ -350,7 +350,6 @@ module Homebrew
|
|||||||
sudo chmod +t #{HOMEBREW_TEMP}
|
sudo chmod +t #{HOMEBREW_TEMP}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
alias generic_check_tmpdir_sticky_bit check_tmpdir_sticky_bit
|
|
||||||
|
|
||||||
def check_exist_directories
|
def check_exist_directories
|
||||||
return if HOMEBREW_PREFIX.writable?
|
return if HOMEBREW_PREFIX.writable?
|
||||||
|
|||||||
@ -54,8 +54,6 @@ module SharedEnvExtension
|
|||||||
@debug_symbols = debug_symbols
|
@debug_symbols = debug_symbols
|
||||||
reset
|
reset
|
||||||
end
|
end
|
||||||
alias generic_shared_setup_build_environment setup_build_environment
|
|
||||||
private :generic_shared_setup_build_environment
|
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def reset
|
def reset
|
||||||
|
|||||||
@ -68,7 +68,6 @@ module Stdenv
|
|||||||
gcc_formula = gcc_version_formula(cc)
|
gcc_formula = gcc_version_formula(cc)
|
||||||
append_path "PATH", gcc_formula.opt_bin.to_s
|
append_path "PATH", gcc_formula.opt_bin.to_s
|
||||||
end
|
end
|
||||||
alias generic_setup_build_environment setup_build_environment
|
|
||||||
|
|
||||||
sig { returns(T.nilable(PATH)) }
|
sig { returns(T.nilable(PATH)) }
|
||||||
def determine_pkg_config_libdir
|
def determine_pkg_config_libdir
|
||||||
|
|||||||
@ -125,7 +125,6 @@ module Superenv
|
|||||||
# These flags will also be present:
|
# These flags will also be present:
|
||||||
# a - apply fix for apr-1-config path
|
# a - apply fix for apr-1-config path
|
||||||
end
|
end
|
||||||
alias generic_setup_build_environment setup_build_environment
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
@ -152,7 +151,6 @@ module Superenv
|
|||||||
.reverse
|
.reverse
|
||||||
.map { |d| d.opt_libexec/"bin" }
|
.map { |d| d.opt_libexec/"bin" }
|
||||||
end
|
end
|
||||||
alias generic_homebrew_extra_paths homebrew_extra_paths
|
|
||||||
|
|
||||||
sig { returns(T.nilable(PATH)) }
|
sig { returns(T.nilable(PATH)) }
|
||||||
def determine_path
|
def determine_path
|
||||||
@ -372,8 +370,8 @@ module Superenv
|
|||||||
append_to_cccfg "O"
|
append_to_cccfg "O"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is an exception where we want to use this method name format.
|
||||||
# rubocop: disable Naming/MethodName
|
# rubocop: disable Naming/MethodName
|
||||||
# Fixes style error `Naming/MethodName: Use snake_case for method names.`
|
|
||||||
sig { params(block: T.nilable(T.proc.void)).void }
|
sig { params(block: T.nilable(T.proc.void)).void }
|
||||||
def O0(&block)
|
def O0(&block)
|
||||||
if block
|
if block
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Homebrew
|
module OS
|
||||||
|
module Linux
|
||||||
module DevCmd
|
module DevCmd
|
||||||
class UpdateTest < AbstractCommand
|
module UpdateTest
|
||||||
alias generic_git_tags git_tags
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def git_tags
|
def git_tags
|
||||||
tags = generic_git_tags
|
super.presence || Utils.popen_read("git tag --list | sort -rV")
|
||||||
tags = Utils.popen_read("git tag --list | sort -rV") if tags.blank?
|
end
|
||||||
tags
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew::DevCmd::UpdateTest.prepend(OS::Linux::DevCmd::UpdateTest)
|
||||||
|
|||||||
@ -62,7 +62,7 @@ module OS
|
|||||||
def build_system_info
|
def build_system_info
|
||||||
super.merge({
|
super.merge({
|
||||||
"glibc_version" => OS::Linux::Glibc.version.to_s.presence,
|
"glibc_version" => OS::Linux::Glibc.version.to_s.presence,
|
||||||
"oldest_cpu_family" => Hardware.oldest_cpu.to_s,
|
"oldest_cpu_family" => ::Hardware.oldest_cpu.to_s,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -32,7 +32,7 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_tmpdir_sticky_bit
|
def check_tmpdir_sticky_bit
|
||||||
message = generic_check_tmpdir_sticky_bit
|
message = super
|
||||||
return if message.nil?
|
return if message.nil?
|
||||||
|
|
||||||
message + <<~EOS
|
message + <<~EOS
|
||||||
@ -74,11 +74,11 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_supported_architecture
|
def check_supported_architecture
|
||||||
return if Hardware::CPU.intel?
|
return if ::Hardware::CPU.intel?
|
||||||
return if Homebrew::EnvConfig.developer? && ENV["HOMEBREW_ARM64_TESTING"].present? && Hardware::CPU.arm?
|
return if Homebrew::EnvConfig.developer? && ENV["HOMEBREW_ARM64_TESTING"].present? && ::Hardware::CPU.arm?
|
||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Your CPU architecture (#{Hardware::CPU.arch}) is not supported. We only support
|
Your CPU architecture (#{::Hardware::CPU.arch}) is not supported. We only support
|
||||||
x86_64 CPU architectures. You will be unable to use binary packages (bottles).
|
x86_64 CPU architectures. You will be unable to use binary packages (bottles).
|
||||||
|
|
||||||
#{support_tier_message(tier: 2)}
|
#{support_tier_message(tier: 2)}
|
||||||
|
|||||||
@ -1,16 +1,22 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module SharedEnvExtension
|
module OS
|
||||||
|
module Linux
|
||||||
|
module SharedEnvExtension
|
||||||
def effective_arch
|
def effective_arch
|
||||||
if @build_bottle && @bottle_arch
|
if @build_bottle && @bottle_arch
|
||||||
@bottle_arch.to_sym
|
@bottle_arch.to_sym
|
||||||
elsif @build_bottle
|
elsif @build_bottle
|
||||||
Hardware.oldest_cpu
|
::Hardware.oldest_cpu
|
||||||
elsif Hardware::CPU.intel? || Hardware::CPU.arm?
|
elsif ::Hardware::CPU.intel? || ::Hardware::CPU.arm?
|
||||||
:native
|
:native
|
||||||
else
|
else
|
||||||
:dunno
|
:dunno
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SharedEnvExtension.prepend(OS::Linux::SharedEnvExtension)
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Stdenv
|
module OS
|
||||||
|
module Linux
|
||||||
|
module Stdenv
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { ::SharedEnvExtension }
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
formula: T.nilable(Formula),
|
formula: T.nilable(::Formula),
|
||||||
cc: T.nilable(String),
|
cc: T.nilable(String),
|
||||||
build_bottle: T.nilable(T::Boolean),
|
build_bottle: T.nilable(T::Boolean),
|
||||||
bottle_arch: T.nilable(String),
|
bottle_arch: T.nilable(String),
|
||||||
@ -12,10 +18,9 @@ module Stdenv
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
|
||||||
debug_symbols: false)
|
testing_formula: false, debug_symbols: false)
|
||||||
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
super
|
||||||
testing_formula:, debug_symbols:)
|
|
||||||
|
|
||||||
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
prepend_path "CPATH", HOMEBREW_PREFIX/"include"
|
||||||
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
prepend_path "LIBRARY_PATH", HOMEBREW_PREFIX/"lib"
|
||||||
@ -29,8 +34,12 @@ module Stdenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def libxml2
|
def libxml2
|
||||||
append "CPPFLAGS", "-I#{Formula["libxml2"].include/"libxml2"}"
|
append "CPPFLAGS", "-I#{::Formula["libxml2"].include/"libxml2"}"
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Stdenv.prepend(OS::Linux::Stdenv)
|
||||||
|
|||||||
@ -1,16 +1,25 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Superenv
|
module OS
|
||||||
|
module Linux
|
||||||
|
module Superenv
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { SharedEnvExtension }
|
||||||
|
requires_ancestor { ::Superenv }
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
sig { returns(Pathname) }
|
sig { returns(Pathname) }
|
||||||
def self.shims_path
|
def shims_path
|
||||||
HOMEBREW_SHIMS_PATH/"linux/super"
|
HOMEBREW_SHIMS_PATH/"linux/super"
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T.nilable(Pathname)) }
|
sig { returns(T.nilable(Pathname)) }
|
||||||
def self.bin
|
def bin
|
||||||
shims_path.realpath
|
shims_path.realpath
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
@ -22,10 +31,10 @@ module Superenv
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
|
||||||
debug_symbols: false)
|
testing_formula: false, debug_symbols: false)
|
||||||
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
super
|
||||||
testing_formula:, debug_symbols:)
|
|
||||||
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
self["HOMEBREW_OPTIMIZATION_LEVEL"] = "O2"
|
||||||
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
||||||
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(@formula)
|
||||||
@ -35,11 +44,11 @@ module Superenv
|
|||||||
# Pointer authentication and BTI are hardening techniques most distros
|
# Pointer authentication and BTI are hardening techniques most distros
|
||||||
# use by default on their packages. arm64 Linux we're packaging
|
# use by default on their packages. arm64 Linux we're packaging
|
||||||
# everything from scratch so the entire dependency tree can have it.
|
# everything from scratch so the entire dependency tree can have it.
|
||||||
append_to_cccfg "b" if Hardware::CPU.arch == :arm64 && DevelopmentTools.gcc_version("gcc") >= 9
|
append_to_cccfg "b" if ::Hardware::CPU.arch == :arm64 && ::DevelopmentTools.gcc_version("gcc") >= 9
|
||||||
end
|
end
|
||||||
|
|
||||||
def homebrew_extra_paths
|
def homebrew_extra_paths
|
||||||
paths = generic_homebrew_extra_paths
|
paths = super
|
||||||
paths += %w[binutils make].filter_map do |f|
|
paths += %w[binutils make].filter_map do |f|
|
||||||
bin = Formulary.factory(f).opt_bin
|
bin = Formulary.factory(f).opt_bin
|
||||||
bin if bin.directory?
|
bin if bin.directory?
|
||||||
@ -76,4 +85,9 @@ module Superenv
|
|||||||
|
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Superenv.singleton_class.prepend(OS::Linux::Superenv::ClassMethods)
|
||||||
|
Superenv.prepend(OS::Linux::Superenv)
|
||||||
|
|||||||
@ -1,9 +1,15 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module FormulaCellarChecks
|
module OS
|
||||||
|
module Linux
|
||||||
|
module FormulaCellarChecks
|
||||||
sig { params(filename: Pathname).returns(T::Boolean) }
|
sig { params(filename: Pathname).returns(T::Boolean) }
|
||||||
def valid_library_extension?(filename)
|
def valid_library_extension?(filename)
|
||||||
generic_valid_library_extension?(filename) || filename.basename.to_s.include?(".so.")
|
super || filename.basename.to_s.include?(".so.")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
FormulaCellarChecks.prepend(OS::Linux::FormulaCellarChecks)
|
||||||
|
|||||||
@ -1,12 +1,18 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Hardware
|
module OS
|
||||||
class CPU
|
module Linux
|
||||||
class << self
|
module Hardware
|
||||||
|
module CPU
|
||||||
|
module ClassMethods
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { T.class_of(::Hardware::CPU) }
|
||||||
|
|
||||||
def optimization_flags
|
def optimization_flags
|
||||||
@optimization_flags ||= begin
|
@optimization_flags ||= begin
|
||||||
flags = generic_optimization_flags.dup
|
flags = super.dup
|
||||||
flags[:native] = arch_flag(Homebrew::EnvConfig.arch)
|
flags[:native] = arch_flag(Homebrew::EnvConfig.arch)
|
||||||
flags
|
flags
|
||||||
end
|
end
|
||||||
@ -138,7 +144,7 @@ module Hardware
|
|||||||
|
|
||||||
%w[aes altivec avx avx2 lm ssse3 sse4_2].each do |flag|
|
%w[aes altivec avx avx2 lm ssse3 sse4_2].each do |flag|
|
||||||
define_method(:"#{flag}?") do
|
define_method(:"#{flag}?") do
|
||||||
T.bind(self, T.class_of(Hardware::CPU))
|
T.bind(self, OS::Linux::Hardware::CPU::ClassMethods)
|
||||||
flags.include? flag
|
flags.include? flag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -158,4 +164,8 @@ module Hardware
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Hardware::CPU.singleton_class.prepend(OS::Linux::Hardware::CPU::ClassMethods)
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: true # rubocop:todo Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Homebrew
|
module OS
|
||||||
|
module Linux
|
||||||
module Install
|
module Install
|
||||||
|
module ClassMethods
|
||||||
# This is a list of known paths to the host dynamic linker on Linux if
|
# This is a list of known paths to the host dynamic linker on Linux if
|
||||||
# the host glibc is new enough. The symlink_ld_so method will fail if
|
# the host glibc is new enough. The symlink_ld_so method will fail if
|
||||||
# the host linker cannot be found in this list.
|
# the host linker cannot be found in this list.
|
||||||
@ -16,7 +18,6 @@ module Homebrew
|
|||||||
/system/bin/linker64
|
/system/bin/linker64
|
||||||
/system/bin/linker
|
/system/bin/linker
|
||||||
].freeze
|
].freeze
|
||||||
private_constant :DYNAMIC_LINKERS
|
|
||||||
|
|
||||||
# We link GCC runtime libraries that are not specifically used for Fortran,
|
# We link GCC runtime libraries that are not specifically used for Fortran,
|
||||||
# which are linked by the GCC formula. We only use the versioned shared libraries
|
# which are linked by the GCC formula. We only use the versioned shared libraries
|
||||||
@ -28,44 +29,41 @@ module Homebrew
|
|||||||
libgomp.so.1
|
libgomp.so.1
|
||||||
libstdc++.so.6
|
libstdc++.so.6
|
||||||
].freeze
|
].freeze
|
||||||
private_constant :GCC_RUNTIME_LIBS
|
|
||||||
|
|
||||||
def self.perform_preinstall_checks(all_fatal: false)
|
def perform_preinstall_checks(all_fatal: false)
|
||||||
generic_perform_preinstall_checks(all_fatal:)
|
super
|
||||||
symlink_ld_so
|
|
||||||
setup_preferred_gcc_libs
|
|
||||||
end
|
|
||||||
private_class_method :perform_preinstall_checks
|
|
||||||
|
|
||||||
def self.global_post_install
|
|
||||||
generic_global_post_install
|
|
||||||
symlink_ld_so
|
symlink_ld_so
|
||||||
setup_preferred_gcc_libs
|
setup_preferred_gcc_libs
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.check_cpu
|
def global_post_install
|
||||||
return if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
|
super
|
||||||
return if Hardware::CPU.arm?
|
symlink_ld_so
|
||||||
|
setup_preferred_gcc_libs
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_cpu
|
||||||
|
return if ::Hardware::CPU.intel? && ::Hardware::CPU.is_64_bit?
|
||||||
|
return if ::Hardware::CPU.arm?
|
||||||
|
|
||||||
message = "Sorry, Homebrew does not support your computer's CPU architecture!"
|
message = "Sorry, Homebrew does not support your computer's CPU architecture!"
|
||||||
if Hardware::CPU.ppc64le?
|
if ::Hardware::CPU.ppc64le?
|
||||||
message += <<~EOS
|
message += <<~EOS
|
||||||
For OpenPOWER Linux (PPC64LE) support, see:
|
For OpenPOWER Linux (PPC64LE) support, see:
|
||||||
#{Formatter.url("https://github.com/homebrew-ppc64le/brew")}
|
#{Formatter.url("https://github.com/homebrew-ppc64le/brew")}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
abort message
|
::Kernel.abort message
|
||||||
end
|
end
|
||||||
private_class_method :check_cpu
|
|
||||||
|
|
||||||
def self.symlink_ld_so
|
def symlink_ld_so
|
||||||
brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
|
brew_ld_so = HOMEBREW_PREFIX/"lib/ld.so"
|
||||||
|
|
||||||
ld_so = HOMEBREW_PREFIX/"opt/glibc/bin/ld.so"
|
ld_so = HOMEBREW_PREFIX/"opt/glibc/bin/ld.so"
|
||||||
unless ld_so.readable?
|
unless ld_so.readable?
|
||||||
ld_so = DYNAMIC_LINKERS.find { |s| File.executable? s }
|
ld_so = DYNAMIC_LINKERS.find { |s| File.executable? s }
|
||||||
if ld_so.blank?
|
if ld_so.blank?
|
||||||
raise "Unable to locate the system's dynamic linker" unless brew_ld_so.readable?
|
::Kernel.raise "Unable to locate the system's dynamic linker" unless brew_ld_so.readable?
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -76,9 +74,8 @@ module Homebrew
|
|||||||
FileUtils.mkdir_p HOMEBREW_PREFIX/"lib"
|
FileUtils.mkdir_p HOMEBREW_PREFIX/"lib"
|
||||||
FileUtils.ln_sf ld_so, brew_ld_so
|
FileUtils.ln_sf ld_so, brew_ld_so
|
||||||
end
|
end
|
||||||
private_class_method :symlink_ld_so
|
|
||||||
|
|
||||||
def self.setup_preferred_gcc_libs
|
def setup_preferred_gcc_libs
|
||||||
gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA}"
|
gcc_opt_prefix = HOMEBREW_PREFIX/"opt/#{OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA}"
|
||||||
glibc_installed = (HOMEBREW_PREFIX/"opt/glibc/bin/ld.so").readable?
|
glibc_installed = (HOMEBREW_PREFIX/"opt/glibc/bin/ld.so").readable?
|
||||||
|
|
||||||
@ -103,10 +100,10 @@ module Homebrew
|
|||||||
FileUtils.chmod "u=rw,go-wx", ld_gcc_conf
|
FileUtils.chmod "u=rw,go-wx", ld_gcc_conf
|
||||||
|
|
||||||
FileUtils.rm_f HOMEBREW_PREFIX/"etc/ld.so.cache"
|
FileUtils.rm_f HOMEBREW_PREFIX/"etc/ld.so.cache"
|
||||||
system HOMEBREW_PREFIX/"opt/glibc/sbin/ldconfig"
|
::Kernel.system HOMEBREW_PREFIX/"opt/glibc/sbin/ldconfig"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
odie "#{HOMEBREW_PREFIX}/lib does not exist!" unless (HOMEBREW_PREFIX/"lib").readable?
|
::Kernel.odie "#{HOMEBREW_PREFIX}/lib does not exist!" unless (HOMEBREW_PREFIX/"lib").readable?
|
||||||
end
|
end
|
||||||
|
|
||||||
GCC_RUNTIME_LIBS.each do |library|
|
GCC_RUNTIME_LIBS.each do |library|
|
||||||
@ -127,6 +124,9 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
private_class_method :setup_preferred_gcc_libs
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew::Install.singleton_class.prepend(OS::Linux::Install::ClassMethods)
|
||||||
|
|||||||
@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
require "compilers"
|
require "compilers"
|
||||||
|
|
||||||
class LinkageChecker
|
module OS
|
||||||
|
module Linux
|
||||||
|
module LinkageChecker
|
||||||
# Libraries provided by glibc and gcc.
|
# Libraries provided by glibc and gcc.
|
||||||
SYSTEM_LIBRARY_ALLOWLIST = %w[
|
SYSTEM_LIBRARY_ALLOWLIST = %w[
|
||||||
ld-linux-x86-64.so.2
|
ld-linux-x86-64.so.2
|
||||||
@ -29,7 +31,7 @@ class LinkageChecker
|
|||||||
private
|
private
|
||||||
|
|
||||||
def check_dylibs(rebuild_cache:)
|
def check_dylibs(rebuild_cache:)
|
||||||
generic_check_dylibs(rebuild_cache:)
|
super
|
||||||
|
|
||||||
# glibc and gcc are implicit dependencies.
|
# glibc and gcc are implicit dependencies.
|
||||||
# No other linkage to system libraries is expected or desired.
|
# No other linkage to system libraries is expected or desired.
|
||||||
@ -39,7 +41,8 @@ class LinkageChecker
|
|||||||
|
|
||||||
# We build all formulae with an RPATH that includes the gcc formula's runtime lib directory.
|
# We build all formulae with an RPATH that includes the gcc formula's runtime lib directory.
|
||||||
# See: https://github.com/Homebrew/brew/blob/e689cc07/Library/Homebrew/extend/os/linux/extend/ENV/super.rb#L53
|
# See: https://github.com/Homebrew/brew/blob/e689cc07/Library/Homebrew/extend/os/linux/extend/ENV/super.rb#L53
|
||||||
# This results in formulae showing linkage with gcc whenever it is installed, even if no dependency is declared.
|
# This results in formulae showing linkage with gcc whenever it is installed, even if no dependency is
|
||||||
|
# declared.
|
||||||
# See discussions at:
|
# See discussions at:
|
||||||
# https://github.com/Homebrew/brew/pull/13659
|
# https://github.com/Homebrew/brew/pull/13659
|
||||||
# https://github.com/Homebrew/brew/pull/13796
|
# https://github.com/Homebrew/brew/pull/13796
|
||||||
@ -47,4 +50,8 @@ class LinkageChecker
|
|||||||
@undeclared_deps.delete("gcc")
|
@undeclared_deps.delete("gcc")
|
||||||
@indirect_deps.delete("gcc")
|
@indirect_deps.delete("gcc")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
LinkageChecker.prepend(OS::Linux::LinkageChecker)
|
||||||
|
|||||||
@ -5,12 +5,14 @@ require "compilers"
|
|||||||
require "os/linux/glibc"
|
require "os/linux/glibc"
|
||||||
require "system_command"
|
require "system_command"
|
||||||
|
|
||||||
module SystemConfig
|
module OS
|
||||||
|
module Linux
|
||||||
|
module SystemConfig
|
||||||
|
module ClassMethods
|
||||||
include SystemCommand::Mixin
|
include SystemCommand::Mixin
|
||||||
|
|
||||||
HOST_RUBY_PATH = "/usr/bin/ruby"
|
HOST_RUBY_PATH = "/usr/bin/ruby"
|
||||||
|
|
||||||
class << self
|
|
||||||
def host_glibc_version
|
def host_glibc_version
|
||||||
version = OS::Linux::Glibc.system_version
|
version = OS::Linux::Glibc.system_version
|
||||||
return "N/A" if version.null?
|
return "N/A" if version.null?
|
||||||
@ -19,10 +21,10 @@ module SystemConfig
|
|||||||
end
|
end
|
||||||
|
|
||||||
def host_gcc_version
|
def host_gcc_version
|
||||||
gcc = DevelopmentTools.host_gcc_path
|
gcc = ::DevelopmentTools.host_gcc_path
|
||||||
return "N/A" unless gcc.executable?
|
return "N/A" unless gcc.executable?
|
||||||
|
|
||||||
`#{gcc} --version 2>/dev/null`[/ (\d+\.\d+\.\d+)/, 1]
|
Utils.popen_read(gcc, "--version")[/ (\d+\.\d+\.\d+)/, 1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def formula_linked_version(formula)
|
def formula_linked_version(formula)
|
||||||
@ -42,16 +44,20 @@ module SystemConfig
|
|||||||
|
|
||||||
def dump_verbose_config(out = $stdout)
|
def dump_verbose_config(out = $stdout)
|
||||||
kernel = Utils.safe_popen_read("uname", "-mors").chomp
|
kernel = Utils.safe_popen_read("uname", "-mors").chomp
|
||||||
dump_generic_verbose_config(out)
|
super
|
||||||
out.puts "Kernel: #{kernel}"
|
out.puts "Kernel: #{kernel}"
|
||||||
out.puts "OS: #{OS::Linux.os_version}"
|
out.puts "OS: #{OS::Linux.os_version}"
|
||||||
out.puts "WSL: #{OS::Linux.wsl_version}" if OS::Linux.wsl?
|
out.puts "WSL: #{OS::Linux.wsl_version}" if OS::Linux.wsl?
|
||||||
out.puts "Host glibc: #{host_glibc_version}"
|
out.puts "Host glibc: #{host_glibc_version}"
|
||||||
out.puts "#{DevelopmentTools.host_gcc_path}: #{host_gcc_version}"
|
out.puts "#{::DevelopmentTools.host_gcc_path}: #{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", CompilerSelector.preferred_gcc, OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA, "xorg"].each do |f|
|
["glibc", CompilerSelector.preferred_gcc, OS::LINUX_PREFERRED_GCC_RUNTIME_FORMULA, "xorg"].each do |f|
|
||||||
out.puts "#{f}: #{formula_linked_version(f)}"
|
out.puts "#{f}: #{formula_linked_version(f)}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SystemConfig.singleton_class.prepend(OS::Linux::SystemConfig::ClassMethods)
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module SharedEnvExtension
|
module OS
|
||||||
|
module Mac
|
||||||
|
module SharedEnvExtension
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { ::SharedEnvExtension }
|
||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
formula: T.nilable(Formula),
|
formula: T.nilable(::Formula),
|
||||||
cc: T.nilable(String),
|
cc: T.nilable(String),
|
||||||
build_bottle: T.nilable(T::Boolean),
|
build_bottle: T.nilable(T::Boolean),
|
||||||
bottle_arch: T.nilable(String),
|
bottle_arch: T.nilable(String),
|
||||||
@ -12,11 +18,9 @@ module SharedEnvExtension
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
|
||||||
debug_symbols: false)
|
testing_formula: false, debug_symbols: false)
|
||||||
generic_shared_setup_build_environment(formula:, cc:, build_bottle:,
|
super
|
||||||
bottle_arch:, testing_formula:,
|
|
||||||
debug_symbols:)
|
|
||||||
|
|
||||||
# Normalise the system Perl version used, where multiple may be available
|
# Normalise the system Perl version used, where multiple may be available
|
||||||
self["VERSIONER_PERL_VERSION"] = MacOS.preferred_perl_version
|
self["VERSIONER_PERL_VERSION"] = MacOS.preferred_perl_version
|
||||||
@ -39,4 +43,8 @@ module SharedEnvExtension
|
|||||||
# https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2
|
# https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2
|
||||||
OS::Mac::DevelopmentTools.ld64_version >= 711
|
OS::Mac::DevelopmentTools.ld64_version >= 711
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
SharedEnvExtension.prepend(OS::Mac::SharedEnvExtension)
|
||||||
|
|||||||
@ -1,8 +1,13 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: true # rubocop:disable Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Stdenv
|
module OS
|
||||||
undef homebrew_extra_pkg_config_paths
|
module Mac
|
||||||
|
module Stdenv
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { SharedEnvExtension }
|
||||||
|
requires_ancestor { ::Stdenv }
|
||||||
|
|
||||||
sig { returns(T::Array[Pathname]) }
|
sig { returns(T::Array[Pathname]) }
|
||||||
def homebrew_extra_pkg_config_paths
|
def homebrew_extra_pkg_config_paths
|
||||||
@ -20,10 +25,9 @@ module Stdenv
|
|||||||
debug_symbols: T.nilable(T::Boolean),
|
debug_symbols: T.nilable(T::Boolean),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
|
||||||
debug_symbols: false)
|
testing_formula: false, debug_symbols: false)
|
||||||
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
super
|
||||||
testing_formula:, debug_symbols:)
|
|
||||||
|
|
||||||
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
|
append "LDFLAGS", "-Wl,-headerpad_max_install_names"
|
||||||
|
|
||||||
@ -114,4 +118,8 @@ module Stdenv
|
|||||||
def no_fixup_chains
|
def no_fixup_chains
|
||||||
append "LDFLAGS", "-Wl,-no_fixup_chains" if no_fixup_chains_support?
|
append "LDFLAGS", "-Wl,-no_fixup_chains" if no_fixup_chains_support?
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Stdenv.prepend(OS::Mac::Stdenv)
|
||||||
|
|||||||
@ -1,34 +1,32 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: true # rubocop:disable Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Superenv
|
module OS
|
||||||
class << self
|
module Mac
|
||||||
# The location of Homebrew's shims on macOS.
|
module Superenv
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { SharedEnvExtension }
|
||||||
|
requires_ancestor { ::Superenv }
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
|
sig { returns(Pathname) }
|
||||||
def shims_path
|
def shims_path
|
||||||
HOMEBREW_SHIMS_PATH/"mac/super"
|
HOMEBREW_SHIMS_PATH/"mac/super"
|
||||||
end
|
end
|
||||||
|
|
||||||
undef bin
|
sig { returns(T.nilable(Pathname)) }
|
||||||
|
|
||||||
def bin
|
def bin
|
||||||
return unless DevelopmentTools.installed?
|
return unless ::DevelopmentTools.installed?
|
||||||
|
|
||||||
shims_path.realpath
|
shims_path.realpath
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
undef homebrew_extra_pkg_config_paths,
|
|
||||||
homebrew_extra_isystem_paths, homebrew_extra_library_paths,
|
|
||||||
homebrew_extra_cmake_include_paths,
|
|
||||||
homebrew_extra_cmake_library_paths,
|
|
||||||
homebrew_extra_cmake_frameworks_paths,
|
|
||||||
determine_cccfg
|
|
||||||
|
|
||||||
sig { returns(T::Array[Pathname]) }
|
sig { returns(T::Array[Pathname]) }
|
||||||
def homebrew_extra_pkg_config_paths
|
def homebrew_extra_pkg_config_paths
|
||||||
[Pathname("/usr/lib/pkgconfig"), Pathname("#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}")]
|
[Pathname("/usr/lib/pkgconfig"), Pathname("#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}")]
|
||||||
end
|
end
|
||||||
private :homebrew_extra_pkg_config_paths
|
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def libxml2_include_needed?
|
def libxml2_include_needed?
|
||||||
@ -37,7 +35,6 @@ module Superenv
|
|||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
private :libxml2_include_needed?
|
|
||||||
|
|
||||||
def homebrew_extra_isystem_paths
|
def homebrew_extra_isystem_paths
|
||||||
paths = []
|
paths = []
|
||||||
@ -51,7 +48,7 @@ module Superenv
|
|||||||
paths = []
|
paths = []
|
||||||
if compiler == :llvm_clang
|
if compiler == :llvm_clang
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/lib"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/usr/lib"
|
||||||
paths << Formula["llvm"].opt_lib.to_s
|
paths << ::Formula["llvm"].opt_lib.to_s
|
||||||
end
|
end
|
||||||
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
paths << "#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
||||||
paths
|
paths
|
||||||
@ -66,7 +63,8 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def homebrew_extra_cmake_library_paths
|
def homebrew_extra_cmake_library_paths
|
||||||
[Pathname("#{self["HOMEBREW_SDKROOT"]}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries")]
|
brew_sdkroot = self["HOMEBREW_SDKROOT"]
|
||||||
|
[Pathname("#{brew_sdkroot}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries")]
|
||||||
end
|
end
|
||||||
|
|
||||||
def homebrew_extra_cmake_frameworks_paths
|
def homebrew_extra_cmake_frameworks_paths
|
||||||
@ -83,8 +81,8 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil, testing_formula: false,
|
def setup_build_environment(formula: nil, cc: nil, build_bottle: false, bottle_arch: nil,
|
||||||
debug_symbols: false)
|
testing_formula: false, debug_symbols: false)
|
||||||
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
|
sdk = formula ? MacOS.sdk_for_formula(formula) : MacOS.sdk
|
||||||
is_xcode_sdk = sdk&.source == :xcode
|
is_xcode_sdk = sdk&.source == :xcode
|
||||||
|
|
||||||
@ -105,12 +103,11 @@ module Superenv
|
|||||||
if deps.none? { |d| d.name == "m4" } &&
|
if deps.none? { |d| d.name == "m4" } &&
|
||||||
MacOS.active_developer_dir == MacOS::CLT::PKG_PATH &&
|
MacOS.active_developer_dir == MacOS::CLT::PKG_PATH &&
|
||||||
!File.exist?("#{MacOS::CLT::PKG_PATH}/usr/bin/m4") &&
|
!File.exist?("#{MacOS::CLT::PKG_PATH}/usr/bin/m4") &&
|
||||||
(gm4 = DevelopmentTools.locate("gm4").to_s).present?
|
(gm4 = ::DevelopmentTools.locate("gm4").to_s).present?
|
||||||
self["M4"] = gm4
|
self["M4"] = gm4
|
||||||
end
|
end
|
||||||
|
|
||||||
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
super
|
||||||
testing_formula:, debug_symbols:)
|
|
||||||
|
|
||||||
# Filter out symbols known not to be defined since GNU Autotools can't
|
# Filter out symbols known not to be defined since GNU Autotools can't
|
||||||
# reliably figure this out with Xcode 8 and above.
|
# reliably figure this out with Xcode 8 and above.
|
||||||
@ -168,4 +165,9 @@ module Superenv
|
|||||||
def no_fixup_chains
|
def no_fixup_chains
|
||||||
append_to_cccfg "f" if no_fixup_chains_support?
|
append_to_cccfg "f" if no_fixup_chains_support?
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Superenv.singleton_class.prepend(OS::Mac::Superenv::ClassMethods)
|
||||||
|
Superenv.prepend(OS::Mac::Superenv)
|
||||||
|
|||||||
@ -4,7 +4,14 @@
|
|||||||
require "cache_store"
|
require "cache_store"
|
||||||
require "linkage_checker"
|
require "linkage_checker"
|
||||||
|
|
||||||
module FormulaCellarChecks
|
module OS
|
||||||
|
module Mac
|
||||||
|
module FormulaCellarChecks
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { Homebrew::FormulaAuditor }
|
||||||
|
requires_ancestor { ::FormulaCellarChecks }
|
||||||
|
|
||||||
sig { returns(T.nilable(String)) }
|
sig { returns(T.nilable(String)) }
|
||||||
def check_shadowed_headers
|
def check_shadowed_headers
|
||||||
return if ["libtool", "subversion", "berkeley-db"].any? do |formula_name|
|
return if ["libtool", "subversion", "berkeley-db"].any? do |formula_name|
|
||||||
@ -31,7 +38,7 @@ module FormulaCellarChecks
|
|||||||
def check_openssl_links
|
def check_openssl_links
|
||||||
return unless formula.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = ::Keg.new(formula.prefix)
|
||||||
system_openssl = keg.mach_o_files.select do |obj|
|
system_openssl = keg.mach_o_files.select do |obj|
|
||||||
dlls = obj.dynamically_linked_libraries
|
dlls = obj.dynamically_linked_libraries
|
||||||
dlls.any? { |dll| %r{/usr/lib/lib(crypto|ssl|tls)\..*dylib}.match? dll }
|
dlls.any? { |dll| %r{/usr/lib/lib(crypto|ssl|tls)\..*dylib}.match? dll }
|
||||||
@ -69,10 +76,10 @@ module FormulaCellarChecks
|
|||||||
def check_linkage
|
def check_linkage
|
||||||
return unless formula.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = ::Keg.new(formula.prefix)
|
||||||
|
|
||||||
CacheStoreDatabase.use(:linkage) do |db|
|
CacheStoreDatabase.use(:linkage) do |db|
|
||||||
checker = LinkageChecker.new(keg, formula, cache_db: db)
|
checker = ::LinkageChecker.new(keg, formula, cache_db: db)
|
||||||
next unless checker.broken_library_linkage?
|
next unless checker.broken_library_linkage?
|
||||||
|
|
||||||
output = <<~EOS
|
output = <<~EOS
|
||||||
@ -85,14 +92,14 @@ module FormulaCellarChecks
|
|||||||
output += <<~EOS
|
output += <<~EOS
|
||||||
Rebuild this from source with:
|
Rebuild this from source with:
|
||||||
brew reinstall --build-from-source #{formula}
|
brew reinstall --build-from-source #{formula}
|
||||||
If that's successful, file an issue#{formula.tap ? " here:\n #{T.must(formula.tap).issues_url}" : "."}
|
If that's successful, file an issue#{formula.tap ? " here:\n #{formula.tap.issues_url}" : "."}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
problem_if_output output
|
problem_if_output output
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(formula: Formula).returns(T.nilable(String)) }
|
sig { params(formula: ::Formula).returns(T.nilable(String)) }
|
||||||
def check_flat_namespace(formula)
|
def check_flat_namespace(formula)
|
||||||
return unless formula.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
return if formula.tap&.audit_exception(:flat_namespace_allowlist, formula.name)
|
return if formula.tap&.audit_exception(:flat_namespace_allowlist, formula.name)
|
||||||
@ -120,7 +127,7 @@ module FormulaCellarChecks
|
|||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def audit_installed
|
def audit_installed
|
||||||
generic_audit_installed
|
super
|
||||||
problem_if_output(check_shadowed_headers)
|
problem_if_output(check_shadowed_headers)
|
||||||
problem_if_output(check_openssl_links)
|
problem_if_output(check_openssl_links)
|
||||||
problem_if_output(check_python_framework_links(formula.lib))
|
problem_if_output(check_python_framework_links(formula.lib))
|
||||||
@ -128,9 +135,14 @@ module FormulaCellarChecks
|
|||||||
problem_if_output(check_flat_namespace(formula))
|
problem_if_output(check_flat_namespace(formula))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
MACOS_LIB_EXTENSIONS = %w[.dylib .framework].freeze
|
||||||
|
|
||||||
sig { params(filename: Pathname).returns(T::Boolean) }
|
sig { params(filename: Pathname).returns(T::Boolean) }
|
||||||
def valid_library_extension?(filename)
|
def valid_library_extension?(filename)
|
||||||
macos_lib_extensions = %w[.dylib .framework]
|
super || MACOS_LIB_EXTENSIONS.include?(filename.extname)
|
||||||
generic_valid_library_extension?(filename) || macos_lib_extensions.include?(filename.extname)
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
FormulaCellarChecks.prepend(OS::Mac::FormulaCellarChecks)
|
||||||
|
|||||||
@ -1,15 +1,18 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Hardware
|
module OS
|
||||||
sig { params(version: T.nilable(Version)).returns(Symbol) }
|
module Mac
|
||||||
def self.oldest_cpu(version = nil)
|
module Hardware
|
||||||
|
module ClassMethods
|
||||||
|
sig { params(version: T.nilable(MacOSVersion)).returns(Symbol) }
|
||||||
|
def oldest_cpu(version = nil)
|
||||||
version = if version
|
version = if version
|
||||||
MacOSVersion.new(version.to_s)
|
MacOSVersion.new(version.to_s)
|
||||||
else
|
else
|
||||||
MacOS.version
|
MacOS.version
|
||||||
end
|
end
|
||||||
if CPU.arch == :arm64
|
if ::Hardware::CPU.arch == :arm64
|
||||||
:arm_vortex_tempest
|
:arm_vortex_tempest
|
||||||
# This cannot use a newer CPU e.g. haswell because Rosetta 2 does not
|
# This cannot use a newer CPU e.g. haswell because Rosetta 2 does not
|
||||||
# support AVX instructions in bottles:
|
# support AVX instructions in bottles:
|
||||||
@ -19,7 +22,12 @@ module Hardware
|
|||||||
elsif version >= :mojave
|
elsif version >= :mojave
|
||||||
:nehalem
|
:nehalem
|
||||||
else
|
else
|
||||||
generic_oldest_cpu
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Hardware.singleton_class.prepend(OS::Mac::Hardware::ClassMethods)
|
||||||
|
|||||||
@ -95,7 +95,7 @@ module OS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
generic_fix_dynamic_linkage
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def loader_name_for(file, target)
|
def loader_name_for(file, target)
|
||||||
@ -199,7 +199,7 @@ module OS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prepare_relocation_to_locations
|
def prepare_relocation_to_locations
|
||||||
relocation = generic_prepare_relocation_to_locations
|
relocation = super
|
||||||
|
|
||||||
brewed_perl = runtime_dependencies&.any? { |dep| dep["full_name"] == "perl" && dep["declared_directly"] }
|
brewed_perl = runtime_dependencies&.any? { |dep| dep["full_name"] == "perl" && dep["declared_directly"] }
|
||||||
perl_path = if brewed_perl || name == "perl"
|
perl_path = if brewed_perl || name == "perl"
|
||||||
|
|||||||
@ -5,9 +5,10 @@ require "cask/info"
|
|||||||
require "cask/cask_loader"
|
require "cask/cask_loader"
|
||||||
require "cask/caskroom"
|
require "cask/caskroom"
|
||||||
|
|
||||||
module Homebrew
|
module OS
|
||||||
|
module Mac
|
||||||
module MissingFormula
|
module MissingFormula
|
||||||
class << self
|
module ClassMethods
|
||||||
sig { params(name: String).returns(T.nilable(String)) }
|
sig { params(name: String).returns(T.nilable(String)) }
|
||||||
def disallowed_reason(name)
|
def disallowed_reason(name)
|
||||||
case name.downcase
|
case name.downcase
|
||||||
@ -16,7 +17,7 @@ module Homebrew
|
|||||||
Xcode can be installed from the App Store.
|
Xcode can be installed from the App Store.
|
||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
generic_disallowed_reason(name)
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -36,24 +37,27 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
case command
|
case command
|
||||||
when "install"
|
when "install"
|
||||||
Cask::CaskLoader.load(name)
|
::Cask::CaskLoader.load(name)
|
||||||
when "uninstall"
|
when "uninstall"
|
||||||
cask = Cask::Caskroom.casks.find { |installed_cask| installed_cask.to_s == name }
|
cask = ::Cask::Caskroom.casks.find { |installed_cask| installed_cask.to_s == name }
|
||||||
raise Cask::CaskUnavailableError, name if cask.nil?
|
Kernel.raise ::Cask::CaskUnavailableError, name if cask.nil?
|
||||||
when "info"
|
when "info"
|
||||||
cask = Cask::CaskLoader.load(name)
|
cask = ::Cask::CaskLoader.load(name)
|
||||||
suggestion = <<~EOS
|
suggestion = <<~EOS
|
||||||
Found a cask named "#{name}" instead.
|
Found a cask named "#{name}" instead.
|
||||||
|
|
||||||
#{Cask::Info.get_info(cask)}
|
#{::Cask::Info.get_info(cask)}
|
||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
suggestion
|
suggestion
|
||||||
rescue Cask::CaskUnavailableError
|
rescue ::Cask::CaskUnavailableError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew::MissingFormula.singleton_class.prepend(OS::Mac::MissingFormula::ClassMethods)
|
||||||
|
|||||||
@ -6,6 +6,11 @@ require "system_command"
|
|||||||
module OS
|
module OS
|
||||||
module Mac
|
module Mac
|
||||||
module SystemConfig
|
module SystemConfig
|
||||||
|
module ClassMethods
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { T.class_of(::SystemConfig) }
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def describe_clang
|
def describe_clang
|
||||||
return "N/A" if ::SystemConfig.clang.null?
|
return "N/A" if ::SystemConfig.clang.null?
|
||||||
@ -13,15 +18,6 @@ module OS
|
|||||||
clang_build_info = ::SystemConfig.clang_build.null? ? "(parse error)" : ::SystemConfig.clang_build
|
clang_build_info = ::SystemConfig.clang_build.null? ? "(parse error)" : ::SystemConfig.clang_build
|
||||||
"#{::SystemConfig.clang} build #{clang_build_info}"
|
"#{::SystemConfig.clang} build #{clang_build_info}"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
SystemConfig.prepend(OS::Mac::SystemConfig)
|
|
||||||
|
|
||||||
module SystemConfig
|
|
||||||
class << self
|
|
||||||
include SystemCommand::Mixin
|
|
||||||
|
|
||||||
def xcode
|
def xcode
|
||||||
@xcode ||= if MacOS::Xcode.installed?
|
@xcode ||= if MacOS::Xcode.installed?
|
||||||
@ -41,11 +37,14 @@ module SystemConfig
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dump_verbose_config(out = $stdout)
|
def dump_verbose_config(out = $stdout)
|
||||||
dump_generic_verbose_config(out)
|
super
|
||||||
out.puts "macOS: #{MacOS.full_version}-#{kernel}"
|
out.puts "macOS: #{MacOS.full_version}-#{kernel}"
|
||||||
out.puts "CLT: #{clt || "N/A"}"
|
out.puts "CLT: #{clt || "N/A"}"
|
||||||
out.puts "Xcode: #{xcode || "N/A"}"
|
out.puts "Xcode: #{xcode || "N/A"}"
|
||||||
out.puts "Rosetta 2: #{Hardware::CPU.in_rosetta2?}" if Hardware::CPU.physical_cpu_arm64?
|
out.puts "Rosetta 2: #{::Hardware::CPU.in_rosetta2?}" if ::Hardware::CPU.physical_cpu_arm64?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
SystemConfig.singleton_class.prepend(OS::Mac::SystemConfig::ClassMethods)
|
||||||
|
|||||||
@ -1,37 +1,40 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Utils
|
module OS
|
||||||
|
module Mac
|
||||||
module Bottles
|
module Bottles
|
||||||
class << self
|
module ClassMethods
|
||||||
module MacOSOverride
|
sig { params(tag: T.nilable(T.any(Symbol, Utils::Bottles::Tag))).returns(Utils::Bottles::Tag) }
|
||||||
sig { params(tag: T.nilable(T.any(Symbol, Tag))).returns(Tag) }
|
|
||||||
def tag(tag = nil)
|
def tag(tag = nil)
|
||||||
return Tag.new(system: MacOS.version.to_sym, arch: Hardware::CPU.arch) if tag.nil?
|
if tag.nil?
|
||||||
|
Utils::Bottles::Tag.new(system: MacOS.version.to_sym, arch: ::Hardware::CPU.arch)
|
||||||
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
prepend MacOSOverride
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Collector
|
module Collector
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { Utils::Bottles::Collector }
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
alias generic_find_matching_tag find_matching_tag
|
sig {
|
||||||
|
params(tag: Utils::Bottles::Tag,
|
||||||
sig { params(tag: Utils::Bottles::Tag, no_older_versions: T::Boolean).returns(T.nilable(Utils::Bottles::Tag)) }
|
no_older_versions: T::Boolean).returns(T.nilable(Utils::Bottles::Tag))
|
||||||
|
}
|
||||||
def find_matching_tag(tag, no_older_versions: false)
|
def find_matching_tag(tag, no_older_versions: false)
|
||||||
# Used primarily by developers testing beta macOS releases.
|
# Used primarily by developers testing beta macOS releases.
|
||||||
if no_older_versions ||
|
if no_older_versions ||
|
||||||
(OS::Mac.version.prerelease? &&
|
(OS::Mac.version.prerelease? &&
|
||||||
Homebrew::EnvConfig.developer? &&
|
Homebrew::EnvConfig.developer? &&
|
||||||
Homebrew::EnvConfig.skip_or_later_bottles?)
|
Homebrew::EnvConfig.skip_or_later_bottles?)
|
||||||
generic_find_matching_tag(tag)
|
super(tag)
|
||||||
else
|
else
|
||||||
generic_find_matching_tag(tag) ||
|
super(tag) || find_older_compatible_tag(tag)
|
||||||
find_older_compatible_tag(tag)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,4 +59,8 @@ module Utils
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Utils::Bottles.singleton_class.prepend(OS::Mac::Bottles::ClassMethods)
|
||||||
|
Utils::Bottles::Collector.prepend(OS::Mac::Bottles::Collector)
|
||||||
|
|||||||
@ -84,7 +84,6 @@ module FormulaCellarChecks
|
|||||||
def valid_library_extension?(filename)
|
def valid_library_extension?(filename)
|
||||||
VALID_LIBRARY_EXTENSIONS.include? filename.extname
|
VALID_LIBRARY_EXTENSIONS.include? filename.extname
|
||||||
end
|
end
|
||||||
alias generic_valid_library_extension? valid_library_extension?
|
|
||||||
|
|
||||||
sig { returns(T.nilable(String)) }
|
sig { returns(T.nilable(String)) }
|
||||||
def check_non_libraries
|
def check_non_libraries
|
||||||
@ -437,7 +436,6 @@ module FormulaCellarChecks
|
|||||||
problem_if_output(check_cpuid_instruction(formula))
|
problem_if_output(check_cpuid_instruction(formula))
|
||||||
problem_if_output(check_binary_arches(formula))
|
problem_if_output(check_binary_arches(formula))
|
||||||
end
|
end
|
||||||
alias generic_audit_installed audit_installed
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,6 @@ module Hardware
|
|||||||
ppc64le: "-mcpu=powerpc64le",
|
ppc64le: "-mcpu=powerpc64le",
|
||||||
}.freeze, T.nilable(T::Hash[Symbol, String]))
|
}.freeze, T.nilable(T::Hash[Symbol, String]))
|
||||||
end
|
end
|
||||||
alias generic_optimization_flags optimization_flags
|
|
||||||
|
|
||||||
sig { returns(Symbol) }
|
sig { returns(Symbol) }
|
||||||
def arch_32_bit
|
def arch_32_bit
|
||||||
@ -219,6 +218,7 @@ module Hardware
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(_version: T.nilable(MacOSVersion)).returns(Symbol) }
|
||||||
def oldest_cpu(_version = nil)
|
def oldest_cpu(_version = nil)
|
||||||
if Hardware::CPU.intel?
|
if Hardware::CPU.intel?
|
||||||
if Hardware::CPU.is_64_bit?
|
if Hardware::CPU.is_64_bit?
|
||||||
@ -242,7 +242,6 @@ module Hardware
|
|||||||
Hardware::CPU.family
|
Hardware::CPU.family
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias generic_oldest_cpu oldest_cpu
|
|
||||||
|
|
||||||
# Returns a Rust flag to set the target CPU if necessary.
|
# Returns a Rust flag to set the target CPU if necessary.
|
||||||
# Defaults to nil.
|
# Defaults to nil.
|
||||||
|
|||||||
@ -37,7 +37,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def global_post_install; end
|
def global_post_install; end
|
||||||
alias generic_global_post_install global_post_install
|
|
||||||
|
|
||||||
def check_prefix
|
def check_prefix
|
||||||
if (Hardware::CPU.intel? || Hardware::CPU.in_rosetta2?) &&
|
if (Hardware::CPU.intel? || Hardware::CPU.in_rosetta2?) &&
|
||||||
@ -366,7 +365,6 @@ module Homebrew
|
|||||||
Diagnostic.checks(:supported_configuration_checks, fatal: all_fatal)
|
Diagnostic.checks(:supported_configuration_checks, fatal: all_fatal)
|
||||||
Diagnostic.checks(:fatal_preinstall_checks)
|
Diagnostic.checks(:fatal_preinstall_checks)
|
||||||
end
|
end
|
||||||
alias generic_perform_preinstall_checks perform_preinstall_checks
|
|
||||||
|
|
||||||
def attempt_directory_creation
|
def attempt_directory_creation
|
||||||
Keg.must_exist_directories.each do |dir|
|
Keg.must_exist_directories.each do |dir|
|
||||||
|
|||||||
@ -77,7 +77,6 @@ class Keg
|
|||||||
FileUtils.ln_s(new_src, file)
|
FileUtils.ln_s(new_src, file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias generic_fix_dynamic_linkage fix_dynamic_linkage
|
|
||||||
|
|
||||||
def relocate_dynamic_linkage(_relocation)
|
def relocate_dynamic_linkage(_relocation)
|
||||||
[]
|
[]
|
||||||
@ -102,7 +101,6 @@ class Keg
|
|||||||
|
|
||||||
relocation
|
relocation
|
||||||
end
|
end
|
||||||
alias generic_prepare_relocation_to_placeholders prepare_relocation_to_placeholders
|
|
||||||
|
|
||||||
def replace_locations_with_placeholders
|
def replace_locations_with_placeholders
|
||||||
relocation = prepare_relocation_to_placeholders.freeze
|
relocation = prepare_relocation_to_placeholders.freeze
|
||||||
@ -123,7 +121,6 @@ class Keg
|
|||||||
|
|
||||||
relocation
|
relocation
|
||||||
end
|
end
|
||||||
alias generic_prepare_relocation_to_locations prepare_relocation_to_locations
|
|
||||||
|
|
||||||
def replace_placeholders_with_locations(files, skip_linkage: false)
|
def replace_placeholders_with_locations(files, skip_linkage: false)
|
||||||
relocation = prepare_relocation_to_locations.freeze
|
relocation = prepare_relocation_to_locations.freeze
|
||||||
@ -221,7 +218,6 @@ class Keg
|
|||||||
|
|
||||||
[grep_bin, grep_args]
|
[grep_bin, grep_args]
|
||||||
end
|
end
|
||||||
alias generic_egrep_args egrep_args
|
|
||||||
|
|
||||||
def each_unique_file_matching(string)
|
def each_unique_file_matching(string)
|
||||||
Utils.popen_read("fgrep", recursive_fgrep_args, string, to_s) do |io|
|
Utils.popen_read("fgrep", recursive_fgrep_args, string, to_s) do |io|
|
||||||
|
|||||||
@ -188,12 +188,10 @@ class LinkageChecker
|
|||||||
|
|
||||||
store&.update!(keg_files_dylibs:)
|
store&.update!(keg_files_dylibs:)
|
||||||
end
|
end
|
||||||
alias generic_check_dylibs check_dylibs
|
|
||||||
|
|
||||||
def system_libraries_exist_in_cache?
|
def system_libraries_exist_in_cache?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
alias generic_system_libraries_exist_in_cache? system_libraries_exist_in_cache?
|
|
||||||
|
|
||||||
def dylib_found_in_shared_cache?(dylib)
|
def dylib_found_in_shared_cache?(dylib)
|
||||||
@dyld_shared_cache_contains_path ||= begin
|
@dyld_shared_cache_contains_path ||= begin
|
||||||
|
|||||||
@ -93,7 +93,6 @@ module Homebrew
|
|||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
alias generic_disallowed_reason disallowed_reason
|
|
||||||
|
|
||||||
sig { params(name: String).returns(T.nilable(String)) }
|
sig { params(name: String).returns(T.nilable(String)) }
|
||||||
def tap_migration_reason(name)
|
def tap_migration_reason(name)
|
||||||
@ -195,8 +194,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(name: String, silent: T::Boolean, show_info: T::Boolean).returns(T.nilable(String)) }
|
||||||
def cask_reason(name, silent: false, show_info: false); end
|
def cask_reason(name, silent: false, show_info: false); end
|
||||||
|
|
||||||
|
sig { params(name: String, command: String).returns(T.nilable(String)) }
|
||||||
def suggest_command(name, command); end
|
def suggest_command(name, command); end
|
||||||
|
|
||||||
require "extend/os/missing_formula"
|
require "extend/os/missing_formula"
|
||||||
|
|||||||
@ -195,7 +195,6 @@ module SystemConfig
|
|||||||
out.puts hardware if hardware
|
out.puts hardware if hardware
|
||||||
host_software_config(out)
|
host_software_config(out)
|
||||||
end
|
end
|
||||||
alias dump_generic_verbose_config dump_verbose_config
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user