1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 20:45:17 -07:00

Rename WASI_SYSROOT to WASI_LIBC and check both the old and new dirs

This commit is contained in:
Frank Denis 2019-07-20 17:29:44 +02:00
parent a26467874a
commit fdfca240d6

View File

@ -1,7 +1,16 @@
#! /bin/sh #! /bin/sh
if [ -z "$WASI_SYSROOT" ]; then if [ -z "$WASI_LIBC" ]; then
export WASI_SYSROOT="/opt/wasi-libc" for path in /opt/wasi-libc /opt/wasi-sysroot; do
if [ -d "$path" ]; then
export WASI_LIBC="$path"
break
fi
done
fi
if [ -z "$WASI_LIBC" ]; then
echo "Set WASI_LIBC to the path to the WASI libc sysroot" >&2
exit 1
fi fi
export PATH="/usr/local/opt/llvm/bin:$PATH" export PATH="/usr/local/opt/llvm/bin:$PATH"
@ -11,7 +20,7 @@ export PREFIX="$(pwd)/libsodium-wasm32-wasi"
mkdir -p $PREFIX || exit 1 mkdir -p $PREFIX || exit 1
export CC="clang" export CC="clang"
export CFLAGS="-DED25519_NONDETERMINISTIC=1 --target=wasm32-wasi --sysroot=${WASI_SYSROOT} -O2" export CFLAGS="-DED25519_NONDETERMINISTIC=1 --target=wasm32-wasi --sysroot=${WASI_LIBC} -O2"
export LDFLAGS="-s -Wl,--no-threads" export LDFLAGS="-s -Wl,--no-threads"
export NM="llvm-nm" export NM="llvm-nm"
export AR="llvm-ar" export AR="llvm-ar"
@ -35,7 +44,7 @@ else
fi fi
./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \ ./configure ${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
--prefix="$PREFIX" --with-sysroot="$WASI_SYSROOT" \ --prefix="$PREFIX" --with-sysroot="$WASI_LIBC" \
--host=wasm32-wasi \ --host=wasm32-wasi \
--disable-ssp --disable-shared || exit 1 --disable-ssp --disable-shared || exit 1