summaryrefslogtreecommitdiff
path: root/autodeps/sparc-linux.prov
blob: fa9511357d736d816c2a10b3997cb759ee02fe4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

# This script reads filenames from STDIN and outputs any relevant provides
# information that needs to be included in the package.

filelist=$(grep "\\.so" | grep -v "^/lib/ld.so" | xargs file -L 2>/dev/null | grep "ELF.*shared object" | cut -d: -f1)

for f in $filelist; do
    soname=$(objdump -p $f | awk '/SONAME/ {print $2}')

    lib64=`if file -L $f 2>/dev/null | grep "ELF 64-bit" >/dev/null; then echo "()(64bit)"; fi`
    if [ "$soname" != "" ]; then
	if [ ! -L $f ]; then
	    echo $soname$lib64
	    objdump -p $f | awk '
		BEGIN { START=0 ; }
		/Version definitions:/ { START=1; }
		/^[0-9]/ && (START==1) { print $4; }
		/^$/ { START=0; }
	    ' | \
		grep -v $soname | \
		while read symbol ; do
		    echo "$soname($symbol)`echo $lib64 | sed 's/()//'`"
		done
	fi
    else
	echo ${f##*/}$lib64
    fi
done | sort -u