Better tdweb build scripts.

GitOrigin-RevId: 2d44117df420202b8d5d1dc4edbba875d6149c82
This commit is contained in:
levlam 2018-12-23 00:46:48 +03:00
parent d164512c4e
commit 209b9454d9
4 changed files with 24 additions and 18 deletions

View File

@ -1,18 +1,23 @@
#!/bin/sh
emconfigure || { echo 'emconfigure not found. Install Emscripten and add emconfigure and emmake to PATH environment variable'; exit 1; }
OPENSSL=OpenSSL_1_1_0j
if [ ! -f $OPENSSL.tar.gz ]; then
echo "Download openssl"
echo "Downloading OpenSSL sources..."
wget https://github.com/openssl/openssl/archive/$OPENSSL.tar.gz
fi
rm -rf ./$OPENSSL
echo "Unpacking OpenSSL sources..."
tar xzf $OPENSSL.tar.gz || exit 1
cd openssl-$OPENSSL
emconfigure ./Configure linux-generic32 no-shared
sed -i bak 's/CROSS_COMPILE=.*/CROSS_COMPILE=/g' Makefile
emmake make depend -s || exit 1
emmake make -s || exit 1
emconfigure ./Configure linux-generic32 no-shared no-dso no-engine no-unit-test no-ui || exit 1
sed -i.bak 's/CROSS_COMPILE=.*/CROSS_COMPILE=/g' Makefile || exit 1
sed -i 's/-ldl //g' Makefile || exit 1
echo "Building OpenSSL..."
emmake make depend || exit 1
emmake make -j 4 || exit 1
rm -rf ../build/crypto || exit 1
mkdir -p ../build/crypto/lib || exit 1

View File

@ -1,3 +1,5 @@
emconfigure || { echo 'emconfigure not found. Install Emscripten and add emconfigure to PATH environment variable'; exit 1; }
mkdir -p build/generate
mkdir -p build/asmjs
mkdir -p build/wasm
@ -18,20 +20,19 @@ OPENSSL_OPTIONS="-DOPENSSL_FOUND=1 \
pushd .
cd build/wasm
eval emconfigure cmake $TD_ROOT -GNinja $OPENSSL_OPTIONS
eval emconfigure cmake $TD_ROOT -GNinja $OPENSSL_OPTIONS || exit 1
popd
pushd .
cd build/asmjs
eval emconfigure cmake $TD_ROOT -GNinja -DASMJS=1 $OPENSSL_OPTIONS
eval emconfigure cmake $TD_ROOT -GNinja -DASMJS=1 $OPENSSL_OPTIONS || exit 1
popd
pushd .
cd build/generate
cmake $TD_ROOT -GNinja
cmake $TD_ROOT -GNinja || exit 1
popd
cmake --build build/generate -j --target prepare_cross_compiling
cmake --build build/wasm -j --target td_wasm
cmake --build build/asmjs -j --target td_asmjs
cmake --build build/generate -j --target prepare_cross_compiling || exit 1
cmake --build build/wasm -j --target td_wasm || exit 1
cmake --build build/asmjs -j --target td_asmjs || exit 1

View File

@ -1,4 +1,4 @@
pushd .
cd tdweb
npm install
npm run build
npm install || exit 1
npm run build || exit 1

View File

@ -1,4 +1,4 @@
dest=tdweb/src/prebuilt/release/
mkdir -p $dest
cp build/wasm/td_wasm.{js,wasm} $dest
cp build/asmjs/td_asmjs.js{,.mem} $dest
DEST=tdweb/src/prebuilt/release/
mkdir -p $DEST
cp build/wasm/td_wasm.{js,wasm} $DEST
cp build/asmjs/td_asmjs.js{,.mem} $DEST