qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] [hack] scripts/copy-dlls


From: Gerd Hoffmann
Subject: [PATCH 2/3] [hack] scripts/copy-dlls
Date: Wed, 23 Jun 2021 11:11:36 +0200

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]