automaticaly determine FB_PREFIX from the given toolchain
Michał Wróbel [Fri, 12 Mar 2010 12:43:00 +0000 (13:43 +0100)]
fakebox

diff --git a/fakebox b/fakebox
index 965cda6..91e4ed9 100755 (executable)
--- a/fakebox
+++ b/fakebox
@@ -69,7 +69,17 @@ for i in $FB_TOP/$FB_TARGET/*.conf; do
 done
 
 ### our variables, defaults
-FB_WRAP="${FB_WRAP:-$FB_TOOLCHAIN/bin/$FB_PREFIX}"
+if [ -z "$FB_WRAP" ]; then
+       if [ -z "$FB_PREFIX" ]; then
+               FB_WRAP="`find $FB_TOOLCHAIN/ -name '*-gcc' | head -n1 | sed -e "s/-gcc$//"`"
+       else
+               FB_WRAP=$FB_TOOLCHAIN/bin/$FB_PREFIX
+       fi
+fi
+if [ -z "$FB_PREFIX" ]; then
+       FB_PREFIX=${FB_WRAP##*/}
+fi
+
 FB_DEBUG=${FB_DEBUG:-0}
 FB_BINFMT_QEMUWRAP="${FB_BINFMT_QEMUWRAP:-$FB_TOP/fakebox/wrappers/qemuwrap}"