6 export DEBIAN_FRONTEND
=noninteractive
8 CROSS_ARCHITECTURES
="i386 ppc64el s390x"
9 for arch
in $CROSS_ARCHITECTURES; do
10 dpkg
--add-architecture $arch
19 # Upstream LLVM package repository
20 apt-key add .gitlab-ci
/container
/llvm-snapshot.gpg.key
21 echo "deb https://apt.llvm.org/buster/ llvm-toolchain-buster-9 main" >/etc
/apt
/sources.list.d
/llvm9.list
23 sed -i -e 's/http:\/\/deb/https:\/\/deb/g' /etc
/apt
/sources.list
24 echo 'deb https://deb.debian.org/debian buster-backports main' >/etc
/apt
/sources.list.d
/backports.list
28 # Use newer packages from backports by default
29 cat >/etc
/apt
/preferences
<<EOF
31 Pin: release a=buster-backports
35 apt-get dist-upgrade
-y
37 apt-get
install -y --no-remove \
60 libomxil-bellagio-dev \
91 # Cross-build Mesa deps
92 for arch
in $CROSS_ARCHITECTURES; do
93 apt-get
install -y --no-remove \
94 crossbuild-essential-
${arch} \
99 if [ "$arch" = "s390x" ]; then
105 if [ "$arch" != "i386" ]; then
106 mkdir
/var
/cache
/apt
/archives
/${arch}
107 apt-get
install -y --no-remove \
109 libllvm
${LLVM_VERSION}:${arch} \
111 libtinfo-dev
:${arch} \
113 # Download llvm-* packages, but don't install them yet, since they can
114 # only be installed for one architecture at a time
115 apt-get
install -o Dir
::Cache
::archives
=/var
/cache
/apt
/archives
/$arch --download-only -y --no-remove \
116 llvm-
${LLVM_VERSION}-dev:${arch}
120 apt-get
install -y --no-remove \
124 # for 64bit windows cross-builds
125 apt-get
install -y --no-remove \
132 # Debian's pkg-config wrapers for mingw are broken, and there's no sign that
133 # they're going to be fixed, so we'll just have to fix it ourselves
134 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930492
135 cat >/usr
/local
/bin
/x86_64-w64-mingw32-pkg-config
<<EOF
138 PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/lib/pkgconfig pkg-config \$@
140 chmod +x
/usr
/local
/bin
/x86_64-w64-mingw32-pkg-config
142 # for the vulkan overlay layer
143 wget https
://github.com
/KhronosGroup
/glslang
/releases
/download
/master-tot
/glslang-master-linux-Release.
zip
144 unzip glslang-master-linux-Release.
zip bin
/glslangValidator
145 install -m755 bin
/glslangValidator
/usr
/local
/bin
/
146 rm bin
/glslangValidator glslang-master-linux-Release.
zip
149 # dependencies where we want a specific version
150 export XORG_RELEASES
=https
://xorg.freedesktop.org
/releases
/individual
151 export XCB_RELEASES
=https
://xcb.freedesktop.org
/dist
152 export WAYLAND_RELEASES
=https
://wayland.freedesktop.org
/releases
154 export XORGMACROS_VERSION
=util-macros-1.19
.0
155 export LIBDRM_VERSION
=libdrm-2.4
.100
156 export XCBPROTO_VERSION
=xcb-proto-1.13
157 export LIBXCB_VERSION
=libxcb-1.13
158 export LIBWAYLAND_VERSION
=wayland-1.15
.0
159 export WAYLAND_PROTOCOLS_VERSION
=wayland-protocols-1.12
161 wget
$XORG_RELEASES/util
/$XORGMACROS_VERSION.
tar.bz2
162 tar -xvf $XORGMACROS_VERSION.
tar.bz2
&& rm $XORGMACROS_VERSION.
tar.bz2
163 cd $XORGMACROS_VERSION; .
/configure
; make -j4 install; cd ..
164 rm -rf $XORGMACROS_VERSION
166 wget
$XCB_RELEASES/$XCBPROTO_VERSION.
tar.bz2
167 tar -xvf $XCBPROTO_VERSION.
tar.bz2
&& rm $XCBPROTO_VERSION.
tar.bz2
168 cd $XCBPROTO_VERSION; .
/configure
; make -j4 install; cd ..
169 rm -rf $XCBPROTO_VERSION
171 wget
$XCB_RELEASES/$LIBXCB_VERSION.
tar.bz2
172 tar -xvf $LIBXCB_VERSION.
tar.bz2
&& rm $LIBXCB_VERSION.
tar.bz2
173 cd $LIBXCB_VERSION; .
/configure
; make -j4 install; cd ..
174 rm -rf $LIBXCB_VERSION
176 wget https
://dri.freedesktop.org
/libdrm
/$LIBDRM_VERSION.
tar.bz2
177 tar -xvf $LIBDRM_VERSION.
tar.bz2
&& rm $LIBDRM_VERSION.
tar.bz2
178 cd $LIBDRM_VERSION; meson build
-D vc4
=true
-D freedreno
=true
-D etnaviv
=true
; ninja
-j4 -C build
install; cd ..
179 rm -rf $LIBDRM_VERSION
181 wget
$WAYLAND_RELEASES/$LIBWAYLAND_VERSION.
tar.xz
182 tar -xvf $LIBWAYLAND_VERSION.
tar.xz
&& rm $LIBWAYLAND_VERSION.
tar.xz
183 cd $LIBWAYLAND_VERSION; .
/configure
--enable-libraries --without-host-scanner --disable-documentation --disable-dtd-validation; make -j4 install; cd ..
184 rm -rf $LIBWAYLAND_VERSION
186 wget
$WAYLAND_RELEASES/$WAYLAND_PROTOCOLS_VERSION.
tar.xz
187 tar -xvf $WAYLAND_PROTOCOLS_VERSION.
tar.xz
&& rm $WAYLAND_PROTOCOLS_VERSION.
tar.xz
188 cd $WAYLAND_PROTOCOLS_VERSION; .
/configure
; make -j4 install; cd ..
189 rm -rf $WAYLAND_PROTOCOLS_VERSION
192 # The version of libglvnd-dev in debian is too old
193 # Check this page to see when this local compilation can be dropped in favour of the package:
194 # https://packages.debian.org/libglvnd-dev
196 wget https
://gitlab.freedesktop.org
/glvnd
/libglvnd
/-/archive
/v
$GLVND_VERSION/libglvnd-v
$GLVND_VERSION.
tar.gz
197 tar -xvf libglvnd-v
$GLVND_VERSION.
tar.gz
&& rm libglvnd-v
$GLVND_VERSION.
tar.gz
198 pushd libglvnd-v
$GLVND_VERSION; .
/autogen.sh
; .
/configure
; make -j4 install; popd
199 rm -rf libglvnd-v
$GLVND_VERSION
203 git clone https
://gitlab.freedesktop.org
/mesa
/shader-db.git
--depth 1
204 rm -rf shader-db
/.git
210 # Generate cross build files for Meson
211 for arch
in $CROSS_ARCHITECTURES; do
212 cross_file
="/cross_file-$arch.txt"
213 /usr
/share
/meson
/debcrossgen
--arch "$arch" -o "$cross_file"
214 # Explicitly set ccache path for cross compilers
215 sed -i "s|/usr/bin/\([^-]*\)-linux-gnu\([^-]*\)-g|/usr/lib/ccache/\\1-linux-gnu\\2-g|g" "$cross_file"
216 if [ "$arch" = "i386" ]; then
217 # Work around a bug in debcrossgen that should be fixed in the next release
218 sed -i "s|cpu_family = 'i686'|cpu_family = 'x86'|g" "$cross_file"
221 # Rely on qemu-user being configured in binfmt_misc on the host
222 sed -i -e '/\[properties\]/a\' -e "needs_exe_wrapper = False" "$cross_file"
226 # Remove ccache directory, useless for the build jobs
227 rm -rf $(ccache --get-config=cache_dir)
230 ############### Uninstall the build software
244 apt-get autoremove -y --purge