summaryrefslogtreecommitdiffstats
path: root/Documentation/checkPlugin.sh
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-02-16 20:17:18 +0000
commitcb7eddb91455a69cf66fcd717e91a51ca5e2cfef (patch)
treecf5546e4d7c44370fbe9ca2be937bd254f30ebaa /Documentation/checkPlugin.sh
downloadkpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.tar.gz
kpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.zip
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpilot@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'Documentation/checkPlugin.sh')
-rw-r--r--Documentation/checkPlugin.sh77
1 files changed, 77 insertions, 0 deletions
diff --git a/Documentation/checkPlugin.sh b/Documentation/checkPlugin.sh
new file mode 100644
index 0000000..bc0b840
--- /dev/null
+++ b/Documentation/checkPlugin.sh
@@ -0,0 +1,77 @@
+#! /bin/sh
+##
+## checkPlugin.sh
+##
+## Copyright (C) 2002 by Adriaan de Groot
+##
+## Distributed under the GNU General Public License (GPL) Version 2.
+##
+
+##
+## Usage: checkPlugin.sh <app-path> <plugin-path> [<extra-lib> ...]
+##
+## <app-path> : path to the application that will be loading the
+## plugin. This is used to get the list of library
+## dependencies.
+## <plugin-path> : path to the plugin (.so) that will be loaded.
+## <extra-lib> : paths to additional libraries to get defined symbols from.
+##
+
+USAGE="Usage: checkPlugin.sh <app-path> <plugin-path> [<extra-lib> ...]"
+
+UNDEF_RE="^ *U "
+DEF_RE="^[0-9a-fA-F]* [TdWBVDR] "
+TMP="/tmp/$$"
+
+APP_PATH="$1"
+PLUGIN_PATH="$2"
+
+test -z "$APP_PATH" && echo "$USAGE"
+test -z "$APP_PATH" && exit 1
+test -f "$APP_PATH" || echo "$USAGE"
+test -f "$APP_PATH" || exit 1
+
+test -z "$PLUGIN_PATH" && echo "$USAGE"
+test -z "$PLUGIN_PATH" && exit 1
+test -f "$PLUGIN_PATH" || echo "$USAGE"
+test -f "$PLUGIN_PATH" || exit 1
+
+shift 2
+
+if nm --demangle "$PLUGIN_PATH" > "$TMP-1" ; then
+ echo `wc -l < "$TMP-1"` "symbols in $PLUGIN_PATH"
+else
+ echo "nm failed on $PLUGIN_PATH"
+ exit 1
+fi
+
+cat "$TMP-1" | grep "$UNDEF_RE" | sed "s/$UNDEF_RE//" | sort > "$TMP-undef"
+
+T=`ldd "$APP_PATH" | grep -v "$APP_PATH" | grep -v "not found" | sed -e 's/.*=> //' -e 's/ (.*) *$//' | sort | uniq`
+
+for LIBF in $T $* ; do
+ test -f "$LIBF" || echo "$LIBF: Not found"
+ test -f "$LIBF" || exit 1
+
+ if nm --demangle "$LIBF" > "$TMP-2" 2> /dev/null ; then
+ nm --demangle --dynamic "$LIBF" >> "$TMP-2" 2> /dev/null
+ # echo `wc -l < "$TMP-2"` "symbols defined in $LIBF"
+ else
+ echo "nm failed on $LIBF"
+ exit 1
+ fi
+
+ cat "$TMP-2" | grep "$DEF_RE" | sed "s/$DEF_RE//" | sort | uniq > "$TMP-def"
+ cat "$TMP-undef" "$TMP-def" | sort | uniq -d > "$TMP-now-defined"
+ cat "$TMP-undef" "$TMP-now-defined" | sort | uniq -u > "$TMP-still"
+
+ echo `wc -l < "$TMP-now-defined"` "symbols resolved by $LIBF"
+
+ cat "$TMP-still" > "$TMP-undef"
+done
+
+echo `wc -l < "$TMP-undef"` "undefined symbols remain"
+
+cat "$TMP-undef"
+
+rm -f "$TMP" "$TMP-1" "$TMP-2" "$TMP-undef" "$TMP-def" "$TMP-now-defined" "$TMP-still"