
- Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead - Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not) - Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture. - Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa - Actually write out the architecture of dependencies to the tab rather than generating and throwing them away - Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux While we're here: - Don't say Big Sur is a prerelease version but still make it clear we don't support it (yet). - Don't reference non-existent IRC channel
58 lines
1.6 KiB
Ruby
58 lines
1.6 KiB
Ruby
# typed: true
|
|
# frozen_string_literal: true
|
|
|
|
require "system_command"
|
|
|
|
module SystemConfig
|
|
class << self
|
|
include SystemCommand::Mixin
|
|
|
|
undef describe_java, describe_homebrew_ruby
|
|
|
|
def describe_java
|
|
# java_home doesn't exist on all macOSs; it might be missing on older versions.
|
|
return "N/A" unless File.executable? "/usr/libexec/java_home"
|
|
|
|
result = system_command("/usr/libexec/java_home", args: ["--xml", "--failfast"], print_stderr: false)
|
|
return "N/A" unless result.success?
|
|
|
|
result.plist.map { |jvm| jvm["JVMVersion"] }.uniq.join(", ")
|
|
end
|
|
|
|
def describe_homebrew_ruby
|
|
s = describe_homebrew_ruby_version
|
|
|
|
if RUBY_PATH.to_s.match?(%r{^/System/Library/Frameworks/Ruby\.framework/Versions/[12]\.[089]/usr/bin/ruby})
|
|
s
|
|
else
|
|
"#{s} => #{RUBY_PATH}"
|
|
end
|
|
end
|
|
|
|
def xcode
|
|
@xcode ||= if MacOS::Xcode.installed?
|
|
xcode = MacOS::Xcode.version.to_s
|
|
xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
|
|
xcode
|
|
end
|
|
end
|
|
|
|
def clt
|
|
@clt ||= MacOS::CLT.version if MacOS::CLT.installed?
|
|
end
|
|
|
|
def xquartz
|
|
@xquartz ||= "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}" if MacOS::XQuartz.installed?
|
|
end
|
|
|
|
def dump_verbose_config(f = $stdout)
|
|
dump_generic_verbose_config(f)
|
|
f.puts "macOS: #{MacOS.full_version}-#{kernel}"
|
|
f.puts "CLT: #{clt || "N/A"}"
|
|
f.puts "Xcode: #{xcode || "N/A"}"
|
|
f.puts "XQuartz: #{xquartz}" if xquartz
|
|
f.puts "Rosetta 2: #{Hardware::CPU.in_rosetta2?}" if Hardware::CPU.physical_cpu_arm64?
|
|
end
|
|
end
|
|
end
|