From nobody Sat May 4 21:55:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1596486130; cv=none; d=zohomail.com; s=zohoarc; b=mSDhoHxrCHNNqGhW/VQTLpEjtyGuqOuC1JCltHNcpW3IJmnjs+eXUgGK9M69cxRHC4pbTAexpDG1oGfw6aG/B4wGKODMEXsO87YqLepvIdVVuKz82E2Nj4N57GR42Bh0lzXoLlVj183dF50Irk3rXLeMwmWs2NMDKSqCK1p0IKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596486130; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=BYmrrcLh6MTlpBSgmUr9peiW3UUBemWZuni0dT7ADS0=; b=oAwz8YcS+F62HIRqGTlWL2LncTXJrZg9O8AQnh6JxaCK9x5xI7nvovV8GuSjKfpBydSLM6ji0TaqF355O4zmae7FmUNQHBSuNMPDeGgNAZD0KkU5BLjCfC+q+y2B2XDDNmiwySCnYccMG9kV6JO9wyX9v836Oil4IGRDnS9rNyI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596486130501762.1122985546228; Mon, 3 Aug 2020 13:22:10 -0700 (PDT) Received: from localhost ([::1]:52230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2gyH-0003ct-7D for importer@patchew.org; Mon, 03 Aug 2020 16:22:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2gxI-0002mB-GT for qemu-devel@nongnu.org; Mon, 03 Aug 2020 16:21:08 -0400 Received: from mail.weilnetz.de ([37.120.169.71]:53274 helo=v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2gxF-0001Wb-Gq for qemu-devel@nongnu.org; Mon, 03 Aug 2020 16:21:07 -0400 Received: from localhost (localhost [127.0.0.1]) by v2201612906741603.powersrv.de (Postfix) with ESMTP id 121BEDB3C4C; Mon, 3 Aug 2020 22:21:02 +0200 (CEST) Received: from v2201612906741603.powersrv.de ([127.0.0.1]) by localhost (v2201612906741603.powersrv.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MBbO2_5_1iju; Mon, 3 Aug 2020 22:20:59 +0200 (CEST) Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by v2201612906741603.powersrv.de (Postfix) with ESMTP id 82F2DDB3C42; Mon, 3 Aug 2020 22:20:59 +0200 (CEST) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id 4B888460019; Mon, 3 Aug 2020 22:20:59 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at v2201612906741603.powersrv.de From: Stefan Weil To: qemu-devel@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Subject: [PATCH for-5.1] Add GitHub action for Windows build Date: Mon, 3 Aug 2020 22:20:42 +0200 Message-Id: <20200803202042.1869013-1-sw@weilnetz.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=37.120.169.71; envelope-from=stefan@weilnetz.de; helo=v2201612906741603.powersrv.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/03 16:21:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, RISK_FREE=1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The GitHub action is restricted to https://github.com/qemu/qemu. Signed-off-by: Stefan Weil Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- This patch adds a GitHub action for continuous integration builds of QEMU for Windows. The CI builds run on GitHub and include the WHPX code. The action rules avoid unnecessary waste of resources by limiting the GitHub action to the official mirror. Peter, maybe this can still be added to 5.1. There should be no risk as it only adds the GitHub action. Regards, Stefan .github/workflows/build.sh | 112 ++++++++++++++++++++++ .github/workflows/pkg-config-crosswrapper | 37 +++++++ .github/workflows/win.yml | 34 +++++++ 3 files changed, 183 insertions(+) create mode 100755 .github/workflows/build.sh create mode 100755 .github/workflows/pkg-config-crosswrapper create mode 100644 .github/workflows/win.yml diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh new file mode 100755 index 0000000000..c430a367be --- /dev/null +++ b/.github/workflows/build.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# GitHub actions - Create QEMU installer for Windows + +# Author: Stefan Weil (2020) + +#~ set -e +set -x + +ARCH=3D$1 +DLLS=3D"libgcc_s_sjlj-1.dll libgomp-1.dll libstdc++-6.dll" + +if test "$ARCH" !=3D "i686"; then + ARCH=3Dx86_64 + DLLS=3D"libgcc_s_seh-1.dll libgomp-1.dll libstdc++-6.dll" +fi + +ROOTDIR=3D$PWD +DISTDIR=3D$ROOTDIR/dist +HOST=3D$ARCH-w64-mingw32 +BUILDDIR=3Dbin/ndebug/$HOST +PKG_ARCH=3Dmingw64-${ARCH/_/-} + +# Install cygwin key and add cygwin sources. +curl -s https://qemu.weilnetz.de/debian/gpg.key | sudo apt-key add - +echo deb https://qemu.weilnetz.de/debian/ testing contrib | \ + sudo tee /etc/apt/sources.list.d/cygwin.list + +# Install packages. +sudo apt-get update +sudo apt-get install --no-install-recommends \ + mingw-w64-tools nsis \ + gcc libc6-dev \ + g++-mingw-w64-${ARCH/_/-} gcc-mingw-w64-${ARCH/_/-} \ + bison flex gettext python3-sphinx texinfo \ + $PKG_ARCH-adwaita-icon-theme $PKG_ARCH-cogl $PKG_ARCH-curl \ + $PKG_ARCH-gmp $PKG_ARCH-gnutls $PKG_ARCH-gtk3 $PKG_ARCH-icu \ + $PKG_ARCH-libxml2 $PKG_ARCH-ncurses $PKG_ARCH-sdl2 $PKG_ARCH-usbredir + +# Workaround for buggy cross pkg-config. +sudo ln -sf $PWD/.github/workflows/pkg-config-crosswrapper \ + /usr/bin/$HOST-pkg-config + +# Get header files for WHPX API from Mingw-w64 git master. +( +sudo mkdir -p /usr/$HOST/sys-include +cd /usr/$HOST/sys-include +SF_URLBASE=3Dhttps://sourceforge.net +URL=3D$SF_URLBASE/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/i= nclude +sudo curl -s -o winhvemulation.h $URL/winhvemulation.h?format=3Draw +sudo curl -s -o winhvplatform.h $URL/winhvplatform.h?format=3Draw +sudo curl -s -o winhvplatformdefs.h $URL/winhvplatformdefs.h?format=3Draw +sudo ln -s winhvemulation.h WinHvEmulation.h +sudo ln -s winhvplatform.h WinHvPlatform.h +sudo ln -s winhvplatformdefs.h WinHvPlatformDefs.h +) + +DLL_PATH=3D$PWD/dll/$HOST + +mkdir -p $DISTDIR +mkdir -p $DLL_PATH + +for dll in $DLLS; do + ln -sf /usr/lib/gcc/$HOST/*-win32/$dll $DLL_PATH +done + +DLLS=3D"iconv.dll libatk-1.0-0.dll libbz2-1.dll" +DLLS=3D"$DLLS libcairo-2.dll libcairo-gobject-2.dll libcurl-4.dll" +DLLS=3D"$DLLS libeay32.dll libepoxy-0.dll libexpat-1.dll" +DLLS=3D"$DLLS libffi-6.dll libfontconfig-1.dll libfreetype-6.dll" +DLLS=3D"$DLLS libgdk-3-0.dll libgdk_pixbuf-2.0-0.dll" +DLLS=3D"$DLLS libgio-2.0-0.dll libglib-2.0-0.dll libgmodule-2.0-0.dll" +DLLS=3D"$DLLS libgmp-10.dll libgnutls-30.dll libgobject-2.0-0.dll libgtk-3= -0.dll" +DLLS=3D"$DLLS libharfbuzz-0.dll libhogweed-4.dll libidn2-0.dll libintl-8.d= ll" +DLLS=3D"$DLLS libjpeg-8.dll liblzo2-2.dll" +DLLS=3D"$DLLS libncursesw6.dll libnettle-6.dll libnghttp2-14.dll" +DLLS=3D"$DLLS libp11-kit-0.dll libpango-1.0-0.dll libpangocairo-1.0-0.dll" +DLLS=3D"$DLLS libpangoft2-1.0-0.dll libpangowin32-1.0-0.dll libpcre-1.dll" +DLLS=3D"$DLLS libpixman-1-0.dll libpng16-16.dll libssh2-1.dll libtasn1-6.d= ll" +DLLS=3D"$DLLS libunistring-2.dll libusb-1.0.dll libusbredirparser-1.dll" +DLLS=3D"$DLLS SDL2.dll ssleay32.dll zlib1.dll" + +for dll in $DLLS; do + ln -sf /usr/$HOST/sys-root/mingw/bin/$dll $DLL_PATH +done + +ln -sf /usr/$HOST/lib/libwinpthread-1.dll $DLL_PATH + +# Build QEMU installer. + +echo Building $HOST... +mingw=3D/usr/$HOST/sys-root/mingw +mkdir -p $BUILDDIR && cd $BUILDDIR + +# Run configure. +../../../configure --cross-prefix=3D$HOST- --disable-guest-agent-msi \ + --disable-werror --enable-whpx \ + --extra-cflags=3D"-I $mingw/include" \ + --extra-ldflags=3D"-L $mingw/lib" + +# Add config.log to build artifacts. +cp config.log $DISTDIR/ + +make + +echo Building installers... +date=3D$(date +%Y%m%d) +INSTALLER=3D$DISTDIR/qemu-$ARCH-setup-$date.exe +make installer DLL_PATH=3D$DLL_PATH SIGNCODE=3Dtrue INSTALLER=3D$INSTALLER + +echo Calculate SHA-512 checksum... +(cd $DISTDIR; exe=3D$(basename $INSTALLER); sha512sum $exe >${exe/exe/sha5= 12}) diff --git a/.github/workflows/pkg-config-crosswrapper b/.github/workflows/= pkg-config-crosswrapper new file mode 100755 index 0000000000..768e554194 --- /dev/null +++ b/.github/workflows/pkg-config-crosswrapper @@ -0,0 +1,37 @@ +#! /bin/sh +# pkg-config wrapper for cross-building +# Sets pkg-config search path to search multiarch and historical cross-com= piling paths. + +# If the user has already set PKG_CONFIG_LIBDIR, believe it (even if empty= ): +# it's documented to be an override +if [ x"${PKG_CONFIG_LIBDIR+set}" =3D x ]; then + # GNU triplet for the compiler, e.g. i486-linux-gnu for Debian i386, + # i686-linux-gnu for Ubuntu i386 + basename=3D"${0##*/}" + triplet=3D"${basename%-pkg-config}" + # Normalized multiarch path if any, e.g. i386-linux-gnu for i386 + multiarch=3D"`dpkg-architecture -t"${triplet}" -qDEB_HOST_MULTIARCH 2>/d= ev/null`" + + PKG_CONFIG_LIBDIR=3D"/usr/local/${triplet}/lib/pkgconfig" + # For a native build we would also want to append /usr/local/lib/pkgconf= ig + # at this point; but this is a cross-building script, so don't + PKG_CONFIG_LIBDIR=3D"$PKG_CONFIG_LIBDIR:/usr/local/share/pkgconfig" + + if [ -n "$multiarch" ]; then + PKG_CONFIG_LIBDIR=3D"/usr/local/lib/${multiarch}/pkgconfig:$PKG_CONFIG= _LIBDIR" + PKG_CONFIG_LIBDIR=3D"$PKG_CONFIG_LIBDIR:/usr/lib/${multiarch}/pkgconfi= g" + fi + + PKG_CONFIG_LIBDIR=3D"$PKG_CONFIG_LIBDIR:/usr/${triplet}/lib/pkgconfig" + # For a native build we would also want to append /usr/lib/pkgconfig + # at this point; but this is a cross-building script, so don't + # If you want to allow use of un-multiarched -dev packages for crossing + # (at the risk of finding build-arch stuff you didn't want, if not in a = clean chroot) + # Uncomment the next line: + # PKG_CONFIG_LIBDIR=3D"$PKG_CONFIG_LIBDIR:/usr/lib/pkgconfig" + PKG_CONFIG_LIBDIR=3D"$PKG_CONFIG_LIBDIR:/usr/share/pkgconfig" + + export PKG_CONFIG_LIBDIR +fi + +exec pkg-config "$@" diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml new file mode 100644 index 0000000000..81cf48530f --- /dev/null +++ b/.github/workflows/win.yml @@ -0,0 +1,34 @@ +# GitHub actions - Create QEMU installers for Windows + +# The action is restricted to https://github.com/qemu/qemu. +# That avoids an unnecessary waste of resources when each fork +# runs the action, too. + +name: Cross build for Windows + +on: [push] + +jobs: + build32: + if: github.repository =3D=3D 'qemu/qemu' + runs-on: [ubuntu-20.04] + steps: + - uses: actions/checkout@v2 + - name: Build QEMU installer (32 bit) + run: .github/workflows/build.sh i686 + - uses: actions/upload-artifact@v1 + with: + name: QEMU Installer Windows 32 bit + path: dist + + build64: + if: github.repository =3D=3D 'qemu/qemu' + runs-on: [ubuntu-20.04] + steps: + - uses: actions/checkout@v2 + - name: Build QEMU installer (64 bit) + run: .github/workflows/build.sh x86_64 + - uses: actions/upload-artifact@v1 + with: + name: QEMU Installer Windows 64 bit + path: dist --=20 2.27.0