Skip to content

Commit

Permalink
script/build-git: skip Homebrew installs 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.

However, we have always set the NO_OPENSSL environment variable when
building custom versions of Git for our CI jobs, since at least commit
d874af9 of PR git-lfs#1617 in 2016.  This
implies that our Git builds do not make use of OpenSSL at all, either
for SHA hashing or for SSL support in the git-imap-send(1) command.
(Further, since Git version 7.34.0 Git does not require OpenSSL to
make IMAP connections over SSL, and in any case our test suite does not
use IMAP at all.)  Hence we do not need to install the "openssl"
Homebrew formula, since this library will never be linked into the
Git binaries we build.

Meanwhile, we do not set the USE_LIBPCRE environment variable when
building Git, so the PCRE2 library is not linked into our custom Git
binaries and we can thus skip installing the "pcre2" Homebrew formula.
(Also, on the Ubuntu Linux runners provided by GitHub Actions, the
"libpcre2-8-0" package is not available by default, so if we wanted to
set the USE_LIBPCRE variable we would need to install that package
for our Linux CI jobs.)

In addition,the modified version of zlib 1.2.12 supplied by macOS 14
(Sonoma) on the GitHub Actions runners we are using at present is
is sufficient to build Git, so we do not have to install the "zlib"
Homebrew formula either.

As described in commit f3cd1ef
of PR git-lfs#5866, for the moment we must continue to utilize the version of
libcurl from the Homebrew "curl" formula rather than the one supplied
by macOS itself, because the 8.7.1 version of libcurl currently shipped
with macOS 13 and 14 (Ventura and Sonoma) has a regression which
affects the programs used by git-http-backend(1).

However, the macOS 14 runners provided by GitHub Actions are provisioned
with a pre-installed version of the Homebrew "curl" formula, so we do
not need to actually install this formula ourselves.

We can therefore simply drop the "brew install" command entirely, since
there are no Homebrew formulae we have to install any more.

Note, though, that by default Homebrew does not create the symlinks
that would make its version of libcurl take precedence over the one
supplied by macOS.  As commit f3cd1ef
of PR git-lfs#5866 describes, we have to ensure the CURLDIR variable is set
properly so that our "build-earliest" CI jobs will link the Git programs
they build against the Homebrew version of libcurl rather than the one
supplied by macOS.

For this reason we currently run the "brew link" command to make sure
the Homebrew version of the curl-config(1) command is used to set the
value of the CURLDIR variable.  Using the "brew link --force" command
with "keg-only" libraries such as those from the "curl" formula is not
recommended practice, though, so in a subsequent commit in this PR we
will further adjust our script to set the value of the CURLDIR variable
as we require, but without running the "brew link" command first.
  • Loading branch information
chrisd8088 committed Dec 15, 2024
1 parent a32a02b commit be2d42a
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 install curl zlib pcre2 openssl
brew link --force curl zlib pcre2 openssl
brew link --force curl
CURLDIR="$(curl-config --prefix)";;
Linux)
export DEBIAN_FRONTEND=noninteractive
Expand Down

0 comments on commit be2d42a

Please sign in to comment.