2016-03-21 13:00:56 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
2017-08-25 06:11:37 -07:00
|
|
|
set -e
|
2016-03-21 13:00:56 -07:00
|
|
|
|
2022-12-09 13:10:58 -07:00
|
|
|
LIBSODIUM=${LIBSODIUM:-/tmp/sodium/lib/libsodium.27.dylib}
|
|
|
|
|
2017-08-25 06:11:37 -07:00
|
|
|
symbols() {
|
|
|
|
{
|
|
|
|
SUMO="$1"
|
|
|
|
while read symbol standard sumo; do
|
|
|
|
found="$standard"
|
2017-08-25 06:18:55 -07:00
|
|
|
if [ "x$SUMO" = "xsumo" ]; then
|
2017-08-25 06:11:37 -07:00
|
|
|
found="$sumo"
|
|
|
|
fi
|
|
|
|
if [ "$found" = "1" ]; then
|
|
|
|
eval "defined_${symbol}=yes"
|
|
|
|
else
|
|
|
|
eval "defined_${symbol}=no"
|
2016-03-21 13:00:56 -07:00
|
|
|
fi
|
2020-07-04 06:32:13 -07:00
|
|
|
done <emscripten-symbols.def
|
2017-08-25 06:11:37 -07:00
|
|
|
|
2022-12-09 13:10:58 -07:00
|
|
|
/usr/bin/nm "$LIBSODIUM" |
|
2020-07-04 06:32:13 -07:00
|
|
|
fgrep ' T _' |
|
|
|
|
cut -d' ' -f3 | {
|
2017-08-25 06:11:37 -07:00
|
|
|
while read symbol; do
|
|
|
|
eval "found=\$defined_${symbol}"
|
|
|
|
if [ "$found" = "yes" ]; then
|
|
|
|
echo "$symbol"
|
|
|
|
elif [ "$found" != "no" ]; then
|
|
|
|
echo >&2
|
|
|
|
echo "*** [$symbol] was not expected ***" >&2
|
|
|
|
echo >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2020-07-04 06:32:13 -07:00
|
|
|
} |
|
|
|
|
sort |
|
2017-08-25 06:11:37 -07:00
|
|
|
{
|
2017-12-25 15:32:25 -07:00
|
|
|
out='"_malloc","_free"'
|
2020-07-04 06:32:13 -07:00
|
|
|
while read symbol; do
|
2017-08-25 06:11:37 -07:00
|
|
|
if [ ! -z "$out" ]; then
|
|
|
|
out="${out},"
|
|
|
|
fi
|
|
|
|
out="${out}\"${symbol}\""
|
|
|
|
done
|
|
|
|
echo "[${out}]"
|
|
|
|
}
|
2016-03-21 13:00:56 -07:00
|
|
|
}
|
2017-08-25 06:11:37 -07:00
|
|
|
|
|
|
|
out=$(symbols standard)
|
2020-07-04 06:32:13 -07:00
|
|
|
sed s/EXPORTED_FUNCTIONS_STANDARD=\'.*\'/EXPORTED_FUNCTIONS_STANDARD=\'${out}\'/ <emscripten.sh >emscripten.sh.tmp &&
|
2017-08-25 06:11:37 -07:00
|
|
|
mv -f emscripten.sh.tmp emscripten.sh
|
|
|
|
|
|
|
|
out=$(symbols sumo)
|
2020-07-04 06:32:13 -07:00
|
|
|
sed s/EXPORTED_FUNCTIONS_SUMO=\'.*\'/EXPORTED_FUNCTIONS_SUMO=\'${out}\'/ <emscripten.sh >emscripten.sh.tmp &&
|
2017-08-25 06:11:37 -07:00
|
|
|
mv -f emscripten.sh.tmp emscripten.sh
|
2017-08-25 11:37:17 -07:00
|
|
|
|
2017-09-28 23:22:01 -07:00
|
|
|
chmod +x emscripten.sh
|