3 # Extract symbols from the fips source code for functions that are wrapped.
5 # Output is a version script, (suitable to be passed to the linker
6 # through a compiler flag -f -Wl,--version-script=<foo>), which
7 # indicates that the extracted symbols should be exported from
8 # libfips, while all other symbols are private.
10 # We have two different patterns for identifying wrapped
11 # functions. The first is a call to one of the DEFER macros
12 # (GLWRAP_DEFER, TIMED_DEFER, WGLWRAP_DEFER_WITH_RETURN, etc.). In
13 # this case, the name of the wrapped function appears as the first or
14 # second argument to the macro, (second for the case of of
15 # _WITH_RETURN macro).
17 deferred=`grep 'DEFER[ (]*e*gl' $@ | sed -s 's/.*DEFER *(\([^,)]*\).*/\1/'`
19 deferred_return=`grep 'DEFER_WITH_RETURN *([^,]*, *e*gl' $@ | sed -s 's/.*DEFER_WITH_RETURN *([^,]*, *\([^,)]*\).*/\1/'`
21 # The second-case is functions for which we either implement or call
22 # the underlying "real" function. In these cases, the code uses the
23 # convention of having a function or a function-pointer with a name of
24 # the form *wrap_real_<function>
26 wrapped=`grep wrap_real_ $@ | sed -e 's/.*wrap_real_\([a-zA-Z0-9_]*\).*/\1/'`
28 # With those two lists collected, all we need is a simple template for
29 # a version script, along with alphabetic sorting and uniquifying of
30 # the list, (and adding tabs for nice-looking indentation and ';'
40 $wrapped" | sort | uniq | sed -e 's/\(.*\)/ \1;/'