X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=genbindings.sh;h=bfeda6bcdaebac000f32e4d1968355395c314821;hb=f2e4f8a2293de3f9a51319d5b42eafc551c158b3;hp=1ca2f6e8e886d1463d24bc9da55ae487ab04fde3;hpb=808db585782d1669b1f6767d5fa407f91fde77e8;p=rust-lightning diff --git a/genbindings.sh b/genbindings.sh index 1ca2f6e8..bfeda6bc 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -44,8 +44,16 @@ HOST_PLATFORM="$(rustc --version --verbose | grep "host:")" if [ "$HOST_PLATFORM" = "host: x86_64-apple-darwin" ]; then # OSX sed is for some reason not compatible with GNU sed sed -i '' 's/typedef LDKnative.*Import.*LDKnative.*;//g' include/lightning.h + + # stdlib.h doesn't exist in clang's wasm sysroot, and cbindgen + # doesn't actually use it anyway, so drop the import. + sed -i '' 's/#include //g' include/lightning.h else sed -i 's/typedef LDKnative.*Import.*LDKnative.*;//g' include/lightning.h + + # stdlib.h doesn't exist in clang's wasm sysroot, and cbindgen + # doesn't actually use it anyway, so drop the import. + sed -i 's/#include //g' include/lightning.h fi # Finally, sanity-check the generated C and C++ bindings with demo apps: @@ -171,6 +179,9 @@ else echo "WARNING: Can't use address sanitizer on non-Linux, non-OSX non-x86 platforms" fi +cargo rustc -v --target=wasm32-wasi -- -C embed-bitcode=yes || echo "WARNING: Failed to generate WASM LLVM-bitcode-embedded library" +CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release --target=wasm32-wasi -- -C opt-level=s -C linker-plugin-lto -C lto || echo "WARNING: Failed to generate WASM LLVM-bitcode-embedded optimized library" + # Now build with LTO on on both C++ and rust, but without cross-language LTO: CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release -- -C lto clang++ $CFLAGS -std=c++11 -flto -O2 demo.cpp target/release/libldk.a -ldl