X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=genbindings.sh;h=d02a9c10d80f897e694f833db772fff1c17eeee8;hb=544fd447db06fee681fa6d5e88138eac6d128a38;hp=31b6bd0a09f27d63bc5773d03398efe882962c24;hpb=c014ce6a2df808ffec747f9a327c7f97bb1e3d08;p=ldk-c-bindings diff --git a/genbindings.sh b/genbindings.sh index 31b6bd0..d02a9c1 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 @@ -182,11 +185,13 @@ if [ "$2" = "true" ]; then add_crate "lightning-persister" "lightning_persister" add_crate "lightning-background-processor" "lightning_background_processor" add_crate "lightning-invoice" "lightning_invoice" --features=std + add_crate "lightning-rapid-gossip-sync" "lightning_rapid_gossip_sync" CARGO_BUILD_ARGS="--features=std" 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-invoice" "lightning_invoice" --features=no-std CARGO_BUILD_ARGS="--features=no-std" fi @@ -495,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 @@ -548,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