Skip to content

Commit f7456fb

Browse files
committed
docker-build: fix building for macos-amd64 by forcing the use of an old brew
Fix building for macos-amd64 by forcing theuse of an old brew: - use `brew-install` from an old reference - set `HOMEBREW_NO_INSTALL_FROM_API=1` so the local repository is used with old references Darling emulates an old macOS, and then fetches an old xcode. Current brew doesn't support that old macOS, neither that old xcode. We may want to build on older macOS the same way we do with older Debian for Linux anyway. We use brew to install p7zip and cmake, we don't need it for anything else since we build the external_deps ourselves. In the future we may rely on cmake binary tarball from cmake.org and build p7zip ourselves but using an old brew (and make sure it doesn't auto-update) is good enough to fix the build. We now use a subscript so environment variables are set within darling and not outside of it.
1 parent 6399997 commit f7456fb

4 files changed

+32
-23
lines changed

docker/common.sh

-5
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,3 @@ _error () {
3535
echo "${1}" >&2
3636
exit 1
3737
}
38-
39-
if [ "$(uname -s)" != 'Linux' -o "$(uname -m)" != 'x86_64' ]
40-
then
41-
_error "This script must run on amd64 Linux system"
42-
fi

docker/install-brew-and-packages

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /usr/bin/env bash
2+
3+
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
4+
5+
echo 'y' | _exec xcode-select --install
6+
7+
_exec touch /.dockerenv
8+
9+
_exec curl -fsSL -o brew-install \
10+
'https://raw.githubusercontent.com/Homebrew/install/a8c26acd449233fa2394930b440aac0c7047753c/install.sh'
11+
12+
# See https://docs.brew.sh/Installation
13+
export NONINTERACTIVE=1
14+
export HOMEBREW_NO_INSTALL_CLEANUP=1
15+
export HOMEBREW_NO_AUTO_UPDATE=1
16+
export HOMEBREW_NO_ANALYTICS=1
17+
18+
_exec ./brew-install
19+
20+
# brew-install switches it off automatically
21+
export HOMEBREW_NO_INSTALL_FROM_API=1
22+
23+
_exec git \
24+
-C '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core' \
25+
checkout '103f18b14fbe28e2ff10a39cae19a79a54d636ab'
26+
27+
# curl is already available
28+
_exec brew install p7zip cmake

docker/install-darling-dependencies

+3-18
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,9 @@ if [ ! -f /darling-installed ]
3030
then
3131
export DPREFIX=/darling-prefix
3232

33-
echo 'y' | _exec darling shell xcode-select --install
34-
35-
_exec darling shell touch /.dockerenv
36-
37-
_exec curl -fsSL -o brew-install \
38-
'https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh'
39-
40-
# See https://docs.brew.sh/Installation
41-
export NONINTERACTIVE=1
42-
43-
_exec darling shell ./brew-install
44-
45-
_exec darling shell git \
46-
-C '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core' \
47-
checkout '103f18b14fbe28e2ff10a39cae19a79a54d636ab'
48-
49-
# curl is already available
50-
_exec darling shell brew install p7zip cmake
33+
cp "$(dirname "${BASH_SOURCE[0]}")/common.sh" .
34+
cp "$(dirname "${BASH_SOURCE[0]}")/install-brew-and-packages" .
35+
_exec darling shell ./install-brew-and-packages
5136

5237
_exec touch /darling-installed
5338
fi

docker/unvanquished-darling-system.Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ COPY docker/clone-repositories /docker
1919
COPY docker/build-targets /docker
2020

2121
COPY docker/install-darling-dependencies /docker
22+
COPY docker/install-brew-and-packages /docker
2223

2324
COPY build-release /

0 commit comments

Comments
 (0)