All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Willian Rampazzo" <willianr@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH 2/3] [hack] scripts/copy-dlls
Date: Wed, 23 Jun 2021 11:11:36 +0200	[thread overview]
Message-ID: <20210623091137.1156959-3-kraxel@redhat.com> (raw)
In-Reply-To: <20210623091137.1156959-1-kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 .gitlab-ci.d/crossbuild-template.yml |  3 +-
 scripts/copy-dlls                    | 56 ++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100755 scripts/copy-dlls

diff --git a/.gitlab-ci.d/crossbuild-template.yml b/.gitlab-ci.d/crossbuild-template.yml
index 7d3ad00a1eb9..5411177935fc 100644
--- a/.gitlab-ci.d/crossbuild-template.yml
+++ b/.gitlab-ci.d/crossbuild-template.yml
@@ -12,7 +12,8 @@
           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 scripts/copy-dlls;
+      make installer;
       version="$(git describe --match v[0-9]*)";
       mv -v qemu-setup*.exe qemu-setup-${version}.exe;
       fi
diff --git a/scripts/copy-dlls b/scripts/copy-dlls
new file mode 100755
index 000000000000..0a84cd004c87
--- /dev/null
+++ b/scripts/copy-dlls
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# copy dlls needed by windows binaries to $srcdir/dll/{w32,w64}
+# the nsis installer scripts expects them there
+#
+# TODO: rewrite in python and integrate into scripts/nsis.py
+#
+
+if test ! -f config-host.mak; then
+    echo "must be started in builddir"
+    exit 1
+fi
+
+eval $(egrep '(CONFIG_WIN32|QEMU_GA_MSI_MINGW_DLL_PATH|SRC_PATH)' config-host.mak)
+
+if test "$CONFIG_WIN32" != "y"; then
+    echo "not a windows build"
+    exit 1
+fi
+
+if test "$QEMU_GA_MSI_MINGW_DLL_PATH" = ""; then
+    echo "unknown dll path"
+    exit 1
+fi
+
+case "$QEMU_GA_MSI_MINGW_DLL_PATH" in
+    *-w32-*)
+	DESTDIR="$SRC_PATH/dll/w32"
+	;;
+    *-w64-*)
+	DESTDIR="$SRC_PATH/dll/w64"
+	;;
+    *)
+	echo "can't figure w32 vs. w64"
+	exit 1
+	;;
+esac
+
+function check_windows_binary_deps() {
+    local file="$1"
+    local dlls dll
+
+    dlls=$(objdump -p "$file" | awk '/DLL Name/ { print $3 }')
+    for dll in $dlls; do
+	test -f "$QEMU_GA_MSI_MINGW_DLL_PATH/$dll" || continue
+	test -f "$DESTDIR/$dll" && continue
+	echo "copy $dll"
+	cp "$QEMU_GA_MSI_MINGW_DLL_PATH/$dll" "$DESTDIR/$dll"
+	check_windows_binary_deps "$DESTDIR/$dll"
+    done
+}
+
+mkdir -p "$DESTDIR"
+for file in *.exe; do
+    check_windows_binary_deps $file
+done
-- 
2.31.1



  parent reply	other threads:[~2021-06-23  9:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  9:11 [PATCH 0/3] [RfC] build windows installers in ci Gerd Hoffmann
2021-06-23  9:11 ` [PATCH 1/3] ci: build & store windows installer Gerd Hoffmann
2021-07-05  7:28   ` Thomas Huth
2021-07-05 14:44   ` Willian Rampazzo
2021-06-23  9:11 ` Gerd Hoffmann [this message]
2021-06-23  9:11 ` [PATCH 3/3] ci: build & store guest agent msi Gerd Hoffmann
2021-07-05  7:31   ` Thomas Huth
2021-07-05 14:47   ` Willian Rampazzo

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=20210623091137.1156959-3-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    --cc=willianr@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.