qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] build windows installers in ci
@ 2021-07-26 15:52 Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 1/3] nsis.py: create dlldir automatically Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 15:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Eduardo Habkost, Michael Roth,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Willian Rampazzo, Gerd Hoffmann,
	Cleber Rosa, Alex Bennée

With 8619b5ddb56f ("ci: build & store windows installer") merged at
least patch 1/3 should go into 6.1 too so the installers created by
CI do actually work.

Patches 2+3 are for the guest agent installer.

Gerd Hoffmann (3):
  nsis.py: create dlldir automatically
  ci: build & store guest agent msi
  qemu-ga/msi: fix w32 libgcc name

 scripts/nsis.py                               | 27 ++++++++++++++++---
 .gitlab-ci.d/crossbuild-template.yml          |  3 ++-
 .gitlab-ci.d/crossbuilds.yml                  |  2 ++
 meson.build                                   |  1 +
 qga/installer/qemu-ga.wxs                     |  2 +-
 .../dockerfiles/fedora-win32-cross.docker     |  1 +
 .../dockerfiles/fedora-win64-cross.docker     |  1 +
 7 files changed, 31 insertions(+), 6 deletions(-)

-- 
2.31.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/3] nsis.py: create dlldir automatically
  2021-07-26 15:52 [PATCH v2 0/3] build windows installers in ci Gerd Hoffmann
@ 2021-07-26 15:52 ` Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 2/3] ci: build & store guest agent msi Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 3/3] qemu-ga/msi: fix w32 libgcc name Gerd Hoffmann
  2 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 15:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Eduardo Habkost, Michael Roth,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Willian Rampazzo, Gerd Hoffmann,
	Cleber Rosa, Alex Bennée

Use objdump do figure which dlls are needed.  Copy them to a temporary
dlldir and pass that directory to makensis.

This patch removes the need to manually copy dlls to $srcdir/dll/w{32,64}
to get functional windows installers via "make installer".

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 scripts/nsis.py | 27 +++++++++++++++++++++++----
 meson.build     |  1 +
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/scripts/nsis.py b/scripts/nsis.py
index 5135a0583167..5a3cc7c09628 100644
--- a/scripts/nsis.py
+++ b/scripts/nsis.py
@@ -7,6 +7,7 @@
 import argparse
 import glob
 import os
+import sys
 import shutil
 import subprocess
 import tempfile
@@ -19,16 +20,35 @@ def signcode(path):
     subprocess.run([cmd, path])
 
 
+def copydlls(binary, srcdir, dstdir):
+    cmdline = [ "objdump", "-p", binary ]
+    result = subprocess.run(cmdline, stdout = subprocess.PIPE,
+                            universal_newlines = True)
+    if result.returncode != 0:
+        sys.exit(result.returncode)
+    for line in result.stdout.split('\n'):
+        if line.find('DLL Name') != -1:
+            dll = line.split()[2]
+            src = os.path.join(srcdir, dll)
+            dst = os.path.join(dstdir, dll)
+            if os.path.isfile(src) and not os.path.isfile(dst):
+                print("nsis.py: copy " + src)
+                shutil.copyfile(src, dst)
+                copydlls(src, srcdir, dstdir)
+
+
 def main():
     parser = argparse.ArgumentParser(description="QEMU NSIS build helper.")
     parser.add_argument("outfile")
     parser.add_argument("prefix")
     parser.add_argument("srcdir")
     parser.add_argument("cpu")
+    parser.add_argument("dllsrc")
     parser.add_argument("nsisargs", nargs="*")
     args = parser.parse_args()
 
     destdir = tempfile.mkdtemp()
+    dlldir = tempfile.mkdtemp()
     try:
         subprocess.run(["make", "install", "DESTDIR=" + destdir + os.path.sep])
         with open(
@@ -52,6 +72,7 @@ def main():
 
         for exe in glob.glob(os.path.join(destdir + args.prefix, "*.exe")):
             signcode(exe)
+            copydlls(exe, args.dllsrc, dlldir)
 
         makensis = [
             "makensis",
@@ -59,19 +80,17 @@ def main():
             "-NOCD",
             "-DSRCDIR=" + args.srcdir,
             "-DBINDIR=" + destdir + args.prefix,
+            "-DDLLDIR=" + dlldir,
         ]
-        dlldir = "w32"
         if args.cpu == "x86_64":
-            dlldir = "w64"
             makensis += ["-DW64"]
-        if os.path.exists(os.path.join(args.srcdir, "dll")):
-            makensis += ["-DDLLDIR={0}/dll/{1}".format(args.srcdir, dlldir)]
 
         makensis += ["-DOUTFILE=" + args.outfile] + args.nsisargs
         subprocess.run(makensis)
         signcode(args.outfile)
     finally:
         shutil.rmtree(destdir)
+        shutil.rmtree(dlldir)
 
 
 if __name__ == "__main__":
diff --git a/meson.build b/meson.build
index f2e148eaf98e..4a2d54fbae3f 100644
--- a/meson.build
+++ b/meson.build
@@ -2790,6 +2790,7 @@ if host_machine.system() == 'windows'
     get_option('prefix'),
     meson.current_source_dir(),
     host_machine.cpu(),
+    config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
     '--',
     '-DDISPLAYVERSION=' + meson.project_version(),
   ]
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/3] ci: build & store guest agent msi
  2021-07-26 15:52 [PATCH v2 0/3] build windows installers in ci Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 1/3] nsis.py: create dlldir automatically Gerd Hoffmann
@ 2021-07-26 15:52 ` Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 3/3] qemu-ga/msi: fix w32 libgcc name Gerd Hoffmann
  2 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 15:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Eduardo Habkost, Michael Roth,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Willian Rampazzo, Gerd Hoffmann,
	Cleber Rosa, Alex Bennée

