Alexandre Lision | 7c6f4a6 | 2013-09-05 13:27:01 -0400 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | # This script takes a static library and removes all non-public symbols. |
| 4 | # Ie, it makes a static lib whose symbols are far less likely to clash with |
| 5 | # the symbols of another shared or static library. |
| 6 | |
| 7 | grep sf_ Symbols.gnu-binutils | sed -e "s/[ ;]//g" > Symbols.static |
| 8 | |
| 9 | ld -r --whole-archive .libs/libsndfile.a -o libsndfile_a.o |
| 10 | |
| 11 | objcopy --keep-global-symbols=Symbols.static libsndfile_a.o libsndfile.o |
| 12 | |
| 13 | rm -f libsndfile.a |
| 14 | ar cru libsndfile.a libsndfile.o |