shims/mac/super/m4: use gm4 if missing m4 (e.g. Xcode 15.3 CLT)

Signed-off-by: Michael Cho <michael@michaelcho.dev>
This commit is contained in:
Michael Cho 2024-03-29 18:47:07 -04:00
parent c197b80922
commit c4695307e4
No known key found for this signature in database
GPG Key ID: 55E85E28A7CD1E85

View File

@ -0,0 +1,19 @@
#!/bin/bash
# This shim is a workaround for the missing `m4` in Xcode CLT 15.3.
# It can be removed after Apple provides a new CLT with a fix for FB13679972.
# See https://github.com/Homebrew/homebrew-core/issues/165388
# HOMEBREW_LIBRARY is set by bin/brew
# HOMEBREW_DEVELOPER_DIR is set by extend/ENV/super.rb
# shellcheck disable=SC2154
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
try_exec_non_system "${SHIM_FILE}" "$@"
if [[ -n "${HOMEBREW_DEVELOPER_DIR}" && ! -x "${HOMEBREW_DEVELOPER_DIR}/usr/bin/m4" ]]
then
safe_exec "/usr/bin/gm4" "$@"
fi
exec "/usr/bin/m4" "$@"