Imported Upstream version 0.9.3
[platform/upstream/harfbuzz.git] / src / check-exported-symbols.sh
1 #!/bin/sh
2
3 LC_ALL=C
4 export LC_ALL
5
6 test -z "$srcdir" && srcdir=.
7 test -z "$MAKE" && MAKE=make
8 stat=0
9
10 if which nm 2>/dev/null >/dev/null; then
11         :
12 else
13         echo "check-exported-symbols.sh: 'nm' not found; skipping test"
14         exit 77
15 fi
16
17 defs="harfbuzz.def"
18 $MAKE $defs > /dev/null
19 tested=false
20 for def in $defs; do
21         lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'`
22         so=.libs/lib${lib}.so
23         if test -f "$so"; then
24                 echo "Checking that $so has the same symbol list as $def"
25                 {
26                         echo EXPORTS
27                         nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>' | cut -d' ' -f3
28                         stat=1
29                         # cheat: copy the last line from the def file!
30                         tail -n1 "$def"
31                 } | diff "$def" - >&2 || stat=1
32                 tested=true
33         fi
34 done
35 if ! $tested; then
36         echo "check-exported-symbols.sh: libharfbuzz shared library not found; skipping test"
37         exit 77
38 fi
39
40 exit $stat