ath9k: fix selecting the second antenna on a single-stream device with diversity
[openwrt/svn-archive/archive.git] / scripts / gen-dependencies.sh
1 #!/usr/bin/env bash
2 #
3 # Copyright (C) 2012 OpenWrt.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8 SELF=${0##*/}
9
10 READELF="${READELF:-readelf}"
11 TARGETS=$*
12 XARGS="${XARGS:-xargs -r}"
13
14 [ -z "$TARGETS" ] && {
15 echo "$SELF: no directories / files specified"
16 echo "usage: $SELF [PATH...]"
17 exit 1
18 }
19
20 find $TARGETS -type f -a -exec file {} \; | \
21 sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.* stripped/\1/p' | \
22 $XARGS -n1 readelf -d | \
23 awk '$2 ~ /NEEDED/ && $NF !~ /interpreter/ && $NF ~ /^\[?lib.*\.so/ { gsub(/[\[\]]/, "", $NF); print $NF }' | \
24 sort -u