gfx/harfbuzz/src/check-symbols.sh

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rwxr-xr-x

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 #!/bin/sh
michael@0 2
michael@0 3 LC_ALL=C
michael@0 4 export LC_ALL
michael@0 5
michael@0 6 test -z "$srcdir" && srcdir=.
michael@0 7 stat=0
michael@0 8
michael@0 9
michael@0 10 if which nm 2>/dev/null >/dev/null; then
michael@0 11 :
michael@0 12 else
michael@0 13 echo "check-symbols.sh: 'nm' not found; skipping test"
michael@0 14 exit 77
michael@0 15 fi
michael@0 16
michael@0 17 echo "Checking that we are not exposing internal symbols"
michael@0 18 tested=false
michael@0 19 for so in `ls .libs/lib*.so .libs/lib*.dylib 2>/dev/null` ; do
michael@0 20
michael@0 21 EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>' | cut -d' ' -f3`"
michael@0 22 prefix=`basename "$so" | sed 's/libharfbuzz/hb/; s/-/_/g; s/[.].*//'`
michael@0 23
michael@0 24 echo "Processing $so"
michael@0 25 if echo "$EXPORTED_SYMBOLS" | grep -v "^${prefix}_"; then
michael@0 26 echo "Ouch, internal symbols exposed"
michael@0 27 stat=1
michael@0 28 fi
michael@0 29
michael@0 30 tested=true
michael@0 31 done
michael@0 32 if ! $tested; then
michael@0 33 echo "check-symbols.sh: no shared library found; skipping test"
michael@0 34 exit 77
michael@0 35 fi
michael@0 36
michael@0 37 exit $stat

mercurial