doing stuff
[ld42_outofspace] / tools / dlldepends
diff --git a/tools/dlldepends b/tools/dlldepends
new file mode 100755 (executable)
index 0000000..7515d35
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/dash
+
+depends() {
+       dlls=$(strings $1 | grep '\.dll' | grep -v '\(USER32\|KERNEL32\|msvcrt\)')
+
+       gccver=$(i686-w64-mingw32-gcc -dumpversion | awk -F . '{ print $1 "." $2 }')
+
+       libpaths="/usr/i686-w64-mingw32/lib \
+       /usr/i686-w64-mingw32/bin \
+       /usr/lib/gcc/i686-w64-mingw32/$gccver-win32"
+
+       for i in $dlls; do
+               for path in $libpaths; do
+                       dllfile=$path/$i
+                       if [ -f $dllfile ]; then
+                               echo $dllfile
+                               if [ ! "$2" = noreq ]; then
+                                       depends $dllfile noreq
+                               fi
+                       fi
+               done
+       done
+}
+
+depends game.exe | sort | uniq