# HG changeset patch # User Paper # Date 1705982081 28800 # Node ID ed5ab38966664f0e5f3dc67ed3186c0fca0019c8 # Parent 82470f83f0c20b6ed0e447269b550b7aaa964c9c autotools: add `-mwindows` and windows deploy script diff -r 82470f83f0c2 -r ed5ab3896666 Makefile.am --- a/Makefile.am Mon Jan 22 19:06:23 2024 -0800 +++ b/Makefile.am Mon Jan 22 19:54:41 2024 -0800 @@ -91,6 +91,7 @@ if BUILD_WIN files_win = src/sys/win32/dark_theme.cc libs_win = -lole32 -luuid +ldflags_win = -mwindows if BUILD_WINDRES # Untested... @@ -169,7 +170,7 @@ minori_CPPFLAGS = @LIBCURL_CPPFLAGS@ $(minori_includes) minori_CXXFLAGS = @QT_CXXFLAGS@ $(cflags_osx) $(cflags_glib) $(cflags_win) -std=c++17 -minori_LDFLAGS = $(ldflags_osx) +minori_LDFLAGS = $(ldflags_osx) $(ldflags_win) minori_DEPENDENCIES = dep/pugixml/libpugixml.la dep/animia/libanimia.la dep/anitomy/libanitomy.la minori_LDADD = $(libs_glib) $(libs_osx) $(libs_win) @LIBCURL@ @QT_LIBS@ dep/pugixml/libpugixml.la dep/animia/libanimia.la dep/anitomy/libanitomy.la diff -r 82470f83f0c2 -r ed5ab3896666 scripts/win32/deploy_build.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/win32/deploy_build.sh Mon Jan 22 19:54:41 2024 -0800 @@ -0,0 +1,36 @@ +#!/bin/sh +# +# deploys needed libraries for minori on win32 +# +# this also runs windeployqt to deploy qt crap +# as well + +DIR="${DIR:-minori}" + +GetNeededLibraries() { + # do not run this on untrusted executables. + # see: ldd(1) + ldd "$1" | while IFS="" read -r dependency; do + fields=($dependency) + lib="${fields[2]}" + if [[ "$lib" == /"${MSYSTEM,,}"/* ]]; then + echo "$lib" + fi + done +} + +if [ -d "$DIR" ]; then + rm -r "$DIR" +fi + +mkdir "$DIR" + +for lib in $(GetNeededLibraries ".libs/minori.exe"); do + cp "$lib" "$DIR/" +done + +cp ".libs/minori.exe" "$DIR/" + +windeployqt "$DIR/minori.exe" + +zip -r "$DIR.zip" "$DIR"