Magellan Linux

Contents of /branches/mage-next/src/tools/autodepend.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2804 - (show annotations) (download)
Tue Sep 2 13:03:36 2014 UTC (9 years, 8 months ago) by niro
File size: 966 byte(s)
-fixed broken use-move honor logic
1 #!/bin/bash
2 # $Id$
3
4 SCANELF="scanelf -LnyRB"
5 BINDIR="$1"
6
7 if [[ -z ${BINDIR} ]]
8 then
9 echo "No \$BINDIR given"
10 exit 1
11 fi
12
13 build_soname_list()
14 {
15 local sonames
16 local i
17 sonames="$(${SCANELF} ${BINDIR} | cut -d' ' -f2 | sed 's:,:\ :g')"
18
19 # now drop all duplicates
20 SONAME_LIST="$(for i in ${sonames}; do echo ${i}; done | sort -u)"
21 export SONAME_LIST
22 }
23
24 build_dep_list()
25 {
26 local soname
27 local libdir
28 local deps
29 local i
30 local prefix
31
32 for soname in ${SONAME_LIST}
33 do
34 # if /lib /lib64 are symlinks than add a prefix to honor usr-move
35 libdir="${soname%/*}"
36 prefix=""
37 if [[ ${libdir} = /lib ]] || [[ ${libdir} = /lib64 ]]
38 then
39 if [[ -L /lib ]] || [[ -L /lib64 ]]
40 then
41 prefix="/usr"
42 fi
43 fi
44 deps+=" $(magequery -e ${prefix}${soname})"
45 done
46 DEPNAME_LIST="$(for i in ${deps}; do echo ${i}; done | sort -u)"
47 export DEPNAME_LIST
48 }
49
50 build_soname_list
51 build_dep_list
52
53 #echo "${SONAME_LIST}"
54 echo "${DEPNAME_LIST}" | sed 's:\(.*\)-r.*:>= \1:'