summaryrefslogtreecommitdiffstats
path: root/scripts/libptxdist.sh
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2012-04-07 15:37:43 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-06-13 19:49:06 +0200
commit04e2d38507d6e69d7b54835b56760bc0ac38e207 (patch)
treea742c9f59e99f2600f0a54beba54efd1cada0000 /scripts/libptxdist.sh
parent3e78961a61cca6170e819a371c52eaa907d934c0 (diff)
downloadptxdist-04e2d38507d6e69d7b54835b56760bc0ac38e207.tar.gz
ptxdist-04e2d38507d6e69d7b54835b56760bc0ac38e207.tar.xz
ptxd_init_sysroot_toolchain: improve sysroot detection
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/libptxdist.sh')
-rw-r--r--scripts/libptxdist.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index 0851edb18..b4bb939d2 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -715,6 +715,30 @@ export -f check_pipe_status
#
+# $1: lib_path # cannolocilized path to lib or link
+#
+ptxd_lib_sysroot() {
+ local lib_path lib lib_dir prefix tmp
+
+ lib_path="${1}"
+ lib="$(basename "${lib_path}")"
+ lib_dir="$(dirname "${lib_path}")"
+
+ # try to identify sysroot part of that path
+ for prefix in {/usr,}/lib{64,32,}{/tls,/gconv,} ""; do
+ tmp="${lib_dir%${prefix}}"
+ if test "${lib_dir}" != "${tmp}"; then
+ echo "${tmp}"
+ return
+ fi
+ done
+
+ return 1
+}
+export -f ptxd_lib_sysroot
+
+
+#
# split ipkg filename into it's parts
#
# input format: