Skip to content

Commit

Permalink
script/build-git: skip Homebrew linking on macOS
Browse files Browse the repository at this point in the history
Since we migrated our CI jobs to GitHub Actions in PR git-lfs#3808, our
"build-latest" and "build-earliest" jobs, when running on macOS, have
explicitly installed and linked the "curl", "openssl", "pcre2", and
"zlib" Homebrew formulae before building a custom version of Git.

In a prior commit in this PR we removed the "brew install" command from
our script/build-git script entirely, as we no longer need to install
any Homebrew formulae, for the reasons described in that commit.

However, we left an invocation of the "brew link" command for the "curl"
formula in place in order to ensure that in our "build-earliest" CI job
the CURLDIR variable is set such that when we build Git version 2.0.0 in
that job, the Git binaries are linked against the Homebrew instance of
the libcurl library rather than the one provided by macOS.  We introduced
the CURLDIR variable in commit f3cd1ef
of PR git-lfs#5866 so as to prevent our Git builds from linking with the libcurl
library supplied by macOS, because at present macOS 13 and 14 (Ventura
and Sonoma) provide version 8.7.1 of libcurl and it has a regression that
affects the programs used by git-http-backend(1).

The Homebrew project recommends against using the "brew link --force"
command, though, for "keg-only" libraries like those from the "curl"
formula:

  https://docs.brew.sh/How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies

Fortunately, we can achieve our desired result of linking our custom
Git binaries against the Homebrew version of libcurl just by setting
the CURLDIR variable using the "brew --prefix curl" command, so we do
that now.
  • Loading branch information
chrisd8088 committed Dec 15, 2024
1 parent be2d42a commit c0e8ab0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions script/build-git
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ DIR="$1"

case $(uname -s) in
Darwin)
brew link --force curl
CURLDIR="$(curl-config --prefix)";;
CURLDIR="$(brew --prefix curl)";;
Linux)
export DEBIAN_FRONTEND=noninteractive
if test -f /etc/apt/sources.list.d/ubuntu.sources; then
Expand Down

0 comments on commit c0e8ab0

Please sign in to comment.