1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-28 22:21:15 -07:00
libsodium/dist-build/emscripten.sh

15 lines
543 B
Bash
Raw Normal View History

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