X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=genbindings.sh;h=cd100f6a86f1fd00d81de86bc3a5df28435f910d;hb=f8704134e90e156ec38f6b714ac08a450e3220cf;hp=13aa5bd2b382e4dab2ee3607766674b8909aed3f;hpb=bb8bbe1ded7cda74123997f2d41e26eb2f490901;p=ldk-c-bindings diff --git a/genbindings.sh b/genbindings.sh index 13aa5bd..cd100f6 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -25,7 +25,8 @@ HOST_PLATFORM="$(rustc --version --verbose | grep "host:")" # Set path to include our rustc wrapper as well as cbindgen export LDK_RUSTC_PATH="$(which rustc)" -PATH="$(pwd)/deterministic-build-wrappers:$PATH:~/.cargo/bin" +export RUSTC="$(pwd)/deterministic-build-wrappers/rustc" +PATH="$PATH:~/.cargo/bin" # Set up CFLAGS and RUSTFLAGS vars appropriately for building libsecp256k1 and demo apps... BASE_CFLAGS="" # CFLAGS for libsecp256k1 @@ -242,7 +243,7 @@ if [ "$HOST_PLATFORM" = "host: x86_64-unknown-linux-gnu" ]; then LLVM_V=$(rustc +nightly --version --verbose | grep "LLVM version" | awk '{ print substr($3, 0, 2); }') if [ -x "$(which clang-$LLVM_V)" ]; then cargo +nightly clean - cargo +nightly rustc -Zbuild-std --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes + cargo +nightly rustc -Zbuild-std=std,panic_abort --target x86_64-unknown-linux-gnu -v -- -Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes mv target/x86_64-unknown-linux-gnu/debug/libldk.* target/debug/ # Sadly, std doesn't seem to compile into something that is memsan-safe as of Aug 2020, @@ -396,6 +397,21 @@ if [ "$2" = "false" -a "$(rustc --print target-list | grep wasm32-wasi)" != "" ] rm genbindings_wasm_test_file.c fi +EXTRA_TARGETS=( $LDK_C_BINDINGS_EXTRA_TARGETS ) +EXTRA_CCS=( $LDK_C_BINDINGS_EXTRA_TARGET_CCS ) + +if [ ${#EXTRA_TARGETS[@]} != ${#EXTRA_CCS[@]} ]; then + echo "LDK_C_BINDINGS_EXTRA_TARGETS and LDK_C_BINDINGS_EXTRA_TARGET_CCS didn't have the same number of elements!" + exit 1 +fi + +for IDX in ${!EXTRA_TARGETS[@]}; do + EXTRA_ENV_TARGET=$(echo "${EXTRA_TARGETS[$IDX]}" | sed 's/-/_/g') + export CFLAGS_$EXTRA_ENV_TARGET="$BASE_CFLAGS" + export CC_$EXTRA_ENV_TARGET=${EXTRA_CCS[$IDX]} + RUSTFLAGS="$BASE_RUSTFLAGS -C linker=${EXTRA_CCS[$IDX]}" CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release --target "${EXTRA_TARGETS[$IDX]}" -- -C lto +done + if [ "$CFLAGS_aarch64_apple_darwin" != "" ]; then RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14" CARGO_PROFILE_RELEASE_LTO=true cargo rustc -v --release --target aarch64-apple-darwin -- -C lto fi