Skip to content

optimize build size for bin and cdylib crates

The leaf crates that produce binaries or shared objects tend to produce pretty large binaries.

Some upstream discussion suggests that the build infrastructure could make choices to set codegen-units=1 and/or lto=true to get a 30% size reduction in the generated binaries for at least sequoia-chameleon-gnupg. These choices will make the build take longer, but i think that's a reasonable tradeoff for the space savings. Apparently Fedora is already setting codegen-units=1.

I can manually patch these into the bin and cdylib crates i maintain, but it seems like enabling them automatically on any bin and cdylib crates via debcargo would make more sense.

Perhaps if there are some crates that don't want these flags enabled, debian/debcargo.toml could offer a lever to disable the size optimizations.