summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2018-03-21 11:48:52 +0100
committerSimon McVittie <smcv@collabora.com>2018-10-04 16:54:10 +0100
commit900daf5ee4cd4439bf1daf35060e302473927933 (patch)
tree0870cf7831c4862e064df2ffdcdeea10341da51f
parent316ad76a88d95d725764096f0dd7b0dd1166a51b (diff)
downloaddbus-900daf5ee4cd4439bf1daf35060e302473927933.tar.gz
travis-ci: Add cross building support for mingw 64 bit compiler
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de> Reviewed-by: Simon McVittie <smcv@collabora.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105662 (cherry picked from commit d22e7901b555a0bfb5e06fb2463d839a276c7482)
-rw-r--r--.travis.yml7
-rw-r--r--cmake/x86_64-w64-mingw32.cmake19
-rwxr-xr-xtools/ci-build.sh32
-rwxr-xr-xtools/ci-install.sh34
4 files changed, 67 insertions, 25 deletions
diff --git a/.travis.yml b/.travis.yml
index 4ffc48c4..e719efbd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,9 +35,10 @@ env:
- ci_variant=reduced
- ci_variant=legacy
- ci_buildsys=cmake
- - ci_host=mingw
- - ci_host=mingw ci_variant=debug
- - ci_host=mingw ci_buildsys=cmake
+ - ci_host=i686-w64-mingw32
+ - ci_host=i686-w64-mingw32 ci_buildsys=cmake ci_variant=debug
+ - ci_host=x86_64-w64-mingw32 ci_variant=debug
+ - ci_host=x86_64-w64-mingw32 ci_buildsys=cmake
- ci_docker=ubuntu:xenial ci_distro=ubuntu ci_suite=xenial
- ci_docker=debian:jessie-slim ci_distro=debian ci_suite=jessie
- ci_docker=debian:stretch-slim ci_distro=debian ci_suite=stretch
diff --git a/cmake/x86_64-w64-mingw32.cmake b/cmake/x86_64-w64-mingw32.cmake
new file mode 100644
index 00000000..069bfdde
--- /dev/null
+++ b/cmake/x86_64-w64-mingw32.cmake
@@ -0,0 +1,19 @@
+# Toolchain for mingw-w64 64-bit compilers, as shipped in Debian/Ubuntu.
+
+set(GNU_HOST x86_64-w64-mingw32)
+set(CMAKE_SYSTEM_PROCESSOR "x86_64")
+
+set(COMPILER_PREFIX "${GNU_HOST}-")
+
+set(CMAKE_SYSTEM_NAME "Windows")
+set(CMAKE_CROSSCOMPILING TRUE)
+set(WIN32 TRUE)
+set(MINGW TRUE)
+
+set(CMAKE_C_COMPILER ${COMPILER_PREFIX}gcc)
+set(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}g++)
+set(CMAKE_RC_COMPILER ${COMPILER_PREFIX}windres)
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/tools/ci-build.sh b/tools/ci-build.sh
index 88c0571b..56066b00 100755
--- a/tools/ci-build.sh
+++ b/tools/ci-build.sh
@@ -94,9 +94,13 @@ cd ci-build-${ci_variant}-${ci_host}
make="make -j${ci_parallel} V=1 VERBOSE=1"
case "$ci_host" in
- (mingw)
- mirror=http://repo.msys2.org/mingw/i686
- mingw="$(pwd)/mingw32"
+ (*-w64-mingw32)
+ mirror=http://repo.msys2.org/mingw/${ci_host%%-*}
+ if [ "${ci_host%%-*}" = i686 ]; then
+ mingw="$(pwd)/mingw32"
+ else
+ mingw="$(pwd)/mingw64"
+ fi
install -d "${mingw}"
export PKG_CONFIG_LIBDIR="${mingw}/lib/pkgconfig"
export PKG_CONFIG_PATH=
@@ -111,8 +115,8 @@ case "$ci_host" in
libffi-3.2.1-3 \
zlib-1.2.8-9 \
; do
- wget ${mirror}/mingw-w64-i686-${pkg}-any.pkg.tar.xz
- tar -xvf mingw-w64-i686-${pkg}-any.pkg.tar.xz
+ wget ${mirror}/mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
+ tar -xvf mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
done
export TMPDIR=/tmp
;;
@@ -126,9 +130,13 @@ case "$ci_buildsys" in
set _ "$@"
set "$@" --enable-developer --enable-tests
# Enable optional features that are off by default
- if [ "$ci_host" != mingw ]; then
- set "$@" --enable-user-session
- fi
+ case "$ci_host" in
+ *-w64-mingw32)
+ ;;
+ *)
+ set "$@" --enable-user-session
+ ;;
+ esac
shift
# The test coverage for OOM-safety is too
# verbose to be useful on travis-ci.
@@ -196,10 +204,10 @@ case "$ci_buildsys" in
esac
case "$ci_host" in
- (mingw)
+ (*-w64-mingw32)
set _ "$@"
set "$@" --build="$(build-aux/config.guess)"
- set "$@" --host=i686-w64-mingw32
+ set "$@" --host="${ci_host}"
set "$@" CFLAGS=-static-libgcc
set "$@" CXXFLAGS=-static-libgcc
# don't run tests yet, Wine needs Xvfb and
@@ -252,9 +260,9 @@ case "$ci_buildsys" in
(cmake)
case "$ci_host" in
- (mingw)
+ (*-w64-mingw32)
set _ "$@"
- set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/i686-w64-mingw32.cmake"
+ set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake"
set "$@" -D CMAKE_PREFIX_PATH="${mingw}"
set "$@" -D CMAKE_INCLUDE_PATH="${mingw}/include"
set "$@" -D CMAKE_LIBRARY_PATH="${mingw}/lib"
diff --git a/tools/ci-install.sh b/tools/ci-install.sh
index 5a1fa317..68d1c11b 100755
--- a/tools/ci-install.sh
+++ b/tools/ci-install.sh
@@ -82,19 +82,33 @@ case "$ci_distro" in
# travis-ci has a sources list for Chrome which doesn't support i386
: | $sudo tee /etc/apt/sources.list.d/google-chrome.list
- if [ "$ci_host" = mingw ]; then
- $sudo dpkg --add-architecture i386
- fi
+ case "$ci_host" in
+ (i686-w64-mingw32)
+ $sudo dpkg --add-architecture i386
+ ;;
+ (x86_64-w64-mingw32)
+ # nothing required, travis-ci is an amd64 system
+ ;;
+ esac
$sudo apt-get -qq -y update
- if [ "$ci_host" = mingw ]; then
- $sudo apt-get -qq -y install \
- binutils-mingw-w64-i686 \
- g++-mingw-w64-i686 \
- wine:i386 \
- ${NULL}
- fi
+ case "$ci_host" in
+ (i686-w64-mingw32)
+ $sudo apt-get -qq -y install \
+ binutils-mingw-w64-i686 \
+ g++-mingw-w64-i686 \
+ wine:i386 \
+ ${NULL}
+ ;;
+ (x86_64-w64-mingw32)
+ $sudo apt-get -qq -y install \
+ binutils-mingw-w64-x86-64\
+ g++-mingw-w64-x86-64 \
+ wine:amd64 \
+ ${NULL}
+ ;;
+ esac
$sudo apt-get -qq -y install \
autoconf-archive \