Skip to content

Commit f902212

Browse files
committed
single image, all platforms
1 parent 7875ada commit f902212

File tree

1 file changed

+112
-73
lines changed

1 file changed

+112
-73
lines changed

docker/install-system-dependencies

Lines changed: 112 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
2828

2929
export DEBIAN_FRONTEND='noninteractive'
3030

31+
linux_architectures=(amd64 i686 arm64 armhf)
32+
windows_architectures=(amd64 i686)
33+
macos_architectures=(amd64)
34+
3135
# TODO: Remove scons and python3 onces the NaCl loader builds with CMake.
3236
# TODO: Remove clang onces the NaCl loader builds with GCC.
3337
# TODO: Remove unzip onces the NaCl loader archive uses another format than zip.
@@ -43,12 +47,9 @@ system_packages=(
4347
)
4448

4549
# Toolchain dependencies for Unvanquished, Daemon, external_packages, or build-release.
46-
# The g++ package also brings build dependencies needed by other compilers.
47-
# The breakpad dump_syms binaries are also built with g++.
4850
# We removed the cmake package as it is installed from tarball.
4951
generic_toolchain_packages=(
5052
autoconf
51-
g++
5253
libtool
5354
make
5455
pkg-config
@@ -87,66 +88,105 @@ linux_generic_av_packages=(
8788

8889
declare -a alternative_pairs
8990

91+
build_vm='false'
92+
build_linux='false'
93+
build_windows='false'
94+
build_macos='false'
95+
9096
for target in ${targets}
9197
do
9298
case "${target}" in
9399
vm)
94-
system_packages+=(${generic_toolchain_packages[@]})
95-
system_packages+=(${game_toolchain_packages[@]})
96-
;;
97-
linux-amd64)
98-
system_packages+=(${generic_toolchain_packages[@]})
99-
# scons and clang are required for building the nacl loader.
100-
system_packages+=(g++-x86-64-linux-gnu binutils-multiarch nasm scons clang)
101-
;;
102-
linux-i686)
103-
system_packages+=(${generic_toolchain_packages[@]})
104-
system_packages+=(g++-i686-linux-gnu binutils-multiarch nasm)
105-
;;
106-
linux-arm64)
107-
system_packages+=(${generic_toolchain_packages[@]})
108-
system_packages+=(g++-aarch64-linux-gnu binutils-multiarch)
100+
build_vm='true'
109101
;;
110-
linux-armhf)
111-
system_packages+=(${generic_toolchain_packages[@]})
112-
system_packages+=(g++-arm-linux-gnueabihf binutils-multiarch)
102+
linux-*)
103+
build_linux='true'
113104
;;
114-
windows-amd64)
115-
system_packages+=(${generic_toolchain_packages[@]})
116-
system_packages+=(g++-mingw-w64-x86-64 nasm)
117-
alternative_pairs+=('x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix')
118-
alternative_pairs+=('x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix')
119-
;;
120-
windows-i686)
121-
system_packages+=(${generic_toolchain_packages[@]})
122-
system_packages+=(g++-mingw-w64-i686 nasm)
123-
alternative_pairs+=('i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix')
124-
alternative_pairs+=('i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix')
105+
windows-*)
106+
build_windows='true'
125107
;;
126108
macos-*)
127-
system_packages+=(gdebi-core)
109+
build_macos='true'
128110
;;
129111
esac
130112
done
131113

