Skip to content

Commit d52b426

Browse files
pks-tgitster
authored andcommitted
Makefile: detect new Homebrew location for ARM-based Macs
With the introduction of the ARM-based Macs the default location for Homebrew has changed from "/usr/local" to "/opt/homebrew". We only handle the former location though, which means that unless the user has manually configured required search paths we won't be able to locate it. Improve upon this by adding relevant paths to our CFLAGS and LDFLAGS as well as detecting the location of msgfmt(1). Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f591a9b commit d52b426

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

config.mak.uname

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ ifeq ($(uname_S),Darwin)
158158
ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
159159
MSGFMT = /usr/local/opt/gettext/bin/msgfmt
160160
endif
161+
# On newer ARM-based machines the default installation path has changed to
162+
# /opt/homebrew. Include it in our search paths so that the user does not
163+
# have to configure this manually.
164+
#
165+
# Note that we do not employ the same workaround as above where we manually
166+
# add gettext. The issue was fixed more than three years ago by now, and at
167+
# that point there haven't been any ARM-based Macs yet.
168+
else ifeq ($(shell test -d /opt/homebrew/ && echo y),y)
169+
BASIC_CFLAGS += -I/opt/homebrew/include
170+
BASIC_LDFLAGS += -L/opt/homebrew/lib
171+
ifeq ($(shell test -x /opt/homebrew/bin/msgfmt && echo y),y)
172+
MSGFMT = /opt/homebrew/bin/msgfmt
173+
endif
161174
endif
162175

163176
# The builtin FSMonitor on MacOS builds upon Simple-IPC. Both require

0 commit comments

Comments
 (0)