未验证 提交 8aeb2878 编辑于 作者: Carlo Cabrera's avatar Carlo Cabrera
浏览文件

vendor-install: handle native ARM running under Rosetta

Since `HOMEBREW_PROCESSOR` is populated using `uname -m`, this will
register as `Intel` even when a native ARM install is running under
Rosetta.

Let's work around this by checking `sysctl -n machdep.cpu.brand_string`.
On my Intel machine:

    ❯ sysctl -n machdep.cpu.brand_string
    Intel(R) Core(TM) i3-1000NG4 CPU @ 1.10GHz

On Apple Silicon:

    brew@HMBRW-A-001-M1-001 ~ % sysctl -n machdep.cpu.brand_string
    Apple M1

The case of a Rosetta installation of Homebrew is already handled below
the proposed change.

Fixes Homebrew/discussions#2434.
上级 6c341516
......@@ -14,7 +14,8 @@ VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor"
# Built from https://github.com/Homebrew/homebrew-portable-ruby.
if [[ -n "${HOMEBREW_MACOS}" ]]
then
if [[ "${HOMEBREW_PROCESSOR}" == "Intel" ]] ||
if [[ "${HOMEBREW_PROCESSOR}" == "Intel" &&
"$(sysctl -n machdep.cpu.brand_string)" != "Apple"* ]] ||
# Handle the case where /usr/local/bin/brew is run under arm64.
# It's a x86_64 installation there (we refuse to install arm64 binaries) so
# use a x86_64 Portable Ruby.
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册