2019-08-28 17:20:42 +00:00
|
|
|
#!/bin/sh
|
2019-08-27 13:36:06 +00:00
|
|
|
|
|
|
|
# Where to find the sources
|
|
|
|
ZSTD_SRC_ROOT="../../lib"
|
|
|
|
|
|
|
|
# Temporary compiled binary
|
|
|
|
OUT_FILE="tempbin"
|
|
|
|
|
|
|
|
# Optional temporary compiled WebAssembly
|
|
|
|
OUT_WASM="temp.wasm"
|
|
|
|
|
|
|
|
# Amalgamate the sources
|
2019-08-27 23:01:39 +00:00
|
|
|
./create_single_file_decoder.sh
|
2019-08-27 13:36:06 +00:00
|
|
|
# Did combining work?
|
|
|
|
if [ $? -ne 0 ]; then
|
2019-08-27 23:01:39 +00:00
|
|
|
echo "Single file decoder creation script: FAILED"
|
2019-08-27 13:36:06 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-08-27 23:01:39 +00:00
|
|
|
echo "Single file decoder creation script: PASSED"
|
2019-08-27 13:36:06 +00:00
|
|
|
|
|
|
|
# Compile the generated output
|
2019-09-02 16:02:50 +00:00
|
|
|
cc -Wall -Wextra -Werror -Os -g0 -o $OUT_FILE examples/simple.c
|
2019-08-27 13:36:06 +00:00
|
|
|
# Did compilation work?
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Compiling simple.c: FAILED"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Compiling simple.c: PASSED"
|
|
|
|
|
|
|
|
# Run then delete the compiled output
|
|
|
|
./$OUT_FILE
|
|
|
|
retVal=$?
|
|
|
|
rm -f $OUT_FILE
|
|
|
|
# Did the test work?
|
|
|
|
if [ $retVal -ne 0 ]; then
|
|
|
|
echo "Running simple.c: FAILED"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Running simple.c: PASSED"
|
|
|
|
|
|
|
|
# Is Emscripten available?
|
|
|
|
which emcc > /dev/null
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "(Skipping Emscripten test)"
|
2019-08-27 15:12:57 +00:00
|
|
|
else
|
|
|
|
# Compile the Emscripten example
|
2019-09-02 16:02:50 +00:00
|
|
|
CC_FLAGS="-Wall -Wextra -Werror -Os -g0 -flto --llvm-lto 3 -lGL -DNDEBUG=1"
|
2019-08-27 15:12:57 +00:00
|
|
|
emcc $CC_FLAGS -s WASM=1 -o $OUT_WASM examples/emscripten.c
|
|
|
|
# Did compilation work?
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Compiling emscripten.c: FAILED"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Compiling emscripten.c: PASSED"
|
|
|
|
rm -f $OUT_WASM
|
2019-08-27 13:36:06 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|