diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2007-12-12 21:17:50 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2007-12-12 21:17:50 +0000 |
commit | 852791c6c0d381a57c2d24b6fb3af63095b02f9a (patch) | |
tree | 080dd2f2ac5d46a15720ffe814963a86cf4e558f | |
parent | 423e2ea96b5f79281f4dd20d734bd968b3d95e89 (diff) |
check-exports: Add quick'n'dirty script to check the exported symbols of a library against the symbols in the corresp...
Original commit message from CVS:
* check-exports:
Add quick'n'dirty script to check the exported symbols of a library
against the symbols in the corresponding .def file (#493983). Based
on script by Ole André Vadla Ravnås.
-rw-r--r-- | ChangeLog | 7 | ||||
-rwxr-xr-x | check-exports | 60 |
2 files changed, 67 insertions, 0 deletions
@@ -1,3 +1,10 @@ +2007-12-12 Tim-Philipp Müller <tim at centricular dot net> + + * check-exports: + Add quick'n'dirty script to check the exported symbols of a library + against the symbols in the corresponding .def file (#493983). Based + on script by Ole André Vadla Ravnås. + 2007-11-06 Jan Schmidt <jan.schmidt@sun.com> * gtk-doc-plugins.mak: diff --git a/check-exports b/check-exports new file mode 100755 index 0000000..5b7363a --- /dev/null +++ b/check-exports @@ -0,0 +1,60 @@ +#!/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 + +export LC_ALL=C + +def_path=$1 +def_name=$(basename $def_path) +lib_path=$2 + +lib_result=$(mktemp /tmp/defname.XXXXXX) + +# FIXME 0.11: in 0.11, we should change the export filter to only export +# _gst_foo, but not __gst_foo (we can't change this now, since we added +# __gst_debug_min and __gst_debug_enabled at some point and need to keep +# ABI compatibility). So below we special-case some symbols that shouldn't +# really be exported, either because we're too lazy to rename them to something +# that's not exported (like the _gst_parse_* stuff) or because we had them in +# public headers at some point although they shouldn't be and so we need to +# keep them exported now (like _gst_debug_init, +# __gst_element_factory_add_interface or +# __gst_element_factory_add_static_pad_template). We suppress them here to +# make sure they're at least not exported in the windows msvc build (they +# were never in the .def file, so they never got exported). +nm $lib_path | awk \ + '{ + if ($3 !~ /^_gst_parse_yy/ && + $3 !~ /^_gst_[a-z]*_init/ && + $3 !~ /^_gst_parse_launch/ && + $3 !~ /^__gst_element_details_/ && + $3 !~ /^__gst_element_factory_add_/) + { + if ($2 == "B") + 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` + +rm $lib_result + +if test "x$diffoutput" = "x"; then + exit 0; +else + echo -n "$diffoutput" >&2 + echo >&2 + exit 1; +fi + |