Debian Codegraph @

crates/wit-component/dl/build.sh

raw
1 # This script will rebuild libdl.so from source.
2 #
3 # To run this, you'll need to use `wasi-sdk` 21 or later, installed at
4 # $WASI_SDK_PATH.
5 #
6 # Example: WASI_SDK_PATH=/opt/wasi-sdk bash build.sh ../libdl.so
7
8 set -ex
9
10 CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C relocation-model=pic" cargo build --release --target=wasm32-wasip1
11 $WASI_SDK_PATH/bin/clang -shared -o $1 -Wl,--whole-archive ../../../target/wasm32-wasip1/release/libdl.a -Wl,--no-whole-archive
12 cargo run --manifest-path ../../../Cargo.toml -- strip $1 -o $1
13 cargo run --manifest-path ../../../Cargo.toml -- strip --delete name $1 -o $1