From 18d620afa6486e17fa0a4298c70f29b4b3aa1570 Mon Sep 17 00:00:00 2001 From: a-bad-dev <244852891+a-bad-dev@users.noreply.github.com> Date: Fri, 17 Apr 2026 00:03:22 -0300 Subject: [PATCH] Create bundle_dlls.sh --- bundle_dlls.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bundle_dlls.sh diff --git a/bundle_dlls.sh b/bundle_dlls.sh new file mode 100644 index 0000000..fec59f2 --- /dev/null +++ b/bundle_dlls.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# msys2-bundledlls - Copy DLLs linked against a Windows executable for bundling with a distribution + +if [ "$#" -ne 2 ]; +then + echo "Usage: ./bundledlls " + exit +fi + +mkdir -p $2 + +# Get list of dynamic libraries, filter by ones that are found in the current MSYS2 prefix +# and strip off everything but the full path. E.g.: +# `lua51.dll => /ucrt64/bin/lua51.dll (0xdeadbeef)` => `/ucrt64/bin/lua51.dll` +list=$(ldd $1 | grep $MINGW_PREFIX | sed 's/.* => //' | sed 's/ \(.*\)//') + +for dll in $list; +do + echo $dll + cp $dll $2/ +done