Add libcurl to build, but do not activate it yet

master
paradust7 2022-04-01 02:33:27 +00:00
parent 76e2800c3c
commit 5b610f3df5
6 changed files with 69 additions and 1 deletions

View File

@ -15,6 +15,8 @@ Pre-requisites
The Emscripten SDK (emsdk) must be installed, activated, and in the PATH.
It is assumed to be installed in $HOME/emsdk (edit `common.sh` to change this).
Apply the patch `emcc.patch` to the emsdk directory. This is needed for configure to work with pthreads.
Building
---------

View File

@ -16,6 +16,7 @@ emcc --clear-cache --clear-ports
./build_zstd.sh
./build_sqlite3.sh
./build_webshims.sh
./build_curl.sh # uses webshims
# Minetest
./pull_minetest.sh

46
build_curl.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash -eux
source common.sh
UPSTREAM="https://curl.se/download/curl-7.82.0.tar.bz2"
TARBALL="curl-7.82.0.tar.bz2"
TARDIR="curl-7.82.0"
if [ ! -f sources/"$TARBALL" ]; then
pushd sources
wget "$UPSTREAM" -O "$TARBALL"
popd
fi
if ! sha256sum sources/"$TARBALL" | grep -q 46d9a0400a33408fd992770b04a44a7434b3036f2e8089ac28b57573d59d371f; then
echo "Wrong checksum for $TARDIR"
exit 1
fi
pushd build
rm -rf "$TARDIR"
tar -jxvf "$SRC_DIR/$TARBALL"
# Wrap socket ops
$SRC_DIR/webshims/src/emsocket/wrap.py "$TARDIR"
rm -rf curl-build
mkdir curl-build
pushd curl-build
# For emsocket.h
export CFLAGS="-I${INSTALL_DIR}/include"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L${INSTALL_DIR}/lib -lemsocket"
emcmake cmake \
-DCURL_ENABLE_SSL=OFF \
-DBUILD_CURL_EXE=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
../"$TARDIR"
emmake make -j4
emmake make install
echo "curl OK"

View File

@ -2,7 +2,7 @@
source common.sh
if [ ! -d src/freetype ]; then
if [ ! -d sources/freetype ]; then
pushd sources
git clone https://gitlab.freedesktop.org/freetype/freetype.git freetype
popd

View File

@ -26,6 +26,9 @@ echo > dummy.c
emcc -c dummy.c -o dummy.o
DUMMY_OBJECT="$(pwd)/dummy.o"
# -DCURL_LIBRARY="$INSTALL_DIR/lib/libcurl.a" \
# -DCURL_INCLUDE_DIR="$INSTALL_DIR/include" \
if ! $INCREMENTAL; then
emcmake cmake \
-DENABLE_SYSTEM_GMP=OFF \

16
emcc.patch Normal file
View File

@ -0,0 +1,16 @@
--- emsdk1/upstream/emscripten/emcc.py 2022-03-24 19:45:37.000000000 +0000
+++ emsdk2/upstream/emscripten/emcc.py 2022-03-28 19:42:22.309947641 +0000
@@ -605,9 +605,10 @@
def make_js_executable(script):
src = read_file(script)
cmd = shared.shlex_join(config.JS_ENGINE)
- if not os.path.isabs(config.JS_ENGINE[0]):
- # TODO: use whereis etc. And how about non-*NIX?
- cmd = '/usr/bin/env -S ' + cmd
+ #if not os.path.isabs(config.JS_ENGINE[0]):
+ # # TODO: use whereis etc. And how about non-*NIX?
+ cmd = '/usr/bin/env -S ' + cmd
+ cmd = cmd + ' --experimental-wasm-threads'
logger.debug('adding `#!` to JavaScript file: %s' % cmd)
# add shebang
with open(script, 'w') as f: