summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2019-04-23 17:59:29 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2021-04-24 19:43:00 +0100
commitd3933a24d1abdcb56f45e6076cb84a1110674a8a (patch)
tree39ab03c3dbda1c48e3267017da084dfe943b9f09 /.gitlab-ci
parent7e142cb2a848acb6af986fa91d254d4c23963b24 (diff)
CI: Add an x86 MinGW-w64 cross build
Only cross-build for x86 MinGW-w64, as x64 MinGW-w64 will probably require fixing LLP64 issues. I don't know any source for pre-built cross-dependencies of the X server, so build these from git. Don't build with GLX enabled, so I don't have to deal with cross-building mesa and it's dependencies, for the moment.
Diffstat (limited to '.gitlab-ci')
-rw-r--r--.gitlab-ci/cross-i686-w64-mingw32.txt20
-rwxr-xr-x.gitlab-ci/cross-prereqs-build.sh79
-rw-r--r--.gitlab-ci/debian-install.sh6
3 files changed, 105 insertions, 0 deletions
diff --git a/.gitlab-ci/cross-i686-w64-mingw32.txt b/.gitlab-ci/cross-i686-w64-mingw32.txt
new file mode 100644
index 000000000..1c04f6547
--- /dev/null
+++ b/.gitlab-ci/cross-i686-w64-mingw32.txt
@@ -0,0 +1,20 @@
+[binaries]
+c = 'i686-w64-mingw32-gcc'
+cpp = 'i686-w64-mingw32-g++'
+ar = 'i686-w64-mingw32-ar'
+strip = 'i686-w64-mingw32-strip'
+pkgconfig = '/usr/local/bin/i686-w64-mingw32-pkg-config'
+windres = 'i686-w64-mingw32-windres'
+exe_wrapper = 'wine'
+
+[properties]
+# Directory that contains 'bin', 'lib', etc for the toolchain
+root = '/usr/i686-w64-mingw32'
+# Directory that contains 'bin', 'lib', etc which have been cross-compiled
+sys_root = '/usr/i686-w64-mingw32'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'
diff --git a/.gitlab-ci/cross-prereqs-build.sh b/.gitlab-ci/cross-prereqs-build.sh
new file mode 100755
index 000000000..3decf707b
--- /dev/null
+++ b/.gitlab-ci/cross-prereqs-build.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+set -e
+set -o xtrace
+
+HOST=$1
+
+# Debian's cross-pkg-config wrappers are broken for MinGW targets, since
+# dpkg-architecture doesn't know about MinGW target triplets.
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=930492
+cat >/usr/local/bin/${HOST}-pkg-config <<EOF
+#!/bin/sh
+
+PKG_CONFIG_SYSROOT_DIR=/usr/${HOST} PKG_CONFIG_LIBDIR=/usr/${HOST}/lib/pkgconfig:/usr/share/pkgconfig pkg-config \$@
+EOF
+chmod +x /usr/local/bin/${HOST}-pkg-config
+
+# when cross-compiling, some autoconf tests cannot be run:
+
+# --enable-malloc0returnsnull
+export xorg_cv_malloc0_returns_null=yes
+
+build() {
+ url=$1
+ commit=$2
+ config=$3
+
+ name=$(basename ${url} .git)
+
+ if [[ $commit =~ ^[[:xdigit:]]{1,}$ ]]
+ then
+ git clone ${url} ${name}
+ git -C ${name} checkout ${commit}
+ else
+ git clone --depth 1 --branch ${commit:-master} --recurse-submodules -c advice.detachedHead=false ${url} ${name}
+ fi
+
+ pushd ${name}
+ NOCONFIGURE=1 ./autogen.sh || ./.bootstrap
+ ./configure ${config} --host=${HOST} --prefix= --with-sysroot=/usr/${HOST}/
+ make -j$(nproc)
+ DESTDIR=/usr/${HOST} make install
+
+ popd
+ rm -rf ${OLDPWD}
+}
+
+build 'https://gitlab.freedesktop.org/pixman/pixman.git' 'pixman-0.38.4'
+build 'https://gitlab.freedesktop.org/xorg/lib/pthread-stubs.git' '0.4'
+# we can't use the xorgproto pkgconfig files from /usr/share/pkgconfig, because
+# these would add -I/usr/include to CFLAGS, which breaks cross-compilation
+build 'https://gitlab.freedesktop.org/xorg/proto/xorgproto.git' 'xorgproto-2019.1' '--datadir=/lib'
+build 'https://gitlab.freedesktop.org/xorg/lib/libXau.git' 'libXau-1.0.9'
+build 'https://gitlab.freedesktop.org/xorg/proto/xcbproto.git' 'xcb-proto-1.14'
+build 'https://gitlab.freedesktop.org/xorg/lib/libxcb.git' 'libxcb-1.14'
+build 'https://gitlab.freedesktop.org/xorg/lib/libxtrans.git' 'xtrans-1.4.0'
+# the default value of keysymdefdir is taken from the includedir variable for
+# xproto, which isn't adjusted by pkg-config for the sysroot
+build 'https://gitlab.freedesktop.org/xorg/lib/libX11.git' 'libX11-1.6.9' "--with-keysymdefdir=/usr/${HOST}/include/X11"
+build 'https://gitlab.freedesktop.org/xorg/lib/libxkbfile.git' 'libxkbfile-1.1.0'
+# freetype needs an explicit --build to know it's cross-compiling
+# disable png as freetype tries to use libpng-config, even when cross-compiling
+build 'git://git.savannah.gnu.org/freetype/freetype2.git' 'VER-2-10-1' "--build=$(cc -dumpmachine) --with-png=no"
+build 'https://gitlab.freedesktop.org/xorg//font/util.git' 'font-util-1.3.2'
+build 'https://gitlab.freedesktop.org/xorg/lib/libfontenc.git' 'libfontenc-1.1.4'
+build 'https://gitlab.freedesktop.org/xorg/lib/libXfont.git' 'libXfont2-2.0.3'
+build 'https://gitlab.freedesktop.org/xorg/lib/libXdmcp.git' 'libXdmcp-1.1.3'
+build 'https://gitlab.freedesktop.org/xorg/lib/libXfixes.git' 'libXfixes-5.0.3'
+build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git' '0.4.0'
+build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git' '0.4.0'
+build 'https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git' '0.4.1'
+
+# workaround xcb_windefs.h leaking all Windows API types into X server build
+# (some of which clash which types defined by Xmd.h) XXX: This is a bit of a
+# hack, as it makes this header depend on xorgproto. Maybe an upstreamable
+# fix would involve a macro defined in the X server (XFree86Server?
+# XCB_NO_WINAPI?), which makes xcb_windefs.h wrap things like XWinsock.h
+# does???
+sed -i s#winsock2#X11/Xwinsock# /usr/${HOST}/include/xcb/xcb_windefs.h
diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh
index cd32acba7..60d76c831 100644
--- a/.gitlab-ci/debian-install.sh
+++ b/.gitlab-ci/debian-install.sh
@@ -25,7 +25,9 @@ apt-get install -y \
build-essential \
ca-certificates \
ccache \
+ dpkg-dev \
flex \
+ gcc-mingw-w64-i686 \
git \
libaudit-dev \
libbsd-dev \
@@ -87,8 +89,10 @@ apt-get install -y \
libxt-dev \
libxtst-dev \
libxv-dev \
+ libz-mingw-w64-dev \
mesa-common-dev \
meson \
+ mingw-w64-tools \
nettle-dev \
pkg-config \
python3-mako \
@@ -100,6 +104,8 @@ apt-get install -y \
xtrans-dev \
xutils-dev
+.gitlab-ci/cross-prereqs-build.sh i686-w64-mingw32
+
cd /root
# weston 9.0 requires libwayland >= 1.18