Preliminary build script for Emscripten

This commit is contained in:
Frank Denis 2014-05-06 14:43:46 -07:00
parent 394e654c40
commit d33d0f08e0
2 changed files with 14 additions and 0 deletions

View File

@ -4,6 +4,7 @@ EXTRA_DIST = \
android-arm.sh \
android-x86.sh \
android-mips.sh \
emscripten.sh \
ios.sh \
msys2-win32.sh \
msys2-win64.sh

13
dist-build/emscripten.sh Executable file
View File

@ -0,0 +1,13 @@
#! /bin/sh
export PREFIX="$(pwd)/libsodium-js"
export EXPORTED_FUNCTIONS='["_sodium_version_string"]'
export OPTFLAGS="--llvm-lto 3 -Oz"
export CFLAGS="$OPTFLAGS --pre-js=test/default/pre.js "
export LDFLAGS="-s EXPORTED_FUNCTIONS=${EXPORTED_FUNCTIONS}"
emconfigure ./configure --disable-shared --prefix="$PREFIX" && \
emmake make clean &&
emmake make install &&
emcc --closure 1 $OPTFLAGS $LDFLAGS \
"${PREFIX}/lib/libsodium.a" -o "${PREFIX}/lib/libsodium.js"