ci: Add 32-bit builds

This commit is contained in:
Ryan Pavlik 2020-04-27 17:50:56 -05:00
parent f4701c5473
commit 5b0f5196d4
5 changed files with 147 additions and 2 deletions

View file

@ -10,7 +10,7 @@ variables:
.monado.debian:buster: .monado.debian:buster:
variables: variables:
FDO_DISTRIBUTION_VERSION: buster FDO_DISTRIBUTION_VERSION: buster
FDO_DISTRIBUTION_TAG: "2019-04-28.0" FDO_DISTRIBUTION_TAG: "2019-04-28.1"
# Variables for build and usage of Debian 10 (Buster) + Android NDK image # Variables for build and usage of Debian 10 (Buster) + Android NDK image
.monado.debian:buster-ndk: .monado.debian:buster-ndk:
@ -50,7 +50,7 @@ stages:
# Each most-derived job has a script to set up stuff for it. # Each most-derived job has a script to set up stuff for it.
FDO_DISTRIBUTION_EXEC: "bash .gitlab-ci/${CI_JOB_NAME}.sh" FDO_DISTRIBUTION_EXEC: "bash .gitlab-ci/${CI_JOB_NAME}.sh"
# Debian Buster (x64) # Debian Buster (x64 + i386)
debian:container_prep: debian:container_prep:
stage: container_prep stage: container_prep
extends: extends:
@ -176,6 +176,24 @@ arch:meson:
variables: variables:
MESON_ARGS: -Ddocs=disabled MESON_ARGS: -Ddocs=disabled
# Cross-compiling
debian:meson:32bit:
extends:
- .monado.debian:buster # local
- .fdo.distribution-image@debian # from ci-templates
- .monado.build-meson # local
variables:
MESON_ARGS: --prefix /usr --libdir /usr/lib/i386-linux-gnu --cross-file ../.gitlab-ci/i386-cross.txt
debian:cmake:32bit:
extends:
- .monado.debian:buster # local
- .fdo.distribution-image@debian # from ci-templates
- .monado.build-cmake # local
variables:
# OpenCV and local OpenHMD doesn't play nicely with us in multi-arch.
CMAKE_ARGS: -DCMAKE_TOOLCHAIN_FILE=../.gitlab-ci/i386.cmake -DBUILD_WITH_OPENCV=off -DBUILD_WITH_OPENHMD=off
# Base of Android NDK builds. # Base of Android NDK builds.
# Takes the last :-delimited part of the name as the ABI to build for, # Takes the last :-delimited part of the name as the ABI to build for,
# so you don't need to do anything other than "extends" in the job # so you don't need to do anything other than "extends" in the job

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
(
cd $(dirname $0)
bash ./install-cross.sh
)
( (
cd $(dirname $0) cd $(dirname $0)
bash ./build-openxr-openhmd.sh bash ./build-openxr-openhmd.sh

17
.gitlab-ci/i386-cross.txt Normal file
View file

@ -0,0 +1,17 @@
[binaries]
c = '/usr/bin/i686-linux-gnu-gcc'
cpp = '/usr/bin/i686-linux-gnu-g++'
ar = '/usr/bin/i686-linux-gnu-ar'
strip = '/usr/bin/i686-linux-gnu-strip'
objcopy = '/usr/bin/i686-linux-gnu-objcopy'
ld= '/usr/bin/i686-linux-gnu-ld'
pkgconfig = '/usr/bin/i686-linux-gnu-pkg-config'
[properties]
needs_exe_wrapper = False
[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i386'
endian = 'little'

37
.gitlab-ci/i386.cmake Normal file
View file

@ -0,0 +1,37 @@
# Toolchain file for 32-bit x86 linux build on 64-bit x86 linux
# Developed for use with Debian and its derivatives
#
# Copyright 2019-2020 Collabora, Ltd.
# SPDX-License-Identifier: BSL-1.0
set(CMAKE_SYSTEM_NAME Linux)
set(TARGET i686-linux-gnu)
set(PREFIX ${TARGET}-)
set(SUFFIX) # required for
set(CMAKE_C_COMPILER ${PREFIX}gcc${SUFFIX})
set(CMAKE_CXX_COMPILER ${PREFIX}g++${SUFFIX})
set(CMAKE_C_COMPILER_AR ${PREFIX}gcc-ar${SUFFIX})
set(CMAKE_CXX_COMPILER_AR ${PREFIX}gcc-ar${SUFFIX})
set(CMAKE_C_COMPILER_RANLIB ${PREFIX}gcc-ranlib${SUFFIX})
set(CMAKE_CXX_COMPILER_RANLIB ${PREFIX}gcc-ranlib${SUFFIX})
set(CMAKE_NM ${PREFIX}gcc-nm${SUFFIX})
set(CMAKE_OBJCOPY ${PREFIX}objcopy)
set(CMAKE_OBJDUMP ${PREFIX}objdump)
set(CMAKE_RANLIB ${PREFIX}ranlib)
set(CMAKE_STRIP ${PREFIX}strip)
set(PKG_CONFIG_EXECUTABLE ${PREFIX}pkg-config)
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX /usr/${TARGET})
endif()
set(CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/i386-linux-gnu;/usr/lib32;/usr/${TARGET}/lib)
set(CMAKE_FIND_ROOT_PATH /usr/${TARGET})
# set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

View file

@ -0,0 +1,69 @@
#!/bin/bash
# Based on https://gitlab.freedesktop.org/mesa/mesa/-/blob/master/.gitlab-ci/container/x86_build.sh
set -e
set -o xtrace
export DEBIAN_FRONTEND=noninteractive
CROSS_ARCHITECTURES="i386"
for arch in $CROSS_ARCHITECTURES; do
dpkg --add-architecture $arch
done
apt-get update
for arch in $CROSS_ARCHITECTURES; do
# OpenCV and libuvc aren't on this list because
# they apparently can't be installed in both architectures at once
apt-get install -y --no-install-recommends --no-remove \
crossbuild-essential-${arch} \
libelf-dev:${arch} \
libavcodec-dev:${arch} \
libegl1-mesa-dev:${arch} \
libgl1-mesa-dev:${arch} \
libglvnd-dev:${arch} \
libhidapi-dev:${arch} \
libudev-dev:${arch} \
libusb-1.0-0-dev:${arch} \
libv4l-dev:${arch} \
libvulkan-dev:${arch} \
libwayland-dev:${arch} \
libx11-dev:${arch} \
libxcb-randr0-dev:${arch} \
libxrandr-dev:${arch} \
libxxf86vm-dev:${arch}
if [ "$arch" != "i386" ]; then
mkdir /var/cache/apt/archives/${arch}
apt-get install -y --no-remove \
libstdc++6:${arch}
fi
done
# for 64bit windows cross-builds
# apt-get install -y --no-remove \
# libz-mingw-w64-dev \
# mingw-w64 \
# wine \
# wine32 \
# wine64
apt-get autoremove -y --purge
apt-get clean
# Generate cross build files for Meson
for arch in $CROSS_ARCHITECTURES; do
cross_file="/cross_file-$arch.txt"
/usr/share/meson/debcrossgen --arch "$arch" -o "$cross_file"
if [ "$arch" = "i386" ]; then
# Work around a bug in debcrossgen that should be fixed in the next release
sed -i "s|cpu_family = 'i686'|cpu_family = 'x86'|g" "$cross_file"
fi
# Rely on qemu-user being configured in binfmt_misc on the host
sed -i -e '/\[properties\]/a\' -e "needs_exe_wrapper = False" "$cross_file"
done