From 2d303fb848f73e70f42eb70c1d947601200ef4df Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 4 Apr 2024 16:33:21 +0000 Subject: [PATCH] Enable LTO via `cargo` profile setting RUSTFLAGS is passed to build.rs scripts and results in error: lto can only be run for executables, cdylibs and static library outputs Upstream issue: --- scripts/build-core.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build-core.sh b/scripts/build-core.sh index 68c2f7d26..c7d01160a 100755 --- a/scripts/build-core.sh +++ b/scripts/build-core.sh @@ -17,7 +17,8 @@ rustup target add aarch64-apple-ios x86_64-apple-ios --toolchain `cat ../rust-to # Depending your setup, specify the rustup toolchain explicitly. # # --no-sanitize-env prevents removal of IPHONEOS_DEPLOYMENT_TARGET variable. -RUSTFLAGS="-C lto=on -C embed-bitcode=yes" \ +CARGO_PROFILE_RELEASE_LTO=true \ +RUSTFLAGS="-C embed-bitcode=yes" \ cargo +`cat ../rust-toolchain` lipo --xcode-integ --no-sanitize-env --manifest-path "$DIR/deltachat-core-rust/deltachat-ffi/Cargo.toml" --features jsonrpc # cargo-lipo drops result in different folder, depending on the config.