qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, alex.bennee@linaro.org
Subject: [PATCH] tests: docker: support mxe-based mingw builds
Date: Wed, 19 Aug 2020 04:02:06 -0400	[thread overview]
Message-ID: <20200819080206.27423-1-pbonzini@redhat.com> (raw)

This can be run with docker-test-mingw@ubuntu1804-mxe, and is the setup
that Peter uses to test cross-compilation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/docker/common.rc                        | 18 ++++++-
 .../docker/dockerfiles/ubuntu1804-mxe.docker  | 54 +++++++++++++++++++
 tests/docker/test-mingw                       | 11 +++-
 3 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 tests/docker/dockerfiles/ubuntu1804-mxe.docker

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
index ebc5b97ecf..402f6603b6 100755
--- a/tests/docker/common.rc
+++ b/tests/docker/common.rc
@@ -15,10 +15,26 @@
 # overriden by TARGET_LIST if the user sets it.
 DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
 
+has()
+{
+    echo "$FEATURES" | grep -wq -e "$1"
+}
+
+requires_any()
+{
+    for c in $@; do
+        if has "$c"; then
+            return
+        fi
+    done
+    echo "None of prerequisites '$*' is present, skip"
+    exit 0
+}
+
 requires()
 {
     for c in $@; do
-        if ! echo "$FEATURES" | grep -wq -e "$c"; then
+        if ! has "$c"; then
             echo "Prerequisite '$c' not present, skip"
             exit 0
         fi
diff --git a/tests/docker/dockerfiles/ubuntu1804-mxe.docker b/tests/docker/dockerfiles/ubuntu1804-mxe.docker
new file mode 100644
index 0000000000..91895db80d
--- /dev/null
+++ b/tests/docker/dockerfiles/ubuntu1804-mxe.docker
@@ -0,0 +1,54 @@
+FROM ubuntu:18.04
+ENV PACKAGES \
+    ccache \
+    gcc \
+    gettext \
+    git \
+    gnupg \
+    gnupg2 \
+    make \
+    nsis \
+    python3-yaml \
+    python3-sphinx \
+    python3-setuptools \
+    texinfo
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get -y install $PACKAGES
+
+ENV MXE_PACKAGES \
+    mxe-i686-w64-mingw32.shared-bzip2 \
+    mxe-i686-w64-mingw32.shared-curl \
+    mxe-i686-w64-mingw32.shared-glib \
+    mxe-i686-w64-mingw32.shared-gcc \
+    mxe-i686-w64-mingw32.shared-glib \
+    mxe-i686-w64-mingw32.shared-gmp \
+    mxe-i686-w64-mingw32.shared-gnutls \
+    mxe-i686-w64-mingw32.shared-gtk3 \
+    mxe-i686-w64-mingw32.shared-libjpeg-turbo \
+    mxe-i686-w64-mingw32.shared-libpng \
+    mxe-i686-w64-mingw32.shared-nettle \
+    mxe-i686-w64-mingw32.shared-nsis \
+    mxe-i686-w64-mingw32.shared-pixman \
+    mxe-i686-w64-mingw32.shared-pkgconf \
+    mxe-i686-w64-mingw32.shared-sdl2 \
+    mxe-x86-64-w64-mingw32.shared-bzip2 \
+    mxe-x86-64-w64-mingw32.shared-curl \
+    mxe-x86-64-w64-mingw32.shared-gcc \
+    mxe-x86-64-w64-mingw32.shared-glib \
+    mxe-x86-64-w64-mingw32.shared-gmp \
+    mxe-x86-64-w64-mingw32.shared-gnutls \
+    mxe-x86-64-w64-mingw32.shared-gtk3 \
+    mxe-x86-64-w64-mingw32.shared-libjpeg-turbo \
+    mxe-x86-64-w64-mingw32.shared-libpng \
+    mxe-x86-64-w64-mingw32.shared-nettle \
+    mxe-x86-64-w64-mingw32.shared-nsis \
+    mxe-x86-64-w64-mingw32.shared-pixman \
+    mxe-x86-64-w64-mingw32.shared-pkgconf \
+    mxe-x86-64-w64-mingw32.shared-sdl2
+
+RUN echo "deb http://pkg.mxe.cc/repos/apt bionic main" > \
+   /etc/apt/sources.list.d/mxeapt.list && \
+   apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C6BF758A33A3A276 && \
+   apt-get update && \
+   DEBIAN_FRONTEND=noninteractive apt-get install -y $MXE_PACKAGES
+ENV FEATURES mxe
diff --git a/tests/docker/test-mingw b/tests/docker/test-mingw
index c30eb654eb..9e2fadb11a 100755
--- a/tests/docker/test-mingw
+++ b/tests/docker/test-mingw
@@ -13,11 +13,18 @@
 
 . common.rc
 
-requires mingw dtc
+requires dtc
+requires_any mingw mxe
 
 cd "$BUILD_DIR"
 
-for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
+if has mingw; then
+  prefixes='x86_64-w64-mingw32- i686-w64-mingw32-'
+else
+  prefixes='x86_64-w64-mingw32.shared- i686-w64-mingw32.shared-'
+  export PATH=/usr/lib/mxe/usr/bin:$PATH
+fi
+for prefix in $prefixes; do
     TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
         build_qemu --cross-prefix=$prefix \
         --enable-trace-backends=simple \
-- 
2.26.2



             reply	other threads:[~2020-08-19  8:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19  8:02 Paolo Bonzini [this message]
2020-08-19  8:13 ` [PATCH] tests: docker: support mxe-based mingw builds Marc-André Lureau
2020-08-19  8:20 ` Daniel P. Berrangé
2020-08-19 10:42   ` Paolo Bonzini
2020-08-19 11:09     ` Daniel P. Berrangé
2020-08-19 11:41       ` Paolo Bonzini
2020-08-19  8:59 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200819080206.27423-1-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).