c98a07b0c701e70f4963c17c63c42a19de2e6cf0
[notmuch] / lib / gen-version-script.sh
1 set -eu
2
3 # we go through a bit of work to get the unmangled names of the
4 # typeinfo symbols because of
5 # https://sourceware.org/bugzilla/show_bug.cgi?id=10326
6
7 if [ $# -lt 2 ]; then
8     echo Usage: $0 header obj1 obj2 obj3
9     exit 1;
10 fi
11
12 HEADER=$1
13 shift
14
15 printf '{\nglobal:\n'
16 nm  $* | awk '$1 ~ "^[0-9a-fA-F][0-9a-fA-F]*$" && $3 ~ "Xapian.*Error" {print $3}' | sort | uniq | \
17 while read sym; do
18     demangled=$(c++filt $sym)
19     case $demangled in
20         typeinfo*)
21             printf "\t$sym;\n"
22             ;;
23         *)
24             ;;
25     esac
26 done
27 sed  -n 's/^[[:space:]]*\(notmuch_[a-z_]*\)[[:space:]]*(.*/ \1;/p' $HEADER
28 printf "local: *;\n};\n"