132-
native_packages+=("${linux_generic_av_packages[@]}")
133-
134-
for target in ${targets}
135-
do
136-
case "${target}" in
137-
'linux-'*)
138-
arch_name="${target#*-}"
114+
build_in_linux='false'
115+
build_in_darling='false'
116+
build_breakpad='false'
117+
118+
if "${build_vm}"
119+
then
120+
build_in_linux='true'
121+
build_breakpad='true'
122+
123+
system_packages+=(${generic_toolchain_packages[@]})
124+
system_packages+=(${game_toolchain_packages[@]})
125+
fi
126+
127+
if "${build_linux}"
128+
then
129+
build_in_linux='true'
130+
build_breakpad='true'
131+
132+
system_packages+=(${generic_toolchain_packages[@]})
133+
134+
# The nasm package is required to build amd64 and i686 deps.
135+
# The scons and clang packages are required for building the amd64 nacl loader.
136+
system_package+=(nasm scons clang)
137+
138+
# The no alias g++-x86-64-linux-gnu package on amd64 in Debian before
139+
# Trixie, but we install g++ and we run on amd64 so this is fine.
140+
system_packages+=(binutils-multiarch)
141+
# system_packages+=(g++-x86-64-linux-gnu)
142+
system_packages+=(g++-i686-linux-gnu)
143+
system_packages+=(g++-aarch64-linux-gnu)
144+
system_packages+=(g++-arm-linux-gnueabihf)
145+
fi
146+
147+
if "${build_windows}"
148+
then
149+
build_in_linux='true'
150+
build_breakpad='true'
151+
152+
system_packages+=(${generic_toolchain_packages[@]})
153+
154+
system_packages+=(nasm)
155+
156+
system_packages+=(g++-mingw-w64-x86-64)
157+
alternative_pairs+=('x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix')
158+
alternative_pairs+=('x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix')
159+
160+
system_packages+=(g++-mingw-w64-i686)
161+
alternative_pairs+=('i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix')
162+
alternative_pairs+=('i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix')
163+
fi
164+
165+
if "${build_macos}"
166+
then
167+
system_packages+=(gdebi-core)
168+
fi
169+
170+
if "${build_breakpad}"
171+
then
172+
# The breakpad dump_syms binaries are built with the native g++.
173+
system_packages+=(g++)
174+
fi
175+
176+
if "${build_linux}"
177+
then
178+
for arch_name in "${linux_architectures[@]}"
179+
do
139180
arch_name="${arch_name/i686/i386}"
140181

141182
_exec dpkg --add-architecture "${arch_name}"
142183

143-
for native_package in "${native_packages[@]}"
184+
for native_package in "${linux_generic_av_packages[@]}"
144185
do
145186
system_packages+=("${native_package//:native/:${arch_name}}")
146187
done
147-
;;
148-
esac
149-
done
188+
done
189+
fi
150190

151191
install_extra=(--verbose-versions --yes)
152192

@@ -159,32 +199,31 @@ do
159199
_exec update-alternatives --set ${alternative_pair}
160200
done
161201

162-
for target in ${targets}
163-
do
164-
case "${target}" in
165-
macos-*)
166-
if [ ! -f /usr/bin/darling ]
167-
then
168-
darling_url='https://github.com/darlinghq/darling/releases/download/v0.1.20220929_update_sources_11_5/darling_0.1.20220929.focal_amd64.deb'
169-
170-
_exec curl --location --output /darling.deb "${darling_url}"
171-
_exec gdebi --non-interactive /darling.deb
172-
_exec rm /darling.deb
173-
fi
174-
;;
175-
*)
176-
if [ ! -d /cmake ]
177-
then
178-
cmake_version='3.31.8'
179-
cmake_system='linux-x86_64'
180-
cmake_dir="cmake-${cmake_version}-${cmake_system}"
181-
cmake_url="https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_dir}.tar.gz"
182-
183-
_exec curl --output cmake.tgz --location "${cmake_url}"
184-
_exec tar xf cmake.tgz
185-
_exec rm cmake.tgz
186-
_exec mv "${cmake_dir}" /cmake
187-
_exec ln -s /cmake/bin/cmake /usr/local/bin/cmake
188-
fi
189-
esac
190-
done
202+
if "${build_in_darling}"
203+
then
204+
if [ ! -f /usr/bin/darling ]
205+
then
206+
darling_url='https://github.com/darlinghq/darling/releases/download/v0.1.20220929_update_sources_11_5/darling_0.1.20220929.focal_amd64.deb'
207+
208+
_exec curl --location --output /darling.deb "${darling_url}"
209+
_exec gdebi --non-interactive /darling.deb
210+
_exec rm /darling.deb
211+
fi
212+
fi
213+
214+
if "${build_in_linux}"
215+
then
216+
if [ ! -d /cmake ]
217+
then
218+
cmake_version='3.31.8'
219+
cmake_system='linux-x86_64'
220+
cmake_dir="cmake-${cmake_version}-${cmake_system}"
221+
cmake_url="https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${cmake_dir}.tar.gz"
222+
223+
_exec curl --output cmake.tgz --location "${cmake_url}"
224+
_exec tar xf cmake.tgz
225+
_exec rm cmake.tgz
226+
_exec mv "${cmake_dir}" /cmake
227+
_exec ln -s /cmake/bin/cmake /usr/local/bin/cmake
228+
fi
229+
fi

0 commit comments

Comments
 (0)