blob: 930722c1bb8aa17053956e3dc5b03226c9c4a054 [file] [log] [blame]
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +01001#!/bin/sh
2
3set -eu
4
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +02005if [ -d include/mbedtls ]; then :; else
6 echo "$0: must be run from root" >&2
7 exit 1
8fi
9
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010010if grep -i cmake Makefile >/dev/null; then
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020011 echo "$0: not compatible with cmake" >&2
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010012 exit 1
13fi
14
Manuel Pégourié-Gonnard9afdc832015-08-04 17:15:13 +020015cp include/mbedtls/config.h include/mbedtls/config.h.bak
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010016scripts/config.pl full
Jaeden Amero3b025ac2019-05-31 12:26:42 +010017make clean
Gilles Peskine9a52cf32019-05-22 18:22:58 +020018make_ret=
Jaeden Amero3b025ac2019-05-31 12:26:42 +010019CFLAGS=-fno-asynchronous-unwind-tables make lib \
Gilles Peskine9a52cf32019-05-22 18:22:58 +020020 >list-symbols.make.log 2>&1 ||
21 {
22 make_ret=$?
Jaeden Amero3b025ac2019-05-31 12:26:42 +010023 echo "Build failure: CFLAGS=-fno-asynchronous-unwind-tables make lib"
Gilles Peskine9a52cf32019-05-22 18:22:58 +020024 cat list-symbols.make.log >&2
25 }
26rm list-symbols.make.log
Manuel Pégourié-Gonnard9afdc832015-08-04 17:15:13 +020027mv include/mbedtls/config.h.bak include/mbedtls/config.h
Gilles Peskine9a52cf32019-05-22 18:22:58 +020028if [ -n "$make_ret" ]; then
29 exit "$make_ret"
30fi
31
Manuel Pégourié-Gonnardbf6ed082015-08-04 17:34:18 +020032if uname | grep -F Darwin >/dev/null; then
33 nm -gUj library/libmbed*.a 2>/dev/null | sed -n -e 's/^_//p'
34elif uname | grep -F Linux >/dev/null; then
35 nm -og library/libmbed*.a | grep -v '^[^ ]*: *U \|^$\|^[^ ]*:$' | sed 's/^[^ ]* . //'
36fi | sort > exported-symbols
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010037make clean
38
39wc -l exported-symbols