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
if [ "x$1" = "x--sumo" ]; then
SUMO=yes
fi
set -e
symbols() {
{
SUMO="$1"
while read symbol standard sumo; do
found="$standard"
if [ "x$SUMO" != "x" ]; then
if [ "x$SUMO" != "sumo" ]; then
found="$sumo"
fi
if [ "$found" = "1" ]; then
@ -35,9 +35,24 @@ cut -d' ' -f3 | {
} | \
sort | \
{
out=''
while read symbol ; do
out="${out},\"${symbol}\""
if [ ! -z "$out" ]; then
out="${out},"
fi
out="${out}\"${symbol}\""
done
echo $out
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