X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=genbindings.sh;h=4f795030f9301534010a6fec9729ec6c7df4d974;hb=c7b284ef5deb5af4b99e64b7c7e1b7d01d7ae33b;hp=706c0ba8a0b94232b4a9b159d61b0f597d26367c;hpb=a0e439c6373cd0445fbb3b0408751b8e69b17a9a;p=ldk-c-bindings diff --git a/genbindings.sh b/genbindings.sh index 706c0ba..4f79503 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -68,16 +68,19 @@ rm genbindings_path_map_test_file.c case "$ENV_TARGET" in "x86_64"*) export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=sandybridge" - export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -march=sandybridge -mcpu=sandybridge -mtune=sandybridge" + export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -march=sandybridge -mcpu=sandybridge -mtune=sandybridge" + export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS" ;; "aarch64_apple_darwin") export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=apple-a14" - export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -mcpu=apple-a14" + export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -mcpu=apple-a14" + export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS" ;; *) # Assume this isn't targeted at another host and build for the host's CPU. export RUSTFLAGS="$BASE_RUSTFLAGS -C target-cpu=native" - export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -mcpu=native" + export BASE_HOST_CFLAGS="$BASE_HOST_CFLAGS -mcpu=native" + export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS" ;; esac @@ -188,7 +191,7 @@ else add_crate lightning lightning --features=no-std drop_crate "lightning-persister" drop_crate "lightning-background-processor" - drop_crate "lightning-rapid-gossip-sync" + add_crate "lightning-rapid-gossip-sync" "lightning_rapid_gossip_sync" --features=no-std add_crate "lightning-invoice" "lightning_invoice" --features=no-std CARGO_BUILD_ARGS="--features=no-std" fi @@ -269,7 +272,7 @@ while read LINE; do echo "Unable to find method declaration for $LINE" exit 1 fi - RETVAL="$(echo "$METHOD" | sed 's/[ ]*\([A-Za-z0-9 _]*\)(\*\(.*\)).*/\1/' | sed 's/^struct LDK/LDK::/g' | tr -d ' ')" + RETVAL="$(echo "$METHOD" | sed 's/[ ]*\([A-Za-z0-9 _]*\)(\*\(.*\)).*/\1/' | sed -E 's/^(struct|enum) LDK/LDK::/g' | tr -d ' ')" [ "$RETVAL" = "LDK::SecretKey" ] && RETVAL="LDKSecretKey" [ "$RETVAL" = "LDK::PublicKey" ] && RETVAL="LDKPublicKey" [ "$RETVAL" = "LDK::ThirtyTwoBytes" ] && RETVAL="LDKThirtyTwoBytes" @@ -497,7 +500,7 @@ if [ "$CLANGPP" != "" ]; then # The cc-rs crate tries to force -fdata-sections and -ffunction-sections on, which # breaks -fembed-bitcode, so we turn off cc-rs' default flags and specify exactly # what we want here. - export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -fPIC -fembed-bitcode -march=sandybridge -mcpu=sandybridge -mtune=sandybridge" + export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -fPIC -fembed-bitcode" export CRATE_CC_NO_DEFAULTS=true fi @@ -550,7 +553,7 @@ if [ "$CLANGPP" != "" -a "$LLD" != "" ]; then fi # If we're on an M1 don't bother building X86 binaries if [ "$HOST_PLATFORM" != "aarch64-apple-darwin" ]; then - export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -O3 -fPIC -fembed-bitcode -march=sandybridge -mcpu=sandybridge -mtune=sandybridge" + export CFLAGS_$ENV_TARGET="$BASE_HOST_CFLAGS -O3 -fPIC -fembed-bitcode" # Rust doesn't recognize CFLAGS changes, so we need to clean build artifacts cargo clean --release CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="$RUSTFLAGS -C embed-bitcode=yes -C linker-plugin-lto -C lto -C linker=$CLANG $LINK_ARG_FLAGS -C link-arg=-march=sandybridge -C link-arg=-mcpu=sandybridge -C link-arg=-mtune=sandybridge" cargo build $CARGO_BUILD_ARGS -v --release