summaryrefslogtreecommitdiff
path: root/src/make-static-lib-hidden-privates.sh
blob: 5bfd485d26d383f3df393482c684b054cb7220e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash -e

# This script takes a static library and removes all non-public symbols.
# Ie, it makes a static lib whose symbols are far less likely to clash with
# the symbols of another shared or static library.

grep sf_ Symbols.gnu-binutils | sed -e "s/[ ;]//g" > Symbols.static

ld -r --whole-archive .libs/libsndfile.a -o libsndfile_a.o

objcopy --keep-global-symbols=Symbols.static libsndfile_a.o libsndfile.o

rm -f libsndfile.a
ar cru libsndfile.a libsndfile.o