• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2# shellcheck disable=SC2086 # we want word splitting
3
4set -e
5set -o xtrace
6
7export DEBIAN_FRONTEND=noninteractive
8export LLVM_VERSION="${LLVM_VERSION:=15}"
9
10# Ephemeral packages (installed for this script and removed again at the end)
11EPHEMERAL=(
12)
13
14DEPS=(
15    "crossbuild-essential-$arch"
16    "pkgconf:$arch"
17    "libasan8:$arch"
18    "libdrm-dev:$arch"
19    "libelf-dev:$arch"
20    "libexpat1-dev:$arch"
21    "libffi-dev:$arch"
22    "libpciaccess-dev:$arch"
23    "libstdc++6:$arch"
24    "libvulkan-dev:$arch"
25    "libx11-dev:$arch"
26    "libx11-xcb-dev:$arch"
27    "libxcb-dri2-0-dev:$arch"
28    "libxcb-dri3-dev:$arch"
29    "libxcb-glx0-dev:$arch"
30    "libxcb-present-dev:$arch"
31    "libxcb-randr0-dev:$arch"
32    "libxcb-shm0-dev:$arch"
33    "libxcb-xfixes0-dev:$arch"
34    "libxdamage-dev:$arch"
35    "libxext-dev:$arch"
36    "libxrandr-dev:$arch"
37    "libxshmfence-dev:$arch"
38    "libxxf86vm-dev:$arch"
39    "libwayland-dev:$arch"
40)
41
42dpkg --add-architecture $arch
43
44echo "deb [trusted=yes] https://gitlab.freedesktop.org/gfx-ci/ci-deb-repo/-/raw/${PKG_REPO_REV}/ ${FDO_DISTRIBUTION_VERSION%-*} main" | tee /etc/apt/sources.list.d/gfx-ci_.list
45
46apt-get update
47
48apt-get install -y --no-remove "${DEPS[@]}" "${EPHEMERAL[@]}" \
49    $EXTRA_LOCAL_PACKAGES
50
51if [[ $arch != "armhf" ]]; then
52    # We don't need clang-format for the crossbuilds, but the installed amd64
53    # package will conflict with libclang. Uninstall clang-format (and its
54    # problematic dependency) to fix.
55    apt-get remove -y "clang-format-${LLVM_VERSION}" "libclang-cpp${LLVM_VERSION}" \
56            "llvm-${LLVM_VERSION}-runtime" "llvm-${LLVM_VERSION}-linker-tools"
57
58    # llvm-*-tools:$arch conflicts with python3:amd64. Install dependencies only
59    # with apt-get, then force-install llvm-*-{dev,tools}:$arch with dpkg to get
60    # around this.
61    apt-get install -y --no-remove --no-install-recommends \
62            "libclang-cpp${LLVM_VERSION}:$arch" \
63            "libgcc-s1:$arch" \
64            "libtinfo-dev:$arch" \
65            "libz3-dev:$arch" \
66            "llvm-${LLVM_VERSION}:$arch" \
67            zlib1g
68fi
69
70. .gitlab-ci/container/create-cross-file.sh $arch
71
72
73. .gitlab-ci/container/container_pre_build.sh
74
75
76# dependencies where we want a specific version
77MULTIARCH_PATH=$(dpkg-architecture -A $arch -qDEB_TARGET_MULTIARCH)
78export EXTRA_MESON_ARGS="--cross-file=/cross_file-${arch}.txt -D libdir=lib/${MULTIARCH_PATH}"
79. .gitlab-ci/container/build-wayland.sh
80
81. .gitlab-ci/container/build-directx-headers.sh
82
83apt-get purge -y "${EPHEMERAL[@]}"
84
85. .gitlab-ci/container/container_post_build.sh
86
87# This needs to be done after container_post_build.sh, or apt-get breaks in there
88if [[ $arch != "armhf" ]]; then
89    apt-get download llvm-"${LLVM_VERSION}"-{dev,tools}:"$arch"
90    dpkg -i --force-depends llvm-"${LLVM_VERSION}"-*_"${arch}".deb
91    rm llvm-"${LLVM_VERSION}"-*_"${arch}".deb
92fi
93