git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] Makefile: detect new Homebrew location for ARM-based Macs

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 15, 2024, 11:45 UTC
Message-ID
<3adb0b7ae888db40949f788f9582569617c20c2b.1705318985.git.ps@pks.im>
In-Reply-To
<cover.1705318985.git.ps@pks.im>

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 <ps@pks.im>
---
 config.mak.uname | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/config.mak.uname b/config.mak.uname
index 3bb03f423a..dacc95172d 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -158,6 +158,19 @@ ifeq ($(uname_S),Darwin)
 		ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
 			MSGFMT = /usr/local/opt/gettext/bin/msgfmt
 		endif
+	# On newer ARM-based machines the default installation path has changed to
+	# /opt/homebrew. Include it in our search paths so that the user does not
+	# have to configure this manually.
+	#
+	# Note that we do not employ the same workaround as above where we manually
+	# add gettext. The issue was fixed more than three years ago by now, and at
+	# that point there haven't been any ARM-based Macs yet.
+	else ifeq ($(shell test -d /opt/homebrew/ && echo y),y)
+		BASIC_CFLAGS += -I/opt/homebrew/include
+		BASIC_LDFLAGS += -L/opt/homebrew/lib
+		ifeq ($(shell test -x /opt/homebrew/bin/msgfmt && echo y),y)
+			MSGFMT = /opt/homebrew/bin/msgfmt
+		endif
 	endif
 
 	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
-- 
2.43.GIT
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 5 of 17 in “ci: add support for macOS to GitLab CI”
  1. 0/3 ci: add support for macOS to GitLab CIPatrick Steinhardt, Jan 15, 2024
  2. 1/3 ci: make p4 setup on macOS more robustPatrick Steinhardt, Jan 15, 2024
  3. Matthias AßhauerJan 18, 2024
  4. Patrick SteinhardtJan 18, 2024
  5. 2/3 Makefile: detect new Homebrew location for ARM-based MacsPatrick Steinhardt, Jan 15, 2024
  6. 3/3 ci: add macOS jobs to GitLab CIPatrick Steinhardt, Jan 15, 2024
  7. Phillip WoodJan 16, 2024
  8. Patrick SteinhardtJan 17, 2024
  9. 0/5 ci: add support for macOS to GitLab CIPatrick Steinhardt, Jan 18, 2024
  10. 1/5 t7527: decrease likelihood of racing with fsmonitor daemonPatrick Steinhardt, Jan 18, 2024
  11. 2/5 Makefile: detect new Homebrew location for ARM-based MacsPatrick Steinhardt, Jan 18, 2024
  12. 3/5 ci: handle TEST_OUTPUT_DIRECTORY when printing test failuresPatrick Steinhardt, Jan 18, 2024
  13. 4/5 ci: make p4 setup on macOS more robustPatrick Steinhardt, Jan 18, 2024
  14. 5/5 ci: add macOS jobs to GitLab CIPatrick Steinhardt, Jan 18, 2024
  15. Phillip WoodJan 21, 2024
  16. Patrick SteinhardtJan 22, 2024
  17. Junio C HamanoJan 22, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.