Build guest agent windows msi install package in gitlab CI,
store the result as artifact.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .gitlab-ci.d/crossbuild-template.yml               | 3 ++-
 .gitlab-ci.d/crossbuilds.yml                       | 2 ++
 tests/docker/dockerfiles/fedora-win32-cross.docker | 1 +
 tests/docker/dockerfiles/fedora-win64-cross.docker | 1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml
index 7d3ad00a1eb9..12f78e81de0d 100644
--- a/.gitlab-ci.d/crossbuild-template.yml
+++ b/.gitlab-ci.d/crossbuild-template.yml
@@ -12,9 +12,10 @@
           mips64-softmmu ppc-softmmu sh4-softmmu xtensa-softmmu"
     - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
     - if grep -q "EXESUF=.exe" config-host.mak;
-      then make installer;
+      then make installer msi;
       version="$(git describe --match v[0-9]*)";
       mv -v qemu-setup*.exe qemu-setup-${version}.exe;
+      mv -v qga/*.msi $(basename qga/*.msi .msi)-${version}.msi;
       fi
 
 # Job to cross-build specific accelerators.
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index 4ff3aa3cfcdd..fc14a1cf5c10 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -163,6 +163,7 @@ cross-win32-system:
   artifacts:
     paths:
       - build/qemu-setup*.exe
+      - build/qemu-ga*.msi
 
 cross-win64-system:
   extends: .cross_system_build_job
@@ -173,6 +174,7 @@ cross-win64-system:
   artifacts:
     paths:
       - build/qemu-setup*.exe
+      - build/qemu-ga*.msi
 
 cross-amd64-xen-only:
   extends: .cross_accel_build_job
diff --git a/tests/docker/dockerfiles/fedora-win32-cross.docker b/tests/docker/dockerfiles/fedora-win32-cross.docker
index 5a03e1af43ac..f198927ef56b 100644
--- a/tests/docker/dockerfiles/fedora-win32-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win32-cross.docker
@@ -28,6 +28,7 @@ ENV PACKAGES \
     mingw32-pixman \
     mingw32-pkg-config \
     mingw32-SDL2 \
+    msitools \
     perl \
     perl-Test-Harness \
     python3 \
diff --git a/tests/docker/dockerfiles/fedora-win64-cross.docker b/tests/docker/dockerfiles/fedora-win64-cross.docker
index d3f13666e82e..fc0b3bf02eff 100644
--- a/tests/docker/dockerfiles/fedora-win64-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win64-cross.docker
@@ -25,6 +25,7 @@ ENV PACKAGES \
     mingw64-libtasn1 \
     mingw64-pixman \
     mingw64-pkg-config \
+    msitools \
     perl \
     perl-Test-Harness \
     python3 \
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 3/3] qemu-ga/msi: fix w32 libgcc name
  2021-07-26 15:52 [PATCH v2 0/3] build windows installers in ci Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 1/3] nsis.py: create dlldir automatically Gerd Hoffmann
  2021-07-26 15:52 ` [PATCH v2 2/3] ci: build & store guest agent msi Gerd Hoffmann
@ 2021-07-26 15:52 ` Gerd Hoffmann
  2021-07-26 16:34   ` Marc-André Lureau
  2 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2021-07-26 15:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Eduardo Habkost, Michael Roth,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Willian Rampazzo, Gerd Hoffmann,
	Cleber Rosa, Alex Bennée

This is what I find on my Fedora 34 mingw install.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qga/installer/qemu-ga.wxs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs
index 9cb4c3d73302..ce7b25b5e16f 100644
--- a/qga/installer/qemu-ga.wxs
+++ b/qga/installer/qemu-ga.wxs
@@ -31,7 +31,7 @@
   <?endif?>
 
   <?if $(var.Arch) = "32"?>
-    <?define ArchLib=libgcc_s_sjlj-1.dll?>
+    <?define ArchLib=libgcc_s_dw2-1.dll?>
     <?define GaProgramFilesFolder="ProgramFilesFolder" ?>
   <?endif?>
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 3/3] qemu-ga/msi: fix w32 libgcc name
  2021-07-26 15:52 ` [PATCH v2 3/3] qemu-ga/msi: fix w32 libgcc name Gerd Hoffmann
@ 2021-07-26 16:34   ` Marc-André Lureau
  0 siblings, 0 replies; 5+ messages in thread
From: Marc-André Lureau @ 2021-07-26 16:34 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Thomas Huth, Eduardo Habkost, Michael Roth,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, QEMU, Willian Rampazzo, Cleber Rosa,
	Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

Hi

On Mon, Jul 26, 2021 at 7:56 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> This is what I find on my Fedora 34 mingw install.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  qga/installer/qemu-ga.wxs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs
> index 9cb4c3d73302..ce7b25b5e16f 100644
> --- a/qga/installer/qemu-ga.wxs
> +++ b/qga/installer/qemu-ga.wxs
> @@ -31,7 +31,7 @@
>    <?endif?>
>
>    <?if $(var.Arch) = "32"?>
> -    <?define ArchLib=libgcc_s_sjlj-1.dll?>
> +    <?define ArchLib=libgcc_s_dw2-1.dll?>
>      <?define GaProgramFilesFolder="ProgramFilesFolder" ?>
>    <?endif?>
>
>
msitools/wixl has Fedora WXI (wxs includes files) for that
https://gitlab.gnome.org/GNOME/msitools/-/blob/master/data/wixl/gcc.wxi

In theory, all you need is: "<?require $DEP.wxi?>" at the top level, and
reference the component group "<ComponentGroupRef Id="CG.$DEP"/>"

That's how we handle the dozens for dependencies in virt-viewer/spice.

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1885 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-26 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 15:52 [PATCH v2 0/3] build windows installers in ci Gerd Hoffmann
2021-07-26 15:52 ` [PATCH v2 1/3] nsis.py: create dlldir automatically Gerd Hoffmann
2021-07-26 15:52 ` [PATCH v2 2/3] ci: build & store guest agent msi Gerd Hoffmann
2021-07-26 15:52 ` [PATCH v2 3/3] qemu-ga/msi: fix w32 libgcc name Gerd Hoffmann
2021-07-26 16:34   ` Marc-André Lureau

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).