Skip to content

Commit a0b3108

Browse files
dschogitster
authored andcommitted
macOS/brew: let the build find gettext headers/libraries/msgfmt
Apparently a recent Homebrew update now installs `gettext` into the subdirectory /usr/local/opt/gettext/[lib/include]. Sometimes the ci job succeeds: brew link --force gettext Linking /usr/local/Cellar/gettext/0.20.1... 179 symlinks created And sometimes installing the package "gettext" with force-link fails: brew link --force gettext Warning: Refusing to link macOS provided/shadowed software: gettext If you need to have gettext first in your PATH run: echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profile (And the is not the final word either, since macOS itself says: The default interactive shell is now zsh.) Anyway, The latter requires CFLAGS to include /usr/local/opt/gettext/include and LDFLAGS to include /usr/local/opt/gettext/lib. Likewise, the `msgfmt` tool is no longer in the `PATH`. While it is unclear which change is responsible for this breakage (that most notably only occurs on CI build agents that updated very recently), Homebrew/homebrew-core#53489 has fixed it. Nevertheless, let's work around this issue, as there are still quite a few build agents out there that need some help in this regard: we explicitly do not call `brew update` in our CI/PR builds anymore. Helped-by: Carlo Marcelo Arenas Belón <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Torsten Bögershausen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent af6b65d commit a0b3108

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

config.mak.uname

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,17 @@ ifeq ($(uname_S),Darwin)
133133
HAVE_BSD_SYSCTL = YesPlease
134134
FREAD_READS_DIRECTORIES = UnfortunatelyYes
135135
HAVE_NS_GET_EXECUTABLE_PATH = YesPlease
136-
BASIC_CFLAGS += -I/usr/local/include
137-
BASIC_LDFLAGS += -L/usr/local/lib
136+
137+
# Workaround for `gettext` being keg-only and not even being linked via
138+
# `brew link --force gettext`, should be obsolete as of
139+
# https://github.com/Homebrew/homebrew-core/pull/53489
140+
ifeq ($(shell test -d /usr/local/opt/gettext/ && echo y),y)
141+
BASIC_CFLAGS += -I/usr/local/include -I/usr/local/opt/gettext/include
142+
BASIC_LDFLAGS += -L/usr/local/lib -L/usr/local/opt/gettext/lib
143+
ifeq ($(shell test -x /usr/local/opt/gettext/bin/msgfmt && echo y),y)
144+
MSGFMT = /usr/local/opt/gettext/bin/msgfmt
145+
endif
146+
endif
138147
endif
139148
ifeq ($(uname_S),SunOS)
140149
NEEDS_SOCKET = YesPlease

0 commit comments

Comments
 (0)