cross install/debug/run tools
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 24 Mar 2018 22:14:59 +0000 (00:14 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 24 Mar 2018 22:14:59 +0000 (00:14 +0200)
Makefile
alien_gdb [new file with mode: 0755]
alien_run [new file with mode: 0755]
tools/dlldepends [new file with mode: 0755]

index a3e49a2..072abdb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -55,10 +55,7 @@ cross:
 instalien: demo.exe
        cp $< /alien/demo/$<
        mkdir -p /alien/demo/sdr && cp sdr/* /alien/demo/sdr/
-
-.PHONY: run
-run: instalien
-       rsh alien 'cd C:\Users\nuclear\Desktop\samba\demo && demo.exe'
+       for i in `tools/dlldepends | grep -v '++'`; do echo $$i; rsync $$i /alien/demo; done
 
 .clang_complete: Makefile
        rm -f $@
diff --git a/alien_gdb b/alien_gdb
new file mode 100755 (executable)
index 0000000..0db4bfc
--- /dev/null
+++ b/alien_gdb
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+rsh alien 'cd C:\Users\nuclear\Desktop\samba\demo && c:\msys32\usr\bin\gdbserver :1234 demo.exe' &
+
+echo 'target remote alien:1234' >.gdbinit-alien
+i686-w64-mingw32-gdb -x .gdbinit-alien demo.exe
diff --git a/alien_run b/alien_run
new file mode 100755 (executable)
index 0000000..ff80c8a
--- /dev/null
+++ b/alien_run
@@ -0,0 +1,2 @@
+#!/bin/sh
+rsh alien "cd C:\Users\nuclear\Desktop\samba\demo && demo.exe $*"
diff --git a/tools/dlldepends b/tools/dlldepends
new file mode 100755 (executable)
index 0000000..0535dcc
--- /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 demo.exe | sort | uniq