From d33d0f08e09ae9f5bbacfeaffd522a5b38024c65 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 6 May 2014 14:43:46 -0700 Subject: [PATCH] Preliminary build script for Emscripten --- dist-build/Makefile.am | 1 + dist-build/emscripten.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100755 dist-build/emscripten.sh diff --git a/dist-build/Makefile.am b/dist-build/Makefile.am index d888f6a0..05efe6a7 100644 --- a/dist-build/Makefile.am +++ b/dist-build/Makefile.am @@ -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 diff --git a/dist-build/emscripten.sh b/dist-build/emscripten.sh new file mode 100755 index 00000000..810c434c --- /dev/null +++ b/dist-build/emscripten.sh @@ -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"