forked from couchbaselabs/couchbase-lite-libcrypto
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild-emscripten.sh
executable file
·63 lines (46 loc) · 1.21 KB
/
build-emscripten.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
set -e
# export OPENSSL_VERSION="openssl-1.0.2o"
curl -O "https://www.openssl.org/source/${OPENSSL_VERSION}.tar.gz"
tar xfz "${OPENSSL_VERSION}.tar.gz"
OPENSSL_CONFIG_OPTIONS=$(cat config-params-emscripten.txt)
OUTPUT_DIR="libs/wasm"
export CC=emcc
export CXX=emcc
export LINK=${CXX}
export ARCH_FLAGS=""
export ARCH_LINK=""
export CPPFLAGS=" ${ARCH_FLAGS} "
export CXXFLAGS=" ${ARCH_FLAGS} "
export CFLAGS=" ${ARCH_FLAGS} "
export LDFLAGS=" ${ARCH_LINK} "
# Clean output:
rm -rf $OUTPUT_DIR
mkdir $OUTPUT_DIR
build_webassembly() {
echo "Building libcrypto.a & libssl.so for WebAssembly"
cd "${OPENSSL_VERSION}"
# Config:
./Configure dist
./config ${OPENSSL_CONFIG_OPTIONS} -fPIC shared no-threads no-asm no-sse2
# Remove test
rm -rf test
# Make depend:
make depend -j8
# Make libcrypto:
make build_libs -j8
# Copy libcrypto.a to temp output directory:
file libcrypto.a
file libcrypto.so
file libcrypto.so
file libssl.so
#mkdir ../${OUTPUT_DIR}
cp libcrypto.a ../${OUTPUT_DIR}/libcrypto.a
cp libssl.a ../${OUTPUT_DIR}/libssl.a
cp libcrypto.so ../${OUTPUT_DIR}/libcrypto.so
cp libssl.so ../${OUTPUT_DIR}/libssl.so
# Cleanup:
make clean
cd ..
}
build_webassembly