[dia: 88/105] #19: Windows build: Add script that bundles other libraries in DEST dir.



commit 921c1014509405358d72230b506cbb9d689124d7
Author: Eduard Nicodei <eddnicodei gmail com>
Date:   Tue Jan 22 23:05:53 2019 +0000

    #19: Windows build: Add script that bundles other libraries in DEST dir.

 meson-helpers/windows-bundler.sh | 27 +++++++++++++++++++++++++++
 meson.build                      |  4 ++++
 2 files changed, 31 insertions(+)
---
diff --git a/meson-helpers/windows-bundler.sh b/meson-helpers/windows-bundler.sh
new file mode 100644
index 00000000..4674e060
--- /dev/null
+++ b/meson-helpers/windows-bundler.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+
+echo "Gathering dependencies.  Please close dia once it has opened."
+PYTHONHOME=/mingw64 strace -o strace-log env ${MESON_INSTALL_DESTDIR_PREFIX}/bin/dia.exe
+
+# Search for all .dlls which are loaded from mingw64
+grep 'mingw64' strace-log  | awk '{print $5}' | tr '\' '/' | sed 's#C:#/c#' > win-lib-deps
+
+# Filter out those which are in /bin/ and copy them to DESTDIR/bin
+grep '/mingw64/bin/' win-lib-deps  | xargs -I{} cp '{}' ${MESON_INSTALL_DESTDIR_PREFIX}/bin/
+
+# Copy the main dependency libraries
+cp -r /c/msys64/mingw64/lib/{gtk-2.0,gdk-pixbuf-2.0,python2.7}/ ${MESON_INSTALL_DESTDIR_PREFIX}/lib/
+
+
+# Cleanup uneeded files.
+
+# No need for static libraries
+# NOTE: this removes every .a file, might remove important things.
+find ${MESON_INSTALL_DESTDIR_PREFIX}/lib -name '*.a' -delete
+
+# Not needed to run Dia
+rm -r ${MESON_INSTALL_DESTDIR_PREFIX}/lib/gtk-2.0/include
+
+# No source distribution or optimized modules.
+find ${MESON_INSTALL_DESTDIR_PREFIX}/lib/python2.7/ -name '*.py' -delete
+find ${MESON_INSTALL_DESTDIR_PREFIX}/lib/python2.7/ -name '*.pyo' -delete
diff --git a/meson.build b/meson.build
index f447791a..32c0c615 100644
--- a/meson.build
+++ b/meson.build
@@ -100,3 +100,7 @@ custom_target('run_with_dia_env',
 )
 
 meson.add_install_script('meson-helpers/post-install.py', datadir)
+
+if build_machine.system() == 'windows'
+    meson.add_install_script('meson-helpers/windows-bundler.sh')
+endif


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