Skip to content

Instantly share code, notes, and snippets.

@alienzhou
Created November 28, 2021 16:49
Show Gist options
  • Save alienzhou/6fa93bf30241f09612ca0e7ed2115f6e to your computer and use it in GitHub Desktop.
Save alienzhou/6fa93bf30241f09612ca0e7ed2115f6e to your computer and use it in GitHub Desktop.
Creates OpenSSL as WASM
#!/bin/sh
OPENSSL="openssl-1.1.1d"
if [ -d ${OPENSSL} ]; then
rm -rf ${OPENSSL}
fi
if [ ! -f ${OPENSSL}.tar.gz ]; then
curl -O https://www.openssl.org/source/${OPENSSL}.tar.gz
fi
tar xf ${OPENSSL}.tar.gz
cd ${OPENSSL} || exit 1
emconfigure ./Configure \
linux-generic64 \
no-asm \
no-threads \
no-engine \
no-hw \
no-weak-ssl-ciphers \
no-dtls \
no-shared \
no-dso \
--prefix=$EMSCRIPTEN/system
sed -i 's|^CROSS_COMPILE.*$|CROSS_COMPILE=|g' Makefile
sed -i '/^CFLAGS/ s/$/ -D__STDC_NO_ATOMICS__=1/' Makefile
sed -i '/^CXXFLAGS/ s/$/ -D__STDC_NO_ATOMICS__=1/' Makefile
emmake make -j 1 build_generated libssl.a libcrypto.a
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment