Mesa (master): gitlab-ci: Use separate docker images for cross builds

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 2 18:41:14 UTC 2020


Module: Mesa
Branch: master
Commit: 3acd5a68a4fb324908674a73d1bf9ccec98da316
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3acd5a68a4fb324908674a73d1bf9ccec98da316

Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Mon Jun  1 19:08:30 2020 +0200

gitlab-ci: Use separate docker images for cross builds

Using x86_build-base as a separate base layer as well for storage &
network bandwidth efficiency.

Using separate images allows dropping the workarounds from the cross
build job scripts.

Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5296>

---

 .gitlab-ci.yml                         | 65 +++++++++++++++++++++++++++-------
 .gitlab-ci/container/cross_build.sh    | 50 ++++++++++++++++++++++++++
 .gitlab-ci/container/i386_build.sh     |  5 +++
 .gitlab-ci/container/ppc64el_build.sh  |  8 +++++
 .gitlab-ci/container/s390x_build.sh    |  5 +++
 .gitlab-ci/container/x86_build-base.sh | 41 +--------------------
 .gitlab-ci/container/x86_build.sh      | 13 +++++--
 7 files changed, 131 insertions(+), 56 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cf6b386f94f..31c9bd7d4a9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -137,7 +137,7 @@ x86_build-base:
     - .fdo.container-build at debian
     - .container
   variables:
-    FDO_DISTRIBUTION_TAG: &x86_build-base "2020-06-01"
+    FDO_DISTRIBUTION_TAG: &x86_build-base "2020-06-02"
 
 .use-x86_build-base:
   extends:
@@ -155,7 +155,7 @@ x86_build:
   extends:
     - .use-x86_build-base
   variables:
-    FDO_DISTRIBUTION_TAG: &x86_build "2020-06-01"
+    FDO_DISTRIBUTION_TAG: &x86_build "2020-06-02"
 
 .use-x86_build:
   variables:
@@ -165,6 +165,51 @@ x86_build:
     - x86_build-base
     - x86_build
 
+# Debian 10 based i386 cross-build image
+i386_build:
+  extends:
+    - .use-x86_build-base
+  variables:
+    FDO_DISTRIBUTION_TAG: &i386_build "2020-06-02"
+
+.use-i386_build:
+  variables:
+    TAG: *i386_build
+  image: "$CI_REGISTRY_IMAGE/debian/i386_build:$TAG"
+  needs:
+    - x86_build-base
+    - i386_build
+
+# Debian 10 based ppc64el cross-build image
+ppc64el_build:
+  extends:
+    - .use-x86_build-base
+  variables:
+    FDO_DISTRIBUTION_TAG: &ppc64el_build "2020-06-02"
+
+.use-ppc64el_build:
+  variables:
+    TAG: *ppc64el_build
+  image: "$CI_REGISTRY_IMAGE/debian/ppc64el_build:$TAG"
+  needs:
+    - x86_build-base
+    - ppc64el_build
+
+# Debian 10 based s390x cross-build image
+s390x_build:
+  extends:
+    - .use-x86_build-base
+  variables:
+    FDO_DISTRIBUTION_TAG: &s390x_build "2020-06-02"
+
+.use-s390x_build:
+  variables:
+    TAG: *s390x_build
+  image: "$CI_REGISTRY_IMAGE/debian/s390x_build:$TAG"
+  needs:
+    - x86_build-base
+    - s390x_build
+
 # Debian 10 based x86 test image base
 x86_test-base:
   extends: x86_build-base
@@ -564,7 +609,9 @@ meson-vulkan:
       -D werror=true
 
 meson-i386:
-  extends: .meson-cross
+  extends:
+    - .meson-cross
+    - .use-i386_build
   variables:
     CROSS: i386
     VULKAN_DRIVERS: intel,amd
@@ -572,13 +619,11 @@ meson-i386:
     EXTRA_OPTION: >
       -D vulkan-overlay-layer=true
       -D werror=true
