2018-12-21 17:03:26 +01:00
#!/bin/sh
2021-12-08 17:43:21 +01:00
cd $( dirname $0 )
2018-12-21 17:03:26 +01:00
2019-12-23 18:33:03 +01:00
emconfigure true 2> /dev/null || { echo 'emconfigure not found. Install emsdk and add emconfigure and emmake to PATH environment variable. See instruction at https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html. Do not forget to add `emconfigure` and `emmake` to the PATH environment variable via `emsdk/emsdk_env.sh` script.' ; exit 1; }
2018-12-22 22:46:48 +01:00
2023-03-26 21:36:09 +02:00
OPENSSL = OpenSSL_1_1_0l
2018-12-21 17:03:26 +01:00
if [ ! -f $OPENSSL .tar.gz ] ; then
2018-12-22 22:46:48 +01:00
echo "Downloading OpenSSL sources..."
2023-10-05 20:50:53 +02:00
curl -sfLO https://github.com/openssl/openssl/archive/$OPENSSL .tar.gz
2018-12-21 17:03:26 +01:00
fi
2018-12-26 11:32:13 +01:00
rm -rf ./openssl-$OPENSSL
2018-12-22 22:46:48 +01:00
echo "Unpacking OpenSSL sources..."
2018-12-21 17:03:26 +01:00
tar xzf $OPENSSL .tar.gz || exit 1
cd openssl-$OPENSSL
2019-12-23 18:33:03 +01:00
emconfigure ./Configure linux-generic32 no-shared no-threads no-dso no-engine no-unit-test no-ui || exit 1
2018-12-22 22:46:48 +01:00
sed -i.bak 's/CROSS_COMPILE=.*/CROSS_COMPILE=/g' Makefile || exit 1
2018-12-24 02:34:19 +01:00
sed -i.bak 's/-ldl //g' Makefile || exit 1
2019-06-28 13:03:06 +02:00
sed -i.bak 's/-O3/-Os/g' Makefile || exit 1
2018-12-22 22:46:48 +01:00
echo "Building OpenSSL..."
emmake make depend || exit 1
emmake make -j 4 || exit 1
2018-12-21 17:03:26 +01:00
rm -rf ../build/crypto || exit 1
mkdir -p ../build/crypto/lib || exit 1
cp libcrypto.a libssl.a ../build/crypto/lib/ || exit 1
cp -r include ../build/crypto/ || exit 1
cd ..