blob: e000b01b8631007afffc7ea82a3b2b6a7fb138ce [file] [log] [blame]
Behdad Esfahboda02d8642012-08-08 18:04:29 -04001#!/bin/sh
2
3LC_ALL=C
4export LC_ALL
5
6test -z "$srcdir" && srcdir=.
Behdad Esfahboda02d8642012-08-08 18:04:29 -04007stat=0
8
Behdad Esfahbod2af82622013-09-16 21:49:56 -04009
Behdad Esfahboda02d8642012-08-08 18:04:29 -040010if which nm 2>/dev/null >/dev/null; then
11 :
12else
Behdad Esfahbodbafdf3d2013-02-04 23:06:50 -050013 echo "check-symbols.sh: 'nm' not found; skipping test"
Behdad Esfahboda02d8642012-08-08 18:04:29 -040014 exit 77
15fi
16
Behdad Esfahbod2af82622013-09-16 21:49:56 -040017echo "Checking that we are not exposing internal symbols"
Behdad Esfahboda02d8642012-08-08 18:04:29 -040018tested=false
Behdad Esfahbod2af82622013-09-16 21:49:56 -040019for so in `ls .libs/lib*.so .libs/lib*.dylib 2>/dev/null` ; do
20
Behdad Esfahbod5fd996c2014-04-09 16:38:26 -070021 EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>' | cut -d' ' -f3`"
Behdad Esfahbod2af82622013-09-16 21:49:56 -040022 prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
Behdad Esfahbodbafdf3d2013-02-04 23:06:50 -050023
Behdad Esfahbod2af82622013-09-16 21:49:56 -040024 echo "Processing $so"
25 if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}_"; then
26 echo "Ouch, internal symbols exposed"
27 stat=1
Behdad Esfahboda02d8642012-08-08 18:04:29 -040028 fi
Behdad Esfahbod2af82622013-09-16 21:49:56 -040029
30 tested=true
Behdad Esfahboda02d8642012-08-08 18:04:29 -040031done
32if ! $tested; then
Behdad Esfahbod2af82622013-09-16 21:49:56 -040033 echo "check-symbols.sh: no shared library found; skipping test"
Behdad Esfahboda02d8642012-08-08 18:04:29 -040034 exit 77
35fi
36
37exit $stat