Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / common / check-exports
1 #!/bin/sh
2 # check-exports
3 #
4 # quick'n'dirty script that retrieves the list of exported symbols of a given
5 # library using 'nm', and compares that against the list of symbols-to-export
6 # of our win32/common/libfoo.def files.
7
8 if [ $# -ne 2 ]; then
9         echo "Usage: $0 library.def library.so"
10         exit 1
11 fi
12
13 def_path="$1"
14 def_name="$(basename $def_path)"
15 lib_path="$2"
16
17 lib_result="`mktemp /tmp/defname.XXXXXX`"
18
19 LC_ALL=C
20 export LC_ALL
21
22 # On Solaris, add -p to get the correct output format
23 NMARGS=
24 if nm -V 2>&1 |grep Solaris > /dev/null; then
25   NMARGS=-p
26 fi
27
28 # FIXME 0.11: in 0.11, we should change the export filter to only export
29 # _gst_foo, but not __gst_foo (we can't change this now, since we added
30 # __gst_debug_min and __gst_debug_enabled at some point and need to keep
31 # ABI compatibility).  So below we special-case some symbols that shouldn't
32 # really be exported, either because we're too lazy to rename them to something
33 # that's not exported (like the _gst_parse_* stuff) or because we had them in
34 # public headers at some point although they shouldn't be and so we need to
35 # keep them exported now (like _gst_debug_init,
36 # __gst_element_factory_add_interface or
37 # __gst_element_factory_add_static_pad_template).  We suppress them here to
38 # make sure they're at least not exported in the windows msvc build (they
39 # were never in the .def file, so they never got exported).
40 # _end is special cased because for some reason it is reported as an exported
41 # BSS symbol, unlike on linux where it's a local absolute symbol.
42 nm $NMARGS $lib_path | awk \
43         '{
44                 if ($3 !~ /^_gst_parse_yy/ && \
45                     $3 !~ /^_gst_[a-z]*_init/ && \
46                     $3 !~ /^_gst_parse_launch/ && \
47                     $3 !~ /^__gst_element_details_/ && \
48                     $3 !~ /^__gst_element_factory_add_/ && \
49                     $3 !~ /^gst_interfaces_marshal/ && \
50                     $3 ~ /^[_]*(gst_|Gst|GST_).*/)
51                 {
52                         if ($2 ~ /^[BSDG]$/)
53                                 print "\t" $3 " DATA"
54                         else if ($2 == "T")
55                                 print "\t" $3
56                 }
57          }' | sort | awk '{ if (NR == 1) print "EXPORTS"; print $0; }' \
58         > $lib_result
59
60 diffoutput=`diff -u $def_path $lib_result`
61 diffresult=$?
62
63 rm $lib_result
64
65 if test "$diffresult" -eq 0; then
66   exit 0;
67 else
68   echo -n "$diffoutput" >&2
69   echo >&2
70   exit 1;
71 fi
72