@@ -28,6 +28,10 @@ source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
28
28
29
29
export DEBIAN_FRONTEND=' noninteractive'
30
30
31
+ linux_architectures=(amd64 i686 arm64 armhf)
32
+ windows_architectures=(amd64 i686)
33
+ macos_architectures=(amd64)
34
+
31
35
# TODO: Remove scons and python3 onces the NaCl loader builds with CMake.
32
36
# TODO: Remove clang onces the NaCl loader builds with GCC.
33
37
# TODO: Remove unzip onces the NaCl loader archive uses another format than zip.
@@ -43,12 +47,9 @@ system_packages=(
43
47
)
44
48
45
49
# 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++.
48
50
# We removed the cmake package as it is installed from tarball.
49
51
generic_toolchain_packages=(
50
52
autoconf
51
- g++
52
53
libtool
53
54
make
54
55
pkg-config
@@ -87,66 +88,105 @@ linux_generic_av_packages=(
87
88
88
89
declare -a alternative_pairs
89
90
91
+ build_vm=' false'
92
+ build_linux=' false'
93
+ build_windows=' false'
94
+ build_macos=' false'
95
+
90
96
for target in ${targets}
91
97
do
92
98
case " ${target} " in
93
99
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'
109
101
;;
110
- linux-armhf)
111
- system_packages+=(${generic_toolchain_packages[@]} )
112
- system_packages+=(g++-arm-linux-gnueabihf binutils-multiarch)
102
+ linux-* )
103
+ build_linux=' true'
113
104
;;
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'
125
107
;;
126
108
macos-* )
127
- system_packages+=(gdebi-core)
109
+ build_macos= ' true '
128
110
;;
129
111
esac
130
112
done
131
113
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
139
180
arch_name=" ${arch_name/ i686/ i386} "
140
181
141
182
_exec dpkg --add-architecture " ${arch_name} "
142
183
143
- for native_package in " ${native_packages [@]} "
184
+ for native_package in " ${linux_generic_av_packages [@]} "
144
185
do
145
186
system_packages+=(" ${native_package//: native/: ${arch_name} } " )
146
187
done
147
- ;;
148
- esac
149
- done
188
+ done
189
+ fi
150
190
151
191
install_extra=(--verbose-versions --yes)
152
192
159
199
_exec update-alternatives --set ${alternative_pair}
160
200
done
161
201
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