On Wed, Aug 19, 2020 at 04:02:06AM -0400, Paolo Bonzini wrote:
> This can be run with docker-test-mingw@ubuntu1804-mxe, and is the setup
> that Peter uses to test cross-compilation.

We already have docker containers with MXE based on Debian:

  debian-win32-cross.docker
  debian-win64-cross.docker

your image uses a different naming convention, and puts both
32 and 64 bit in the same image.

I feel like we should have the Ubuntu variant follow the same
structure and naming as the Debian variant for consistency.

> 
> Signed-off-by: Paolo Bonzini <pbonz...@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
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to