X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=genbindings.sh;h=ea725bd5d1f96e1666baa958c7b01ced987b96e5;hp=e0ff6b3f060af4259a92c2545f6ced32d1a6b4d9;hb=02d7574f78b8f38287ca7604b1e18a3c3989ab4d;hpb=1926a7a71ae0f37ebd6562996769334e0af0cf1b diff --git a/genbindings.sh b/genbindings.sh index e0ff6b3..ea725bd 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -251,7 +251,7 @@ clang++ $LOCAL_CFLAGS -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl if [ "$HOST_PLATFORM" != "host: x86_64-apple-darwin" -a "$CLANGPP" != "" ]; then # If we can use cross-language LTO, use it for building C dependencies (i.e. libsecp256k1) as well export CC="$CLANG" - export CFLAGS_wasm32_wasi="-target wasm32" + export CFLAGS_wasm32_wasi="-target wasm32 -flto" fi if [ "$2" = "false" -a "$(rustc --print target-list | grep wasm32-wasi)" != "" ]; then @@ -260,8 +260,6 @@ if [ "$2" = "false" -a "$(rustc --print target-list | grep wasm32-wasi)" != "" ] clang -nostdlib -o /dev/null --target=wasm32-wasi -Wl,--no-entry genbindings_wasm_test_file.c > /dev/null 2>&1 && # And if it does, build a WASM binary without capturing errors cargo rustc -v --target=wasm32-wasi -- -C embed-bitcode=yes && - # Now that we've done our last non-LTO build, turn on LTO in CFLAGS as well - export CFLAGS="$CFLAGS -flto" && CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release --target=wasm32-wasi -- -C opt-level=s -C linker-plugin-lto -C lto || echo "Cannot build WASM lib as clang does not seem to support the wasm32-wasi target" rm genbindings_wasm_test_file.c