-  script:
-    - dpkg -i /var/cache/apt/archives/$CROSS/*.deb
-    - .gitlab-ci/meson-build.sh
 
 meson-s390x:
   extends:
     - .meson-cross
+    - .use-s390x_build
   tags:
     - kvm
   variables:
@@ -586,17 +631,11 @@ meson-s390x:
     EXTRA_OPTION: >
       -D werror=true
     GALLIUM_DRIVERS: "swrast"
-  script:
-    # For unknown reasons "too many" installed i386 libraries cause qemu to
-    # crash while executing llvm-config for s390x.
-    - apt-get purge -y wine32-development
-    - apt-get autoremove -y --purge
-    - dpkg -i /var/cache/apt/archives/$CROSS/*.deb
-    - .gitlab-ci/meson-build.sh
 
 meson-ppc64el:
   extends:
     - meson-s390x
+    - .use-ppc64el_build
   variables:
     CROSS: ppc64el
     EXTRA_OPTION: ""
diff --git a/.gitlab-ci/container/cross_build.sh b/.gitlab-ci/container/cross_build.sh
new file mode 100644
index 00000000000..58f449f7cf5
--- /dev/null
+++ b/.gitlab-ci/container/cross_build.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+set -e
+set -o xtrace
+
+export DEBIAN_FRONTEND=noninteractive
+
+# Ephemeral packages (installed for this script and removed again at the end)
+STABLE_EPHEMERAL=" \
+        libpciaccess-dev:$arch \
+        wget \
+        "
+
+dpkg --add-architecture $arch
+apt-get update
+
+apt-get install -y --no-remove \
+        $STABLE_EPHEMERAL \
+        crossbuild-essential-$arch \
+        libelf-dev:$arch \
+        libexpat1-dev:$arch \
+        libffi-dev:$arch \
+        libstdc++6:$arch \
+        libtinfo-dev:$arch
+
+apt-get install -y --no-remove -t buster-backports \
+        llvm-8-dev:$arch
+
+. .gitlab-ci/create-cross-file.sh $arch
+
+
+. .gitlab-ci/container/container_pre_build.sh
+
+
+# dependencies where we want a specific version
+export LIBDRM_VERSION=libdrm-2.4.100
+
+wget https://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2
+tar -xvf $LIBDRM_VERSION.tar.bz2 && rm $LIBDRM_VERSION.tar.bz2
+cd $LIBDRM_VERSION
+meson --cross-file=/cross_file-${arch}.txt build -D libdir=lib/$(dpkg-architecture -A $arch -qDEB_TARGET_MULTIARCH)
+ninja -C build install
+cd ..
+rm -rf $LIBDRM_VERSION
+
+
+apt-get purge -y \
+        $STABLE_EPHEMERAL
+
+. .gitlab-ci/container/container_post_build.sh
diff --git a/.gitlab-ci/container/i386_build.sh b/.gitlab-ci/container/i386_build.sh
new file mode 100644
index 00000000000..404fe9cac1b
--- /dev/null
+++ b/.gitlab-ci/container/i386_build.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+arch=i386
+
+. .gitlab-ci/container/cross_build.sh
diff --git a/.gitlab-ci/container/ppc64el_build.sh b/.gitlab-ci/container/ppc64el_build.sh
new file mode 100644
index 00000000000..3519192e8ea
--- /dev/null
+++ b/.gitlab-ci/container/ppc64el_build.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+arch=ppc64el
+
+. .gitlab-ci/container/cross_build.sh
+
+apt-get install -y --no-remove \
+        libvulkan-dev:$arch
diff --git a/.gitlab-ci/container/s390x_build.sh b/.gitlab-ci/container/s390x_build.sh
new file mode 100644
index 00000000000..38ca850c582
--- /dev/null
+++ b/.gitlab-ci/container/s390x_build.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+arch=s390x
+
+. .gitlab-ci/container/cross_build.sh
diff --git a/.gitlab-ci/container/x86_build-base.sh b/.gitlab-ci/container/x86_build-base.sh
index dd698fc74cd..2350aca8843 100644
--- a/.gitlab-ci/container/x86_build-base.sh
+++ b/.gitlab-ci/container/x86_build-base.sh
@@ -5,11 +5,6 @@ set -o xtrace
 
 export DEBIAN_FRONTEND=noninteractive
 
-CROSS_ARCHITECTURES="i386 ppc64el s390x"
-for arch in $CROSS_ARCHITECTURES; do
-    dpkg --add-architecture $arch
-done
-
 apt-get install -y \
         ca-certificates \
         gnupg \
@@ -30,6 +25,7 @@ apt-get install -y --no-remove \
         bison \
         ccache \
         clang-9 \
+        dpkg-cross \
         flex \
         g++ \
         g++-mingw-w64-x86-64 \
@@ -37,19 +33,16 @@ apt-get install -y --no-remove \
         gettext \
         libclang-9-dev \
         libclc-dev \
-        libdrm-dev:s390x \
         libelf-dev \
         libepoxy-dev \
         libexpat1-dev \
         libgtk-3-dev \
         libomxil-bellagio-dev \
         libpciaccess-dev \
-        libpciaccess-dev:i386 \
         libunwind-dev \
         libva-dev \
         libvdpau-dev \
         libvulkan-dev \
-        libvulkan-dev:ppc64el \
         libx11-dev \
         libx11-xcb-dev \
         libxdamage-dev \
@@ -69,8 +62,6 @@ apt-get install -y --no-remove \
         python3-requests \
         qemu-user \
         scons \
-        wine-development \
-        wine32-development \
         wine64-development \
         x11proto-dri2-dev \
         x11proto-gl-dev \
@@ -83,36 +74,6 @@ apt-get install -y --no-remove -t buster-backports \
         libllvm8 \
         meson
 
-# Cross-build Mesa deps
-for arch in $CROSS_ARCHITECTURES; do
-    apt-get install -y --no-remove \
-            crossbuild-essential-${arch} \
-            libelf-dev:${arch} \
-            libexpat1-dev:${arch} \
-            libffi-dev:${arch} \
-            libstdc++6:${arch} \
-            libtinfo-dev:${arch}
-
-    apt-get install -y --no-remove -t buster-backports \
-            libllvm8:${arch}
-
-    mkdir /var/cache/apt/archives/${arch}
-    # Download llvm-* packages, but don't install them yet, since they can
-    # only be installed for one architecture at a time
-    apt-get install -o Dir::Cache::archives=/var/cache/apt/archives/$arch --download-only \
-            -y --no-remove -t buster-backports \
-            llvm-8-dev:${arch}
-done
-
-apt-get install -y --no-remove -t buster-backports \
-        llvm-8-dev
-
-
-# Generate cross build files for Meson
-for arch in $CROSS_ARCHITECTURES; do
-    . .gitlab-ci/create-cross-file.sh $arch
-done
-
 
 # for the vulkan overlay layer
 wget https://github.com/KhronosGroup/glslang/releases/download/master-tot/glslang-master-linux-Release.zip
diff --git a/.gitlab-ci/container/x86_build.sh b/.gitlab-ci/container/x86_build.sh
index f286748939e..562bde8a6b9 100644
--- a/.gitlab-ci/container/x86_build.sh
+++ b/.gitlab-ci/container/x86_build.sh
@@ -21,8 +21,17 @@ STABLE_EPHEMERAL=" \
       wget \
       "
 
+# We need multiarch for Wine
+dpkg --add-architecture i386
+apt-get update
+
 apt-get install -y --no-remove \
-      $STABLE_EPHEMERAL
+      $STABLE_EPHEMERAL \
+      wine-development \
+      wine32-development
+
+apt-get install -y --no-remove -t buster-backports \
+      llvm-8-dev
 
 
 . .gitlab-ci/container/container_pre_build.sh
@@ -70,8 +79,6 @@ wget https://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2
 tar -xvf $LIBDRM_VERSION.tar.bz2 && rm $LIBDRM_VERSION.tar.bz2
 cd $LIBDRM_VERSION
 meson build -D vc4=true -D freedreno=true -D etnaviv=true -D libdir=lib/x86_64-linux-gnu; ninja -C build install
-rm -rf build; meson --cross-file=/cross_file-ppc64el.txt build -D libdir=lib/powerpc64le-linux-gnu; ninja -C build install
-rm -rf build; meson --cross-file=/cross_file-i386.txt build -D libdir=lib/i386-linux-gnu; ninja -C build install
 cd ..
 rm -rf $LIBDRM_VERSION
 



More information about the mesa-commit mailing list