gitlab-ci: Rename container install scripts to match job names (better)
[mesa.git] / .gitlab-ci / container / x86_build.sh
1 #!/bin/bash
2
3 set -e
4 set -o xtrace
5
6 export DEBIAN_FRONTEND=noninteractive
7
8 CROSS_ARCHITECTURES="i386"
9 for arch in $CROSS_ARCHITECTURES; do
10 dpkg --add-architecture $arch
11 done
12
13 apt-get install -y \
14 ca-certificates \
15 unzip \
16 wget
17
18 sed -i -e 's/http:\/\/deb/https:\/\/deb/g' /etc/apt/sources.list
19 echo 'deb https://deb.debian.org/debian buster-backports main' >/etc/apt/sources.list.d/backports.list
20
21 apt-get update
22
23 # Use newer packages from backports by default
24 cat >/etc/apt/preferences <<EOF
25 Package: *
26 Pin: release a=buster-backports
27 Pin-Priority: 500
28 EOF
29
30 apt-get dist-upgrade -y
31
32 apt-get install -y --no-remove \
33 autoconf \
34 automake \
35 autotools-dev \
36 bison \
37 clang-8 \
38 cmake \
39 flex \
40 g++ \
41 gcc \
42 gettext \
43 git \
44 libclang-6.0-dev \
45 libclang-7-dev \
46 libclang-8-dev \
47 libclc-dev \
48 libelf-dev \
49 libepoxy-dev \
50 libexpat1-dev \
51 libgbm-dev \
52 libgtk-3-dev \
53 libomxil-bellagio-dev \
54 libpciaccess-dev \
55 libtool \
56 libunwind-dev \
57 libva-dev \
58 libvdpau-dev \
59 libvulkan-dev \
60 libx11-dev \
61 libx11-xcb-dev \
62 libxdamage-dev \
63 libxext-dev \
64 libxrandr-dev \
65 libxrender-dev \
66 libxshmfence-dev \
67 libxvmc-dev \
68 libxxf86vm-dev \
69 llvm-6.0-dev \
70 llvm-7-dev \
71 llvm-8-dev \
72 meson \
73 pkg-config \
74 python-mako \
75 python3-mako \
76 scons \
77 x11proto-dri2-dev \
78 x11proto-gl-dev \
79 x11proto-randr-dev \
80 xz-utils \
81 zlib1g-dev
82
83 # Cross-build Mesa deps
84 for arch in $CROSS_ARCHITECTURES; do
85 apt-get install -y --no-remove \
86 crossbuild-essential-${arch} \
87 libdrm-dev:${arch} \
88 libelf-dev:${arch} \
89 libexpat1-dev:${arch}
90 done
91
92 # for 64bit windows cross-builds
93 apt-get install -y --no-remove \
94 libz-mingw-w64-dev \
95 mingw-w64 \
96 wine \
97 wine32 \
98 wine64
99
100 # Debian's pkg-config wrapers for mingw are broken, and there's no sign that
101 # they're going to be fixed, so we'll just have to fix it ourselves
102 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930492
103 cat >/usr/local/bin/x86_64-w64-mingw32-pkg-config <<EOF
104 #!/bin/sh
105
106 PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/lib/pkgconfig pkg-config \$@
107 EOF
108 chmod +x /usr/local/bin/x86_64-w64-mingw32-pkg-config
109
110 # for the vulkan overlay layer
111 wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
112 unzip glslang-master-linux-Release.zip bin/glslangValidator
113 install -m755 bin/glslangValidator /usr/local/bin/
114 rm bin/glslangValidator glslang-master-linux-Release.zip
115
116
117 # dependencies where we want a specific version
118 export XORG_RELEASES=https://xorg.freedesktop.org/releases/individual
119 export XCB_RELEASES=https://xcb.freedesktop.org/dist
120 export WAYLAND_RELEASES=https://wayland.freedesktop.org/releases
121
122 export XORGMACROS_VERSION=util-macros-1.19.0
123 export LIBDRM_VERSION=libdrm-2.4.100
124 export XCBPROTO_VERSION=xcb-proto-1.13
125 export LIBXCB_VERSION=libxcb-1.13
126 export LIBWAYLAND_VERSION=wayland-1.15.0
127 export WAYLAND_PROTOCOLS_VERSION=wayland-protocols-1.12
128
129 wget $XORG_RELEASES/util/$XORGMACROS_VERSION.tar.bz2
130 tar -xvf $XORGMACROS_VERSION.tar.bz2 && rm $XORGMACROS_VERSION.tar.bz2
131 cd $XORGMACROS_VERSION; ./configure; make install; cd ..
132 rm -rf $XORGMACROS_VERSION
133
134 wget $XCB_RELEASES/$XCBPROTO_VERSION.tar.bz2
135 tar -xvf $XCBPROTO_VERSION.tar.bz2 && rm $XCBPROTO_VERSION.tar.bz2
136 cd $XCBPROTO_VERSION; ./configure; make install; cd ..
137 rm -rf $XCBPROTO_VERSION
138
139 wget $XCB_RELEASES/$LIBXCB_VERSION.tar.bz2
140 tar -xvf $LIBXCB_VERSION.tar.bz2 && rm $LIBXCB_VERSION.tar.bz2
141 cd $LIBXCB_VERSION; ./configure; make install; cd ..
142 rm -rf $LIBXCB_VERSION
143
144 wget https://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2
145 tar -xvf $LIBDRM_VERSION.tar.bz2 && rm $LIBDRM_VERSION.tar.bz2
146 cd $LIBDRM_VERSION; meson build -D vc4=true -D freedreno=true -D etnaviv=true; ninja -j4 -C build install; cd ..
147 rm -rf $LIBDRM_VERSION
148
149 wget $WAYLAND_RELEASES/$LIBWAYLAND_VERSION.tar.xz
150 tar -xvf $LIBWAYLAND_VERSION.tar.xz && rm $LIBWAYLAND_VERSION.tar.xz
151 cd $LIBWAYLAND_VERSION; ./configure --enable-libraries --without-host-scanner --disable-documentation --disable-dtd-validation; make install; cd ..
152 rm -rf $LIBWAYLAND_VERSION
153
154 wget $WAYLAND_RELEASES/$WAYLAND_PROTOCOLS_VERSION.tar.xz
155 tar -xvf $WAYLAND_PROTOCOLS_VERSION.tar.xz && rm $WAYLAND_PROTOCOLS_VERSION.tar.xz
156 cd $WAYLAND_PROTOCOLS_VERSION; ./configure; make install; cd ..
157 rm -rf $WAYLAND_PROTOCOLS_VERSION
158
159
160 # The version of libglvnd-dev in debian is too old
161 # Check this page to see when this local compilation can be dropped in favour of the package:
162 # https://packages.debian.org/libglvnd-dev
163 GLVND_VERSION=1.2.0
164 wget https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v$GLVND_VERSION/libglvnd-v$GLVND_VERSION.tar.gz
165 tar -xvf libglvnd-v$GLVND_VERSION.tar.gz && rm libglvnd-v$GLVND_VERSION.tar.gz
166 pushd libglvnd-v$GLVND_VERSION; ./autogen.sh; ./configure; make install; popd
167 rm -rf libglvnd-v$GLVND_VERSION
168
169
170 pushd /usr/local
171 git clone https://gitlab.freedesktop.org/mesa/shader-db.git --depth 1
172 rm -rf shader-db/.git
173 cd shader-db
174 make
175 popd
176
177 # Use ccache to speed up builds
178 apt-get install -y --no-remove ccache
179
180 # We need xmllint to validate the XML files in Mesa
181 apt-get install -y --no-remove libxml2-utils
182
183
184 # Generate cross build files for Meson
185 for arch in $CROSS_ARCHITECTURES; do
186 cross_file="/cross_file-$arch.txt"
187 /usr/share/meson/debcrossgen --arch "$arch" -o "$cross_file"
188 # Explicitly set ccache path for cross compilers
189 sed -i "s|/usr/bin/\([^-]*\)-linux-gnu\([^-]*\)-g|/usr/lib/ccache/\\1-linux-gnu\\2-g|g" "$cross_file"
190 if [ "$arch" = "i386" ]; then
191 # Work around a bug in debcrossgen that should be fixed in the next release
192 sed -i "s|cpu_family = 'i686'|cpu_family = 'x86'|g" "$cross_file"
193 # Don't need wrapper for i386 executables
194 sed -i -e '/\[properties\]/a\' -e "needs_exe_wrapper = False" "$cross_file"
195 fi
196 done
197
198
199 ############### Uninstall the build software
200
201 apt-get purge -y \
202 autoconf \
203 automake \
204 autotools-dev \
205 cmake \
206 git \
207 libgbm-dev \
208 libtool \
209 unzip \
210 wget
211
212 apt-get autoremove -y --purge