summaryrefslogtreecommitdiff
path: root/precise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary
diff options
context:
space:
mode:
Diffstat (limited to 'precise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary')
-rwxr-xr-xprecise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary22
1 files changed, 22 insertions, 0 deletions
diff --git a/precise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary b/precise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary
new file mode 100755
index 0000000..ec2a448
--- /dev/null
+++ b/precise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Taken from http://bazaar.launchpad.net/~linaro-toolchain-dev/crosstool-ng/linaro/view/head:/contrib/linaro/make-sysroot.sh
+
+sysroot=binary/boot/filesystem.dir
+
+# Some packages include absolute links in sysroot/usr/lib.
+# Convert to relative links instead
+for lib in $( find $sysroot -type l ); do
+ target=$( readlink $lib )
+ base=$( basename $target )
+
+ case $target in
+ /*)
+ v=$( echo $lib | sed -r "s#^$sysroot/##" | tr -cd / | sed "s#/#../#g" )
+ p=$( echo $target | sed "s#^/##" )
+ rm $lib
+ ln -s $v$p $lib
+ ;;
+ *) ;;
+ esac
+done