loader: replace int/1/0 with bool/true/false
[mesa.git] / .gitlab-ci / lava-debian-install.sh
1 #!/bin/bash
2
3 set -e
4 set -o xtrace
5
6 ############### Install packages for building
7 dpkg --add-architecture ${DEBIAN_ARCH}
8 echo 'deb-src https://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/deb-src.list
9 apt-get update
10 apt-get -y install ca-certificates
11 apt-get -y install --no-install-recommends \
12 crossbuild-essential-${DEBIAN_ARCH} \
13 meson \
14 g++ \
15 git \
16 ccache \
17 pkg-config \
18 python3-mako \
19 python-numpy \
20 python-six \
21 python-mako \
22 python3-pip \
23 python3-setuptools \
24 python3-six \
25 python3-wheel \
26 python3-jinja2 \
27 bison \
28 flex \
29 gettext \
30 cmake \
31 bc \
32 libssl-dev \
33 lqa \
34 csvkit \
35 curl \
36 unzip \
37 wget \
38 debootstrap \
39 procps \
40 qemu-user-static \
41 cpio \
42 clang-8 \
43 llvm-8 \
44 libclang-8-dev \
45 llvm-8-dev \
46 gdc-9 \
47 lld-8 \
48 nasm \
49 libegl1-mesa-dev \
50 \
51 libdrm-dev:${DEBIAN_ARCH} \
52 libx11-dev:${DEBIAN_ARCH} \
53 libxxf86vm-dev:${DEBIAN_ARCH} \
54 libexpat1-dev:${DEBIAN_ARCH} \
55 libsensors-dev:${DEBIAN_ARCH} \
56 libxfixes-dev:${DEBIAN_ARCH} \
57 libxdamage-dev:${DEBIAN_ARCH} \
58 libxext-dev:${DEBIAN_ARCH} \
59 x11proto-dev:${DEBIAN_ARCH} \
60 libx11-xcb-dev:${DEBIAN_ARCH} \
61 libxcb-dri2-0-dev:${DEBIAN_ARCH} \
62 libxcb-glx0-dev:${DEBIAN_ARCH} \
63 libxcb-xfixes0-dev:${DEBIAN_ARCH} \
64 libxcb-dri3-dev:${DEBIAN_ARCH} \
65 libxcb-present-dev:${DEBIAN_ARCH} \
66 libxcb-randr0-dev:${DEBIAN_ARCH} \
67 libxcb-sync-dev:${DEBIAN_ARCH} \
68 libxrandr-dev:${DEBIAN_ARCH} \
69 libxshmfence-dev:${DEBIAN_ARCH} \
70 libelf-dev:${DEBIAN_ARCH} \
71 zlib1g-dev:${DEBIAN_ARCH} \
72 libglvnd-core-dev:${DEBIAN_ARCH} \
73 libgles2-mesa-dev:${DEBIAN_ARCH} \
74 libegl1-mesa-dev:${DEBIAN_ARCH} \
75 libpng-dev:${DEBIAN_ARCH}
76
77
78 ############### Install lavacli (remove after it's back into Debian testing)
79 mkdir -p lavacli
80 wget -qO- https://git.lavasoftware.org/lava/lavacli/-/archive/v0.9.8/lavacli-v0.9.8.tar.gz | tar -xz --strip-components=1 -C lavacli
81 pushd lavacli
82 python3 ./setup.py install
83 popd
84
85
86 ############### Cross-build dEQP
87 mkdir -p /artifacts/rootfs/deqp
88
89 git config --global user.email "mesa@example.com"
90 git config --global user.name "Mesa CI"
91 # XXX: Use --depth 1 once we can drop the cherry-picks.
92 git clone \
93 https://github.com/KhronosGroup/VK-GL-CTS.git \
94 -b opengl-es-cts-3.2.5.1 \
95 /VK-GL-CTS
96 cd /VK-GL-CTS
97 # Fix surfaceless build
98 git cherry-pick -x 22f41e5e321c6dcd8569c4dad91bce89f06b3670
99 git cherry-pick -x 1daa8dff73161ea60ead965bd6c9f2a0a2165648
100
101 # surfaceless links against libkms and such despite not using it.
102 sed -i '/gbm/d' targets/surfaceless/surfaceless.cmake
103 sed -i '/libkms/d' targets/surfaceless/surfaceless.cmake
104 sed -i '/libgbm/d' targets/surfaceless/surfaceless.cmake
105
106 python3 external/fetch_sources.py
107
108 cd /artifacts/rootfs/deqp
109 cmake -G Ninja \
110 -DDEQP_TARGET=surfaceless \
111 -DCMAKE_BUILD_TYPE=Release \
112 -DCMAKE_C_COMPILER=${GCC_ARCH}-gcc \
113 -DCMAKE_CXX_COMPILER=${GCC_ARCH}-g++ \
114 /VK-GL-CTS
115 ninja
116 rm -rf /artifacts/rootfs/deqp/external
117 rm -rf /artifacts/rootfs/deqp/modules/gles31
118 rm -rf /artifacts/rootfs/deqp/modules/internal
119 rm -rf /artifacts/rootfs/deqp/executor
120 rm -rf /artifacts/rootfs/deqp/execserver
121 rm -rf /artifacts/rootfs/deqp/modules/egl
122 rm -rf /artifacts/rootfs/deqp/framework
123 find . -name CMakeFiles | xargs rm -rf
124 find . -name lib\*.a | xargs rm -rf
125 du -sh *
126 rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
127
128
129 ############### Cross-build Volt dEQP runner
130 mkdir -p /battery
131 cd /battery
132 wget https://github.com/VoltLang/Battery/releases/download/v0.1.23/battery-0.1.23-x86_64-linux.tar.gz
133 tar xzvf battery-0.1.23-x86_64-linux.tar.gz
134 rm battery-0.1.23-x86_64-linux.tar.gz
135 mv battery /usr/local/bin
136 rm -rf /battery
137
138 mkdir -p /volt
139 cd /volt
140 mkdir -p Watt Volta dEQP
141 wget -qO- https://github.com/VoltLang/Watt/archive/v0.1.3.tar.gz | tar -xz --strip-components=1 -C ./Watt
142 wget -qO- https://github.com/VoltLang/Volta/archive/v0.1.3.tar.gz | tar -xz --strip-components=1 -C ./Volta
143 wget -qO- https://github.com/Wallbraker/dEQP/archive/v0.1.4.tar.gz | tar -xz --strip-components=1 -C ./dEQP
144 battery config --release --lto Volta Watt
145 battery build
146 battery config --arch ${VOLT_ARCH} --cmd-volta Volta/volta Volta/rt Watt dEQP
147 battery build
148 rm /usr/local/bin/battery
149 cp dEQP/deqp /artifacts/rootfs/deqp/deqp-volt
150 rm -rf /volt
151
152
153 ############### Remove LLVM now, so the container image is smaller
154 apt-get -y remove \*llvm\*
155
156
157 ############### Cross-build kernel
158 KERNEL_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.3-rc8.tar.gz"
159 export ARCH=${KERNEL_ARCH}
160 export CROSS_COMPILE="${GCC_ARCH}-"
161
162 mkdir -p /kernel
163 wget -qO- ${KERNEL_URL} | tar -xz --strip-components=1 -C /kernel
164 cd /kernel
165 ./scripts/kconfig/merge_config.sh ${DEFCONFIG} /tmp/clone/.gitlab-ci/${KERNEL_ARCH}.config
166 make -j12 ${KERNEL_IMAGE_NAME} dtbs
167 cp arch/${KERNEL_ARCH}/boot/${KERNEL_IMAGE_NAME} /artifacts/.
168 cp ${DEVICE_TREES} /artifacts/.
169 rm -rf /kernel
170
171
172 ############### Create rootfs
173 cp /tmp/clone/.gitlab-ci/create-rootfs.sh /artifacts/rootfs/.
174 mkdir -p /artifacts/rootfs/bin
175 cp /usr/bin/qemu-aarch64-static /artifacts/rootfs/bin
176 cp /usr/bin/qemu-arm-static /artifacts/rootfs/bin
177
178 set +e
179 debootstrap --variant=minbase --arch=${DEBIAN_ARCH} testing /artifacts/rootfs/ http://deb.debian.org/debian
180 cat /artifacts/rootfs/debootstrap/debootstrap.log
181 set -e
182 chroot /artifacts/rootfs sh /create-rootfs.sh
183
184 rm /artifacts/rootfs/bin/qemu-arm-static
185 rm /artifacts/rootfs/bin/qemu-aarch64-static
186 rm /artifacts/rootfs/create-rootfs.sh
187