Move remaining OS extensions to prepend
This commit is contained in:
parent
7c4f2c19fe
commit
eed660e784
@ -177,7 +177,6 @@ class DevelopmentTools
|
|||||||
"cpu_family" => Hardware::CPU.family.to_s,
|
"cpu_family" => Hardware::CPU.family.to_s,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
alias generic_build_system_info build_system_info
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
5
Library/Homebrew/extend/os/linux/cleanup.rbi
Normal file
5
Library/Homebrew/extend/os/linux/cleanup.rbi
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# typed: strict
|
||||||
|
|
||||||
|
# module OS::Linux::Cleanup
|
||||||
|
# include Kernel
|
||||||
|
# end
|
@ -1,17 +1,15 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "os/linux/glibc"
|
require "os/linux/glibc"
|
||||||
|
|
||||||
class DependencyCollector
|
module OS
|
||||||
undef gcc_dep_if_needed
|
module Linux
|
||||||
undef glibc_dep_if_needed
|
module DependencyCollector
|
||||||
undef init_global_dep_tree_if_needed!
|
|
||||||
|
|
||||||
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
||||||
def gcc_dep_if_needed(related_formula_names)
|
def gcc_dep_if_needed(related_formula_names)
|
||||||
# gcc is required for libgcc_s.so.1 if glibc or gcc are too old
|
# gcc is required for libgcc_s.so.1 if glibc or gcc are too old
|
||||||
return unless DevelopmentTools.needs_build_formulae?
|
return unless ::DevelopmentTools.needs_build_formulae?
|
||||||
return if building_global_dep_tree?
|
return if building_global_dep_tree?
|
||||||
return if related_formula_names.include?(GCC)
|
return if related_formula_names.include?(GCC)
|
||||||
return if global_dep_tree[GCC]&.intersect?(related_formula_names)
|
return if global_dep_tree[GCC]&.intersect?(related_formula_names)
|
||||||
@ -22,7 +20,7 @@ class DependencyCollector
|
|||||||
|
|
||||||
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
sig { params(related_formula_names: T::Set[String]).returns(T.nilable(Dependency)) }
|
||||||
def glibc_dep_if_needed(related_formula_names)
|
def glibc_dep_if_needed(related_formula_names)
|
||||||
return unless DevelopmentTools.needs_libc_formula?
|
return unless ::DevelopmentTools.needs_libc_formula?
|
||||||
return if building_global_dep_tree?
|
return if building_global_dep_tree?
|
||||||
return if related_formula_names.include?(GLIBC)
|
return if related_formula_names.include?(GLIBC)
|
||||||
return if global_dep_tree[GLIBC]&.intersect?(related_formula_names)
|
return if global_dep_tree[GLIBC]&.intersect?(related_formula_names)
|
||||||
@ -38,7 +36,7 @@ class DependencyCollector
|
|||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def init_global_dep_tree_if_needed!
|
def init_global_dep_tree_if_needed!
|
||||||
return unless DevelopmentTools.needs_build_formulae?
|
return unless ::DevelopmentTools.needs_build_formulae?
|
||||||
return if building_global_dep_tree?
|
return if building_global_dep_tree?
|
||||||
return unless global_dep_tree.empty?
|
return unless global_dep_tree.empty?
|
||||||
|
|
||||||
@ -51,15 +49,15 @@ class DependencyCollector
|
|||||||
|
|
||||||
sig { params(name: String).returns(T.nilable(Formula)) }
|
sig { params(name: String).returns(T.nilable(Formula)) }
|
||||||
def formula_for(name)
|
def formula_for(name)
|
||||||
@formula_for ||= {}
|
@formula_for ||= T.let({}, T.nilable(T::Hash[String, Formula]))
|
||||||
@formula_for[name] ||= Formula[name]
|
@formula_for[name] ||= ::Formula[name]
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(name: String).returns(T::Array[String]) }
|
sig { params(name: String).returns(T::Array[String]) }
|
||||||
def global_deps_for(name)
|
def global_deps_for(name)
|
||||||
@global_deps_for ||= {}
|
@global_deps_for ||= T.let({}, T.nilable(T::Hash[String, T::Array[String]]))
|
||||||
# Always strip out glibc and gcc from all parts of dependency tree when
|
# Always strip out glibc and gcc from all parts of dependency tree when
|
||||||
# we're calculating their dependency trees. Other parts of Homebrew will
|
# we're calculating their dependency trees. Other parts of Homebrew will
|
||||||
# catch any circular dependencies.
|
# catch any circular dependencies.
|
||||||
@ -75,8 +73,8 @@ class DependencyCollector
|
|||||||
# Use class variables to avoid this expensive logic needing to be done more
|
# Use class variables to avoid this expensive logic needing to be done more
|
||||||
# than once.
|
# than once.
|
||||||
# rubocop:disable Style/ClassVars
|
# rubocop:disable Style/ClassVars
|
||||||
@@global_dep_tree = {}
|
@@global_dep_tree = T.let({}, T::Hash[String, T::Set[String]])
|
||||||
@@building_global_dep_tree = false
|
@@building_global_dep_tree = T.let(false, T::Boolean)
|
||||||
|
|
||||||
sig { returns(T::Hash[String, T::Set[String]]) }
|
sig { returns(T::Hash[String, T::Set[String]]) }
|
||||||
def global_dep_tree
|
def global_dep_tree
|
||||||
@ -98,4 +96,8 @@ class DependencyCollector
|
|||||||
@@building_global_dep_tree.present?
|
@@building_global_dep_tree.present?
|
||||||
end
|
end
|
||||||
# rubocop:enable Style/ClassVars
|
# rubocop:enable Style/ClassVars
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DependencyCollector.prepend(OS::Linux::DependencyCollector)
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DevelopmentTools
|
module OS
|
||||||
class << self
|
module Linux
|
||||||
|
module DevelopmentTools
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { ::DevelopmentTools }
|
||||||
|
|
||||||
sig { params(tool: T.any(String, Symbol)).returns(T.nilable(Pathname)) }
|
sig { params(tool: T.any(String, Symbol)).returns(T.nilable(Pathname)) }
|
||||||
def locate(tool)
|
def locate(tool)
|
||||||
(@locate ||= {}).fetch(tool) do |key|
|
@locate ||= T.let({}, T.nilable(T::Hash[T.any(String, Symbol), Pathname]))
|
||||||
@locate[key] = if needs_build_formulae? &&
|
@locate.fetch(tool) do |key|
|
||||||
|
@locate[key] = if ::DevelopmentTools.needs_build_formulae? &&
|
||||||
(binutils_path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable?
|
(binutils_path = HOMEBREW_PREFIX/"opt/binutils/bin/#{tool}").executable?
|
||||||
binutils_path
|
binutils_path
|
||||||
elsif needs_build_formulae? && (glibc_path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?
|
elsif ::DevelopmentTools.needs_build_formulae? &&
|
||||||
|
(glibc_path = HOMEBREW_PREFIX/"opt/glibc/bin/#{tool}").executable?
|
||||||
glibc_path
|
glibc_path
|
||||||
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
|
elsif (homebrew_path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
|
||||||
homebrew_path
|
homebrew_path
|
||||||
@ -20,35 +27,38 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(Symbol) }
|
sig { returns(Symbol) }
|
||||||
def default_compiler
|
def default_compiler = :gcc
|
||||||
:gcc
|
|
||||||
end
|
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def needs_libc_formula?
|
def needs_libc_formula?
|
||||||
return @needs_libc_formula if defined? @needs_libc_formula
|
return @needs_libc_formula unless @needs_libc_formula.nil?
|
||||||
|
|
||||||
@needs_libc_formula = OS::Linux::Glibc.below_ci_version?
|
@needs_libc_formula = T.let(OS::Linux::Glibc.below_ci_version?, T.nilable(T::Boolean))
|
||||||
|
@needs_libc_formula = !!@needs_libc_formula
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def needs_compiler_formula?
|
def needs_compiler_formula?
|
||||||
return @needs_compiler_formula if defined? @needs_compiler_formula
|
return @needs_compiler_formula unless @needs_compiler_formula.nil?
|
||||||
|
|
||||||
gcc = "/usr/bin/gcc"
|
gcc = "/usr/bin/gcc"
|
||||||
@needs_compiler_formula = if File.exist?(gcc)
|
@needs_compiler_formula = T.let(if File.exist?(gcc)
|
||||||
gcc_version(gcc) < OS::LINUX_GCC_CI_VERSION
|
::DevelopmentTools.gcc_version(gcc) < OS::LINUX_GCC_CI_VERSION
|
||||||
else
|
else
|
||||||
true
|
true
|
||||||
end
|
end, T.nilable(T::Boolean))
|
||||||
|
!!@needs_compiler_formula
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Hash[String, T.nilable(String)]) }
|
sig { returns(T::Hash[String, T.nilable(String)]) }
|
||||||
def build_system_info
|
def build_system_info
|
||||||
generic_build_system_info.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
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DevelopmentTools.singleton_class.prepend(OS::Linux::DevelopmentTools)
|
||||||
|
@ -7,10 +7,13 @@ require "hardware"
|
|||||||
require "os/linux/glibc"
|
require "os/linux/glibc"
|
||||||
require "os/linux/kernel"
|
require "os/linux/kernel"
|
||||||
|
|
||||||
module Homebrew
|
module OS
|
||||||
|
module Linux
|
||||||
module Diagnostic
|
module Diagnostic
|
||||||
class Checks
|
module Checks
|
||||||
undef fatal_preinstall_checks, supported_configuration_checks
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { Homebrew::Diagnostic::Checks }
|
||||||
|
|
||||||
def fatal_preinstall_checks
|
def fatal_preinstall_checks
|
||||||
%w[
|
%w[
|
||||||
@ -142,7 +145,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_gcc_dependent_linkage
|
def check_gcc_dependent_linkage
|
||||||
gcc_dependents = Formula.installed.select do |formula|
|
gcc_dependents = ::Formula.installed.select do |formula|
|
||||||
next false unless formula.tap&.core_tap?
|
next false unless formula.tap&.core_tap?
|
||||||
|
|
||||||
# FIXME: This includes formulae that have no runtime dependency on GCC.
|
# FIXME: This includes formulae that have no runtime dependency on GCC.
|
||||||
@ -171,4 +174,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew::Diagnostic::Checks.prepend(OS::Linux::Diagnostic::Checks)
|
||||||
|
@ -28,7 +28,7 @@ module OS
|
|||||||
|
|
||||||
sig { params(spec: SoftwareSpec).void }
|
sig { params(spec: SoftwareSpec).void }
|
||||||
def add_global_deps_to_spec(spec)
|
def add_global_deps_to_spec(spec)
|
||||||
return unless DevelopmentTools.needs_build_formulae?
|
return unless ::DevelopmentTools.needs_build_formulae?
|
||||||
|
|
||||||
@global_deps ||= begin
|
@global_deps ||= begin
|
||||||
dependency_collector = spec.dependency_collector
|
dependency_collector = spec.dependency_collector
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Homebrew
|
module OS
|
||||||
class SimulateSystem
|
module Linux
|
||||||
class << self
|
module SimulateSystem
|
||||||
undef os
|
|
||||||
undef simulating_or_running_on_linux?
|
|
||||||
undef current_os
|
|
||||||
|
|
||||||
sig { returns(T.nilable(Symbol)) }
|
sig { returns(T.nilable(Symbol)) }
|
||||||
def os
|
def os
|
||||||
|
@os ||= T.let(nil, T.nilable(Symbol))
|
||||||
return :macos if @os.blank? && Homebrew::EnvConfig.simulate_macos_on_linux?
|
return :macos if @os.blank? && Homebrew::EnvConfig.simulate_macos_on_linux?
|
||||||
|
|
||||||
@os
|
@os
|
||||||
@ -27,3 +24,5 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew::SimulateSystem.singleton_class.prepend(OS::Linux::SimulateSystem)
|
||||||
|
@ -8,7 +8,7 @@ module OS
|
|||||||
def use_system_ruby?
|
def use_system_ruby?
|
||||||
return false if Homebrew::EnvConfig.force_vendor_ruby?
|
return false if Homebrew::EnvConfig.force_vendor_ruby?
|
||||||
|
|
||||||
Homebrew::EnvConfig.developer? && ENV["HOMEBREW_USE_RUBY_FROM_PATH"].present?
|
::Homebrew::EnvConfig.developer? && ENV["HOMEBREW_USE_RUBY_FROM_PATH"].present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: true # rubocop:disable Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class DependencyCollector
|
module OS
|
||||||
undef git_dep_if_needed, subversion_dep_if_needed, cvs_dep_if_needed,
|
module Mac
|
||||||
xz_dep_if_needed, unzip_dep_if_needed, bzip2_dep_if_needed
|
module DependencyCollector
|
||||||
|
|
||||||
def git_dep_if_needed(tags); end
|
def git_dep_if_needed(tags); end
|
||||||
|
|
||||||
def subversion_dep_if_needed(tags)
|
def subversion_dep_if_needed(tags)
|
||||||
@ -20,4 +19,8 @@ class DependencyCollector
|
|||||||
def unzip_dep_if_needed(tags); end
|
def unzip_dep_if_needed(tags); end
|
||||||
|
|
||||||
def bzip2_dep_if_needed(tags); end
|
def bzip2_dep_if_needed(tags); end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DependencyCollector.prepend(OS::Mac::DependencyCollector)
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "os/mac/xcode"
|
require "os/mac/xcode"
|
||||||
|
|
||||||
class DevelopmentTools
|
module OS
|
||||||
class << self
|
module Mac
|
||||||
alias generic_locate locate
|
module DevelopmentTools
|
||||||
undef installed?, default_compiler, curl_handles_most_https_certificates?,
|
extend T::Helpers
|
||||||
subversion_handles_most_https_certificates?
|
|
||||||
|
requires_ancestor { ::DevelopmentTools }
|
||||||
|
|
||||||
sig { params(tool: T.any(String, Symbol)).returns(T.nilable(Pathname)) }
|
sig { params(tool: T.any(String, Symbol)).returns(T.nilable(Pathname)) }
|
||||||
def locate(tool)
|
def locate(tool)
|
||||||
(@locate ||= {}).fetch(tool) do |key|
|
@locate ||= T.let({}, T.nilable(T::Hash[T.any(String, Symbol), Pathname]))
|
||||||
@locate[key] = if (located_tool = generic_locate(tool))
|
@locate.fetch(tool) do |key|
|
||||||
|
@locate[key] = if (located_tool = super(tool))
|
||||||
located_tool
|
located_tool
|
||||||
else
|
else
|
||||||
path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp
|
path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp
|
||||||
@ -35,15 +37,15 @@ class DevelopmentTools
|
|||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(Version) }
|
sig { returns(Version) }
|
||||||
def ld64_version
|
def self.ld64_version
|
||||||
@ld64_version ||= begin
|
@ld64_version ||= T.let(begin
|
||||||
json = Utils.popen_read("/usr/bin/ld", "-version_details")
|
json = Utils.popen_read("/usr/bin/ld", "-version_details")
|
||||||
if $CHILD_STATUS.success?
|
if $CHILD_STATUS.success?
|
||||||
Version.parse(JSON.parse(json)["version"])
|
Version.parse(JSON.parse(json)["version"])
|
||||||
else
|
else
|
||||||
Version::NULL
|
Version::NULL
|
||||||
end
|
end
|
||||||
end
|
end, T.nilable(Version))
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
@ -80,7 +82,10 @@ class DevelopmentTools
|
|||||||
"clt" => MacOS::CLT.version.to_s.presence,
|
"clt" => MacOS::CLT.version.to_s.presence,
|
||||||
"preferred_perl" => MacOS.preferred_perl_version,
|
"preferred_perl" => MacOS.preferred_perl_version,
|
||||||
}
|
}
|
||||||
generic_build_system_info.merge build_info
|
super.merge build_info
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
DevelopmentTools.singleton_class.prepend(OS::Mac::DevelopmentTools)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: true # rubocop:disable Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Homebrew
|
module OS
|
||||||
|
module Mac
|
||||||
module Diagnostic
|
module Diagnostic
|
||||||
class Volumes
|
class Volumes
|
||||||
def initialize
|
def initialize
|
||||||
@ -41,10 +42,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Checks
|
module Checks
|
||||||
undef fatal_preinstall_checks, fatal_build_from_source_checks,
|
extend T::Helpers
|
||||||
fatal_setup_build_environment_checks, supported_configuration_checks,
|
|
||||||
build_from_source_checks
|
requires_ancestor { Homebrew::Diagnostic::Checks }
|
||||||
|
|
||||||
def fatal_preinstall_checks
|
def fatal_preinstall_checks
|
||||||
checks = %w[
|
checks = %w[
|
||||||
@ -52,7 +53,7 @@ module Homebrew
|
|||||||
]
|
]
|
||||||
|
|
||||||
# We need the developer tools for `codesign`.
|
# We need the developer tools for `codesign`.
|
||||||
checks << "check_for_installed_developer_tools" if Hardware::CPU.arm?
|
checks << "check_for_installed_developer_tools" if ::Hardware::CPU.arm?
|
||||||
|
|
||||||
checks.freeze
|
checks.freeze
|
||||||
end
|
end
|
||||||
@ -91,7 +92,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_for_non_prefixed_findutils
|
def check_for_non_prefixed_findutils
|
||||||
findutils = Formula["findutils"]
|
findutils = ::Formula["findutils"]
|
||||||
return unless findutils.any_version_installed?
|
return unless findutils.any_version_installed?
|
||||||
|
|
||||||
gnubin = %W[#{findutils.opt_libexec}/gnubin #{findutils.libexec}/gnubin]
|
gnubin = %W[#{findutils.opt_libexec}/gnubin #{findutils.libexec}/gnubin]
|
||||||
@ -206,7 +207,7 @@ module Homebrew
|
|||||||
|
|
||||||
<<~EOS
|
<<~EOS
|
||||||
Xcode alone is not sufficient on #{MacOS.version.pretty_name}.
|
Xcode alone is not sufficient on #{MacOS.version.pretty_name}.
|
||||||
#{DevelopmentTools.installation_instructions}
|
#{::DevelopmentTools.installation_instructions}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -307,7 +308,7 @@ module Homebrew
|
|||||||
|
|
||||||
if gettext&.linked_keg&.directory?
|
if gettext&.linked_keg&.directory?
|
||||||
allowlist = ["#{HOMEBREW_CELLAR}/gettext"]
|
allowlist = ["#{HOMEBREW_CELLAR}/gettext"]
|
||||||
if Hardware::CPU.physical_cpu_arm64?
|
if ::Hardware::CPU.physical_cpu_arm64?
|
||||||
allowlist += %W[
|
allowlist += %W[
|
||||||
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/Cellar/gettext
|
#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/Cellar/gettext
|
||||||
#{HOMEBREW_DEFAULT_PREFIX}/Cellar/gettext
|
#{HOMEBREW_DEFAULT_PREFIX}/Cellar/gettext
|
||||||
@ -403,7 +404,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check_if_supported_sdk_available
|
def check_if_supported_sdk_available
|
||||||
return unless DevelopmentTools.installed?
|
return unless ::DevelopmentTools.installed?
|
||||||
return unless MacOS.sdk_root_needed?
|
return unless MacOS.sdk_root_needed?
|
||||||
return if MacOS.sdk
|
return if MacOS.sdk
|
||||||
|
|
||||||
@ -464,4 +465,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Homebrew::Diagnostic::Checks.prepend(OS::Mac::Diagnostic::Checks)
|
||||||
|
@ -37,6 +37,6 @@ module SharedEnvExtension
|
|||||||
# This is supported starting Xcode 13, which ships ld64-711.
|
# This is supported starting Xcode 13, which ships ld64-711.
|
||||||
# https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes
|
# https://developer.apple.com/documentation/xcode-release-notes/xcode-13-release-notes
|
||||||
# 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
|
||||||
DevelopmentTools.ld64_version >= 711
|
OS::Mac::DevelopmentTools.ld64_version >= 711
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
# 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 { ::Stdenv }
|
||||||
|
|
||||||
sig { returns(T::Array[Pathname]) }
|
sig { returns(T::Array[Pathname]) }
|
||||||
def homebrew_extra_pkg_config_paths
|
def homebrew_extra_pkg_config_paths
|
||||||
@ -12,7 +16,7 @@ module Stdenv
|
|||||||
|
|
||||||
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),
|
||||||
@ -20,8 +24,8 @@ 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:,
|
generic_setup_build_environment(formula:, cc:, build_bottle:, bottle_arch:,
|
||||||
testing_formula:, debug_symbols:)
|
testing_formula:, debug_symbols:)
|
||||||
|
|
||||||
@ -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,29 +1,26 @@
|
|||||||
# 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
|
||||||
|
module Superenv
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { ::Superenv }
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
# The location of Homebrew's shims on macOS.
|
# The location of Homebrew's shims on macOS.
|
||||||
def shims_path
|
def shims_path
|
||||||
HOMEBREW_SHIMS_PATH/"mac/super"
|
HOMEBREW_SHIMS_PATH/"mac/super"
|
||||||
end
|
end
|
||||||
|
|
||||||
undef bin
|
|
||||||
|
|
||||||
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}")]
|
||||||
@ -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,9 @@ 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")]
|
[Pathname(
|
||||||
|
"#{self["HOMEBREW_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 +82,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,7 +104,7 @@ 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
|
||||||
|
|
||||||
@ -152,11 +151,13 @@ module Superenv
|
|||||||
no_fixup_chains
|
no_fixup_chains
|
||||||
|
|
||||||
# Strip build prefixes from linker where supported, for deterministic builds.
|
# Strip build prefixes from linker where supported, for deterministic builds.
|
||||||
append_to_cccfg "o" if DevelopmentTools.ld64_version >= 512
|
append_to_cccfg "o" if OS::Mac::DevelopmentTools.ld64_version >= 512
|
||||||
|
|
||||||
# Pass `-ld_classic` whenever the linker is invoked with `-dead_strip_dylibs`
|
# Pass `-ld_classic` whenever the linker is invoked with `-dead_strip_dylibs`
|
||||||
# on `ld` versions that don't properly handle that option.
|
# on `ld` versions that don't properly handle that option.
|
||||||
append_to_cccfg "c" if DevelopmentTools.ld64_version >= "1015.7" && DevelopmentTools.ld64_version <= "1022.1"
|
if OS::Mac::DevelopmentTools.ld64_version >= "1015.7" && OS::Mac::DevelopmentTools.ld64_version <= "1022.1"
|
||||||
|
append_to_cccfg "c"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_weak_imports
|
def no_weak_imports
|
||||||
@ -166,4 +167,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)
|
||||||
|
@ -97,7 +97,7 @@ module FormulaCellarChecks
|
|||||||
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)
|
||||||
|
|
||||||
keg = Keg.new(formula.prefix)
|
keg = ::Keg.new(formula.prefix)
|
||||||
flat_namespace_files = keg.mach_o_files.reject do |file|
|
flat_namespace_files = keg.mach_o_files.reject do |file|
|
||||||
next true unless file.dylib?
|
next true unless file.dylib?
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ module OS
|
|||||||
|
|
||||||
sig { params(formula: Formula).returns(T.nilable(T::Boolean)) }
|
sig { params(formula: Formula).returns(T.nilable(T::Boolean)) }
|
||||||
def fresh_install?(formula)
|
def fresh_install?(formula)
|
||||||
!Homebrew::EnvConfig.developer? && !OS::Mac.version.outdated_release? &&
|
!::Homebrew::EnvConfig.developer? && !OS::Mac.version.outdated_release? &&
|
||||||
(!installed_as_dependency? || !formula.any_version_installed?)
|
(!installed_as_dependency? || !formula.any_version_installed?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
require "macho"
|
require "macho"
|
||||||
|
|
||||||
module Hardware
|
module OS
|
||||||
class CPU
|
module Mac
|
||||||
class << self
|
module Hardware
|
||||||
undef type, family, features, sse4?
|
module CPU
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
# These methods use info spewed out by sysctl.
|
# These methods use info spewed out by sysctl.
|
||||||
# Look in <mach/machine.h> for decoding info.
|
# Look in <mach/machine.h> for decoding info.
|
||||||
@ -22,9 +23,9 @@ module Hardware
|
|||||||
end
|
end
|
||||||
|
|
||||||
def family
|
def family
|
||||||
if arm?
|
if ::Hardware::CPU.arm?
|
||||||
arm_family
|
arm_family
|
||||||
elsif intel?
|
elsif ::Hardware::CPU.intel?
|
||||||
intel_family
|
intel_family
|
||||||
else
|
else
|
||||||
:dunno
|
:dunno
|
||||||
@ -174,4 +175,7 @@ module Hardware
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Hardware::CPU.singleton_class.prepend(OS::Mac::Hardware::CPU)
|
||||||
|
@ -23,17 +23,17 @@ class Keg
|
|||||||
GENERIC_MUST_BE_WRITABLE_DIRECTORIES +
|
GENERIC_MUST_BE_WRITABLE_DIRECTORIES +
|
||||||
[HOMEBREW_PREFIX/"Frameworks"]
|
[HOMEBREW_PREFIX/"Frameworks"]
|
||||||
).sort.uniq.freeze
|
).sort.uniq.freeze
|
||||||
|
end
|
||||||
|
|
||||||
undef binary_executable_or_library_files
|
module OS
|
||||||
|
module Mac
|
||||||
def binary_executable_or_library_files
|
module Keg
|
||||||
mach_o_files
|
def binary_executable_or_library_files = mach_o_files
|
||||||
end
|
|
||||||
|
|
||||||
def codesign_patched_binary(file)
|
def codesign_patched_binary(file)
|
||||||
return if MacOS.version < :big_sur
|
return if MacOS.version < :big_sur
|
||||||
|
|
||||||
unless Hardware::CPU.arm?
|
unless ::Hardware::CPU.arm?
|
||||||
result = system_command("codesign", args: ["--verify", file], print_stderr: false)
|
result = system_command("codesign", args: ["--verify", file], print_stderr: false)
|
||||||
return unless result.stderr.match?(/invalid signature/i)
|
return unless result.stderr.match?(/invalid signature/i)
|
||||||
end
|
end
|
||||||
@ -94,8 +94,6 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
undef prepare_debug_symbols
|
|
||||||
|
|
||||||
def prepare_debug_symbols
|
def prepare_debug_symbols
|
||||||
binary_executable_or_library_files.each do |file|
|
binary_executable_or_library_files.each do |file|
|
||||||
odebug "Extracting symbols #{file}"
|
odebug "Extracting symbols #{file}"
|
||||||
@ -111,8 +109,6 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
undef consistent_reproducible_symlink_permissions!
|
|
||||||
|
|
||||||
# Needed to make symlink permissions consistent on macOS and Linux for
|
# Needed to make symlink permissions consistent on macOS and Linux for
|
||||||
# reproducible bottles.
|
# reproducible bottles.
|
||||||
def consistent_reproducible_symlink_permissions!
|
def consistent_reproducible_symlink_permissions!
|
||||||
@ -120,4 +116,8 @@ class Keg
|
|||||||
File.lchmod 0777, file if file.symlink?
|
File.lchmod 0777, file if file.symlink?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Keg.prepend(OS::Mac::Keg)
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
# typed: true # rubocop:disable Sorbet/StrictSigil
|
# typed: true # rubocop:disable Sorbet/StrictSigil
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Keg
|
module OS
|
||||||
class << self
|
module Mac
|
||||||
undef file_linked_libraries
|
module Keg
|
||||||
|
extend T::Helpers
|
||||||
|
|
||||||
|
requires_ancestor { ::Keg }
|
||||||
|
|
||||||
|
module ClassMethods
|
||||||
def file_linked_libraries(file, string)
|
def file_linked_libraries(file, string)
|
||||||
# Check dynamic library linkage. Importantly, do not perform for static
|
# Check dynamic library linkage. Importantly, do not perform for static
|
||||||
# libraries, which will falsely report "linkage" to themselves.
|
# libraries, which will falsely report "linkage" to themselves.
|
||||||
@ -16,8 +20,6 @@ class Keg
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
undef relocate_dynamic_linkage
|
|
||||||
|
|
||||||
def relocate_dynamic_linkage(relocation)
|
def relocate_dynamic_linkage(relocation)
|
||||||
mach_o_files.each do |file|
|
mach_o_files.each do |file|
|
||||||
file.ensure_writable do
|
file.ensure_writable do
|
||||||
@ -112,10 +114,10 @@ class Keg
|
|||||||
# bad_name relative to the lib directory, so that we can skip the more
|
# bad_name relative to the lib directory, so that we can skip the more
|
||||||
# expensive recursive search if possible.
|
# expensive recursive search if possible.
|
||||||
def fixed_name(file, bad_name)
|
def fixed_name(file, bad_name)
|
||||||
if bad_name.start_with? PREFIX_PLACEHOLDER
|
if bad_name.start_with? ::Keg::PREFIX_PLACEHOLDER
|
||||||
bad_name.sub(PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
|
bad_name.sub(::Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX)
|
||||||
elsif bad_name.start_with? CELLAR_PLACEHOLDER
|
elsif bad_name.start_with? ::Keg::CELLAR_PLACEHOLDER
|
||||||
bad_name.sub(CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
|
bad_name.sub(::Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR)
|
||||||
elsif (file.dylib? || file.mach_o_bundle?) && (file.dirname/bad_name).exist?
|
elsif (file.dylib? || file.mach_o_bundle?) && (file.dirname/bad_name).exist?
|
||||||
"@loader_path/#{bad_name}"
|
"@loader_path/#{bad_name}"
|
||||||
elsif file.mach_o_executable? && (lib/bad_name).exist?
|
elsif file.mach_o_executable? && (lib/bad_name).exist?
|
||||||
@ -209,11 +211,11 @@ class Keg
|
|||||||
else
|
else
|
||||||
"/usr/bin/perl#{MacOS.preferred_perl_version}"
|
"/usr/bin/perl#{MacOS.preferred_perl_version}"
|
||||||
end
|
end
|
||||||
relocation.add_replacement_pair(:perl, PERL_PLACEHOLDER, perl_path)
|
relocation.add_replacement_pair(:perl, ::Keg::PERL_PLACEHOLDER, perl_path)
|
||||||
|
|
||||||
if (openjdk = openjdk_dep_name_if_applicable)
|
if (openjdk = openjdk_dep_name_if_applicable)
|
||||||
openjdk_path = HOMEBREW_PREFIX/"opt"/openjdk/"libexec/openjdk.jdk/Contents/Home"
|
openjdk_path = HOMEBREW_PREFIX/"opt"/openjdk/"libexec/openjdk.jdk/Contents/Home"
|
||||||
relocation.add_replacement_pair(:java, JAVA_PLACEHOLDER, openjdk_path.to_s)
|
relocation.add_replacement_pair(:java, ::Keg::JAVA_PLACEHOLDER, openjdk_path.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
relocation
|
relocation
|
||||||
@ -252,4 +254,9 @@ class Keg
|
|||||||
|
|
||||||
filename.start_with?(HOMEBREW_TEMP.to_s) || filename.start_with?(HOMEBREW_TEMP.realpath.to_s)
|
filename.start_with?(HOMEBREW_TEMP.to_s) || filename.start_with?(HOMEBREW_TEMP.realpath.to_s)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Keg.singleton_class.prepend(OS::Mac::Keg::ClassMethods)
|
||||||
|
Keg.prepend(OS::Mac::Keg)
|
||||||
|
@ -9,7 +9,7 @@ module OS
|
|||||||
requires_ancestor { Kernel }
|
requires_ancestor { Kernel }
|
||||||
|
|
||||||
sig { params(tap: Tap, os_name: T.nilable(Symbol), arch: T.nilable(Symbol)).returns(T::Boolean) }
|
sig { params(tap: Tap, os_name: T.nilable(Symbol), arch: T.nilable(Symbol)).returns(T::Boolean) }
|
||||||
def valid_casks?(tap, os_name: nil, arch: Hardware::CPU.type)
|
def valid_casks?(tap, os_name: nil, arch: ::Hardware::CPU.type)
|
||||||
return true if os_name == :linux
|
return true if os_name == :linux
|
||||||
|
|
||||||
current_macos_version = if os_name.is_a?(Symbol)
|
current_macos_version = if os_name.is_a?(Symbol)
|
||||||
|
@ -13,7 +13,7 @@ module OS
|
|||||||
|
|
||||||
sig { returns(Symbol) }
|
sig { returns(Symbol) }
|
||||||
def current_os
|
def current_os
|
||||||
Homebrew::SimulateSystem.os || MacOS.version.to_sym
|
::Homebrew::SimulateSystem.os || MacOS.version.to_sym
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,20 +3,26 @@
|
|||||||
|
|
||||||
require "system_command"
|
require "system_command"
|
||||||
|
|
||||||
|
module OS
|
||||||
|
module Mac
|
||||||
|
module SystemConfig
|
||||||
|
sig { returns(String) }
|
||||||
|
def describe_clang
|
||||||
|
return "N/A" if ::SystemConfig.clang.null?
|
||||||
|
|
||||||
|
clang_build_info = ::SystemConfig.clang_build.null? ? "(parse error)" : ::SystemConfig.clang_build
|
||||||
|
"#{::SystemConfig.clang} build #{clang_build_info}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SystemConfig.prepend(OS::Mac::SystemConfig)
|
||||||
|
|
||||||
module SystemConfig
|
module SystemConfig
|
||||||
class << self
|
class << self
|
||||||
include SystemCommand::Mixin
|
include SystemCommand::Mixin
|
||||||
|
|
||||||
undef describe_clang
|
|
||||||
|
|
||||||
sig { returns(String) }
|
|
||||||
def describe_clang
|
|
||||||
return "N/A" if clang.null?
|
|
||||||
|
|
||||||
clang_build_info = clang_build.null? ? "(parse error)" : clang_build
|
|
||||||
"#{clang} build #{clang_build_info}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def xcode
|
def xcode
|
||||||
@xcode ||= if MacOS::Xcode.installed?
|
@xcode ||= if MacOS::Xcode.installed?
|
||||||
xcode = MacOS::Xcode.version.to_s
|
xcode = MacOS::Xcode.version.to_s
|
||||||
|
9
Library/Homebrew/hardware.rbi
Normal file
9
Library/Homebrew/hardware.rbi
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# typed: strict
|
||||||
|
|
||||||
|
module Hardware
|
||||||
|
class CPU
|
||||||
|
class << self
|
||||||
|
include OS::Mac::Hardware::CPU
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
5
Library/Homebrew/keg.rbi
Normal file
5
Library/Homebrew/keg.rbi
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# typed: strict
|
||||||
|
|
||||||
|
class Keg
|
||||||
|
include OS::Mac::Keg
|
||||||
|
end
|
@ -210,7 +210,6 @@ class Keg
|
|||||||
# for GNU grep; overridden for BSD grep on OS X
|
# for GNU grep; overridden for BSD grep on OS X
|
||||||
"-lr"
|
"-lr"
|
||||||
end
|
end
|
||||||
alias generic_recursive_fgrep_args recursive_fgrep_args
|
|
||||||
|
|
||||||
def egrep_args
|
def egrep_args
|
||||||
grep_bin = "grep"
|
grep_bin = "grep"
|
||||||
|
@ -151,7 +151,7 @@ module OS
|
|||||||
# Xcode.prefix is pretty smart, so let's look inside to find the sdk
|
# Xcode.prefix is pretty smart, so let's look inside to find the sdk
|
||||||
sdk_prefix = "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs"
|
sdk_prefix = "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs"
|
||||||
# Finally query Xcode itself (this is slow, so check it last)
|
# Finally query Xcode itself (this is slow, so check it last)
|
||||||
sdk_platform_path = Utils.popen_read(DevelopmentTools.locate("xcrun"), "--show-sdk-platform-path").chomp
|
sdk_platform_path = Utils.popen_read(::DevelopmentTools.locate("xcrun"), "--show-sdk-platform-path").chomp
|
||||||
sdk_prefix = File.join(sdk_platform_path, "Developer", "SDKs") unless File.directory? sdk_prefix
|
sdk_prefix = File.join(sdk_platform_path, "Developer", "SDKs") unless File.directory? sdk_prefix
|
||||||
|
|
||||||
sdk_prefix
|
sdk_prefix
|
||||||
|
@ -227,7 +227,7 @@ module OS
|
|||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def self.detect_version_from_clang_version
|
def self.detect_version_from_clang_version
|
||||||
version = DevelopmentTools.clang_version
|
version = ::DevelopmentTools.clang_version
|
||||||
|
|
||||||
return "dunno" if version.null?
|
return "dunno" if version.null?
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class AbstractTab
|
|||||||
"tap" => nil,
|
"tap" => nil,
|
||||||
"tap_git_head" => nil,
|
"tap_git_head" => nil,
|
||||||
},
|
},
|
||||||
"built_on" => DevelopmentTools.generic_build_system_info,
|
"built_on" => DevelopmentTools.build_system_info,
|
||||||
}
|
}
|
||||||
|
|
||||||
new(attributes)
|
new(attributes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user