view scripts/win32/deploy_build.sh @ 337:a7d4e5107531

dep/animone: REFACTOR ALL THE THINGS 1: animone now has its own syntax divergent from anisthesia, making different platforms actually have their own sections 2: process names in animone are now called `comm' (this will probably break things). this is what its called in bsd/linux so I'm just going to use it everywhere 3: the X11 code now checks for the existence of a UTF-8 window title and passes it if available 4: ANYTHING THATS NOT LINUX IS 100% UNTESTED AND CAN AND WILL BREAK! I still actually need to test the bsd code. to be honest I'm probably going to move all of the bsds into separate files because they're all essentially different operating systems at this point
author Paper <paper@paper.us.eu.org>
date Wed, 19 Jun 2024 12:51:15 -0400
parents 8eb0cfe59992
children 1faa72660932
line wrap: on
line source

#!/bin/sh
#
# deploys needed libraries for minori on win32
#
# this also runs windeployqt to deploy qt crap
# as well
#
# note: ldd is NOT a standard ldd; it's mingw-ldd
# from pypi which works much well when cross
# compiling using something like quasi-msys2

# you can override the paths to these at runtime
DIR="${DIR:-minori}"
LDD="${LDD:-mingw-ldd}"

GetNeededLibraries() {
	# do not run this on untrusted executables.
	# see: ldd(1)
	system="$(echo "$MSYSTEM" | tr "[:upper:]" "[:lower:]")"
	"$LDD" --output-format ldd-like --dll-lookup-dirs "/$system/bin" -- "$1" | while IFS="" read -r dependency; do
		# trim whitespace, then get the value; mingw-ldd's "ldd-like" output doesn't use tabs like regular ldd
		lib="$(printf -- "%s" "$dependency" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | cut -d' ' -f3)"
		case $lib in
			"/$system/"*)
				printf -- "$lib\n"
				;;
			*)
				;;
		esac
	done
}


if test -d "$DIR"; then
	rm -r "$DIR"
fi

mkdir "$DIR"

for lib in $(GetNeededLibraries ".libs/minori.exe"); do
	echo "copying '$lib' to $DIR"
	cp "$lib" "$DIR/"
done

cp ".libs/minori.exe" "$DIR/"

windeployqt "$DIR/minori.exe"

zip -r "$DIR.zip" "$DIR"