Have generate-emscripten-symbols.sh automatically update the js/wasm build script

This commit is contained in:
Frank Denis 2017-08-25 15:11:37 +02:00
parent aa20d2e86e
commit cd721cfc1f

View File

@ -1,13 +1,13 @@
#! /bin/sh #! /bin/sh
if [ "x$1" = "x--sumo" ]; then set -e
SUMO=yes
fi
{ symbols() {
while read symbol standard sumo; do {
SUMO="$1"
while read symbol standard sumo; do
found="$standard" found="$standard"
if [ "x$SUMO" != "x" ]; then if [ "x$SUMO" != "sumo" ]; then
found="$sumo" found="$sumo"
fi fi
if [ "$found" = "1" ]; then if [ "$found" = "1" ]; then
@ -15,11 +15,11 @@ while read symbol standard sumo; do
else else
eval "defined_${symbol}=no" eval "defined_${symbol}=no"
fi fi
done < emscripten-symbols.def done < emscripten-symbols.def
nm /usr/local/lib/libsodium.18.dylib | \ nm /usr/local/lib/libsodium.18.dylib | \
fgrep ' T _' | \ fgrep ' T _' | \
cut -d' ' -f3 | { cut -d' ' -f3 | {
while read symbol; do while read symbol; do
eval "found=\$defined_${symbol}" eval "found=\$defined_${symbol}"
if [ "$found" = "yes" ]; then if [ "$found" = "yes" ]; then
@ -32,12 +32,27 @@ cut -d' ' -f3 | {
fi fi
done done
} }
} | \ } | \
sort | \ sort | \
{ {
out='' while read symbol ; do
while read symbol ; do if [ ! -z "$out" ]; then
out="${out},\"${symbol}\"" out="${out},"
done fi
echo $out out="${out}\"${symbol}\""
done
echo "[${out}]"
}
} }
out=$(symbols standard)
sed s/EXPORTED_FUNCTIONS_STANDARD=\'.*\'/EXPORTED_FUNCTIONS_STANDARD=\'${out}\'/ < emscripten.sh > emscripten.sh.tmp && \
mv -f emscripten.sh.tmp emscripten.sh
sed s/EXPORTED_FUNCTIONS_STANDARD=\'.*\'/EXPORTED_FUNCTIONS_STANDARD=\'${out}\'/ < emscripten-wasm.sh > emscripten-wasm.sh.tmp && \
mv -f emscripten-wasm.sh.tmp emscripten-wasm.sh
out=$(symbols sumo)
sed s/EXPORTED_FUNCTIONS_SUMO=\'.*\'/EXPORTED_FUNCTIONS_SUMO=\'${out}\'/ < emscripten.sh > emscripten.sh.tmp && \
mv -f emscripten.sh.tmp emscripten.sh
sed s/EXPORTED_FUNCTIONS_SUMO=\'.*\'/EXPORTED_FUNCTIONS_SUMO=\'${out}\'/ < emscripten-wasm.sh > emscripten-wasm.sh.tmp && \
mv -f emscripten-wasm.sh.tmp emscripten-wasm.sh