File: check-exports

package info (click to toggle)
gst-plugins-bad1.0 1.0.8-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 36,832 kB
  • sloc: ansic: 297,908; cpp: 22,677; sh: 13,303; xml: 6,362; makefile: 4,867; perl: 1,435; objc: 1,273; python: 362; sed: 16
file content (54 lines) | stat: -rwxr-xr-x 1,124 bytes parent folder | download | duplicates (36)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# check-exports
#
# quick'n'dirty script that retrieves the list of exported symbols of a given
# library using 'nm', and compares that against the list of symbols-to-export
# of our win32/common/libfoo.def files.

if [ $# -ne 2 ]; then
	echo "Usage: $0 library.def library.so"
	exit 1
fi

def_path="$1"
def_name="$(basename $def_path)"
lib_path="$2"

lib_result="`mktemp /tmp/defname.XXXXXX`"

LC_ALL=C
export LC_ALL

# On Solaris, add -p to get the correct output format
NMARGS=
if nm -V 2>&1 |grep Solaris > /dev/null; then
  NMARGS=-p
fi

# _end is special cased because for some reason it is reported as an exported
# BSS symbol, unlike on linux where it's a local absolute symbol.
nm $NMARGS $lib_path | awk \
	'{
		if ($3 ~ /^[_]?(gst_|Gst|GST_).*/)
		{
			if ($2 ~ /^[BSDG]$/)
				print "\t" $3 " DATA"
			else if ($2 == "T")
				print "\t" $3
		}
	 }' | sort | awk '{ if (NR == 1) print "EXPORTS"; print $0; }' \
	> $lib_result

diffoutput=`diff -u $def_path $lib_result`
diffresult=$?

rm $lib_result

if test "$diffresult" -eq 0; then
  exit 0;
else
  echo -n "$diffoutput" >&2
  echo >&2
  exit 1;
fi