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