Skip to content

Commit 030ba7e

Browse files
clemlesneclaude
andcommitted
ci: use config.mak for macOS Homebrew paths instead of make args
Shell quoting with make command-line variables is fragile — spaces in CPPFLAGS/LDFLAGS caused make to interpret paths as options. Git's Makefile auto-includes config.mak, so writing the paths there avoids all quoting issues. Uses += to append to existing flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 34ef5db commit 030ba7e

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,23 @@ jobs:
6363
6464
NPROC=$(nproc 2>/dev/null || sysctl -n hw.ncpu)
6565
66-
# On macOS, Homebrew keg-only packages (openssl, curl, gettext) are
67-
# not linked into the default search paths. Git's config.mak.uname
68-
# gained Homebrew auto-detection around v2.47, but older versions
69-
# (2.34.1, 2.39.5) lack it. Git's Makefile overrides CFLAGS and
70-
# LDFLAGS env vars, so we pass them on the make command line where
71-
# they take precedence over Makefile assignments.
72-
MAKE_ARGS="prefix=$HOME/git-install"
66+
# On macOS, Homebrew keg-only packages (openssl, curl, expat,
67+
# gettext) are not linked into the default search paths.
68+
# Git's config.mak.uname has partial Homebrew auto-detection:
69+
# - gettext: since git 2.27 (Intel), 2.44 (ARM)
70+
# - openssl, curl, expat: NOT auto-detected in any version
71+
# Git's Makefile uses -include config.mak (silently skipped if
72+
# absent), so we write paths there. Uses += to append to flags.
7373
if [ "$RUNNER_OS" = "macOS" ]; then
7474
BREW_PREFIX=$(brew --prefix)
75-
MAKE_ARGS="$MAKE_ARGS CPPFLAGS=-I${BREW_PREFIX}/opt/openssl/include\ -I${BREW_PREFIX}/opt/curl/include\ -I${BREW_PREFIX}/opt/expat/include\ -I${BREW_PREFIX}/opt/gettext/include"
76-
MAKE_ARGS="$MAKE_ARGS LDFLAGS=-L${BREW_PREFIX}/opt/openssl/lib\ -L${BREW_PREFIX}/opt/curl/lib\ -L${BREW_PREFIX}/opt/expat/lib\ -L${BREW_PREFIX}/opt/gettext/lib"
75+
printf '%s\n' \
76+
"CPPFLAGS += -I${BREW_PREFIX}/opt/openssl/include -I${BREW_PREFIX}/opt/curl/include -I${BREW_PREFIX}/opt/expat/include -I${BREW_PREFIX}/opt/gettext/include" \
77+
"LDFLAGS += -L${BREW_PREFIX}/opt/openssl/lib -L${BREW_PREFIX}/opt/curl/lib -L${BREW_PREFIX}/opt/expat/lib -L${BREW_PREFIX}/opt/gettext/lib" \
78+
> config.mak
7779
fi
7880
79-
make $MAKE_ARGS -j"$NPROC" all
80-
make $MAKE_ARGS install
81+
make prefix="$HOME/git-install" -j"$NPROC" all
82+
make prefix="$HOME/git-install" install
8183
8284
- name: Verify git build
8385
run: |

0 commit comments

Comments
 (0)