2014-05-06 14:43:46 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
export PREFIX="$(pwd)/libsodium-js"
|
|
|
|
export EXPORTED_FUNCTIONS='["_sodium_version_string"]'
|
2014-07-12 19:25:17 -07:00
|
|
|
export TOTAL_MEMORY=33554432
|
2014-05-06 14:43:46 -07:00
|
|
|
export OPTFLAGS="--llvm-lto 3 -Oz"
|
|
|
|
export CFLAGS="$OPTFLAGS --pre-js=test/default/pre.js "
|
2014-07-12 19:25:17 -07:00
|
|
|
export LDFLAGS="-s EXPORTED_FUNCTIONS=${EXPORTED_FUNCTIONS} -s TOTAL_MEMORY=${TOTAL_MEMORY}"
|
2014-05-06 14:43:46 -07:00
|
|
|
|
2014-07-09 21:14:27 -07:00
|
|
|
emconfigure ./configure --enable-minimal --disable-shared --prefix="$PREFIX" && \
|
2014-05-06 14:43:46 -07:00
|
|
|
emmake make clean &&
|
|
|
|
emmake make install &&
|
|
|
|
emcc --closure 1 $OPTFLAGS $LDFLAGS \
|
|
|
|
"${PREFIX}/lib/libsodium.a" -o "${PREFIX}/lib/libsodium.js"
|