mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-26 15:59:24 -05:00
fae12b234d
- `wrap_api_future` function did not exist, so I used `wrap_api_future_plain` since the return type appears to be a base64 encoded string. - Argument order for `create_dht_record` was incorrectly swapped. - `veilid_core::json_as_base64` does not exist, don't exactly know what to replace it with for serde serialization, but I commented it out for now. - Removed `--no-typescript` flag from `wasm-buildgen` so that TypeScript types are emitted.
47 lines
1.5 KiB
Bash
Executable File
47 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
set -eo pipefail
|
|
|
|
get_abs_filename() {
|
|
# $1 : relative filename
|
|
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
|
}
|
|
|
|
pushd $SCRIPTDIR &> /dev/null
|
|
|
|
if [ -f /usr/local/opt/llvm/bin/llvm-dwarfdump ]; then
|
|
DWARFDUMP=/usr/local/opt/llvm/bin/llvm-dwarfdump
|
|
elif [ -f /opt/homebrew/llvm/bin/llvm-dwarfdump ]; then
|
|
DWARFDUMP=/opt/homebrew/llvm/bin/llvm-dwarfdump
|
|
else
|
|
DWARFDUMP=`which llvm-dwarfdump`
|
|
if [[ "${DWARFDUMP}" == "" ]]; then
|
|
echo llvm-dwarfdump not found
|
|
fi
|
|
fi
|
|
|
|
|
|
if [[ "$1" == "release" ]]; then
|
|
OUTPUTDIR=../target/wasm32-unknown-unknown/release/pkg
|
|
INPUTDIR=../target/wasm32-unknown-unknown/release
|
|
|
|
cargo build --target wasm32-unknown-unknown --release
|
|
mkdir -p $OUTPUTDIR
|
|
wasm-bindgen --out-dir $OUTPUTDIR --target web $INPUTDIR/veilid_wasm.wasm
|
|
wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm
|
|
else
|
|
OUTPUTDIR=../target/wasm32-unknown-unknown/debug/pkg
|
|
INPUTDIR=../target/wasm32-unknown-unknown/debug
|
|
|
|
RUSTFLAGS="-O -g" cargo build --target wasm32-unknown-unknown
|
|
mkdir -p $OUTPUTDIR
|
|
wasm-bindgen --out-dir $OUTPUTDIR --target web --keep-debug --debug $INPUTDIR/veilid_wasm.wasm
|
|
./wasm-sourcemap.py $OUTPUTDIR/veilid_wasm_bg.wasm -o $OUTPUTDIR/veilid_wasm_bg.wasm.map --dwarfdump $DWARFDUMP
|
|
# wasm-strip $OUTPUTDIR/veilid_wasm_bg.wasm
|
|
fi
|
|
|
|
popd &> /dev/null
|
|
|
|
# Print for use with scripts
|
|
echo SUCCESS:OUTPUTDIR=$(get_abs_filename $OUTPUTDIR) |