From cad773d0728c1a2809512e3039e78c2181a36dd7 Mon Sep 17 00:00:00 2001 From: Antheas Kapenekakis Date: Sun, 1 Dec 2024 15:45:16 +0100 Subject: [PATCH] feat: add thin build profile Signed-off-by: Antheas Kapenekakis --- Cargo.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 0b20014d6..af1dc7f7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,19 @@ panic = "abort" # We assume we're being delivered via e.g. RPM which supports split debuginfo debug = true +[profile.thin] +# drop bootc size when split debuginfo is not available and go a step +# further in size optimization (when tested from 140mb, to 12mb without +# symbols/debuginfo, to 5.8mb with extra optimizations) +# https://github.com/johnthagen/min-sized-rust +# cargo build --profile=thin +inherits = "release" +debug = false # Re-strip debug symbols +strip = true # Strip symbols from binary +lto = true # Use full lto to remove dead code +opt-level = 's' # Optimize for size with vector vectorization +codegen-units = 1 # Reduce number of codegen units to increase optimizations + [profile.releaselto] codegen-units = 1 inherits = "release"