serpent-os / tools

The home of moss (system state manager) and boulder (moss format build tool)
https://serpentos.com
132 stars 12 forks source link

boulder: Update cargo macros #341

Closed ReillyBrogan closed 1 month ago

ReillyBrogan commented 1 month ago

Instead of building packages in debug profile (which requires workarounds for at least every package that uses rust-embed) build in release profile but with environmental variable overrides for the settings we need in order for RUSTFLAGS to take precedence.

This was tested by building several packages with different LTO profiles and verifying that they built as expected.

Also, add a few helper definitions for the artifact directory and the cargo options so that they can be used in other places.

ReillyBrogan commented 1 month ago

It was present earlier, but was removed by @joebonrichie since he wanted the LTO configuration in the Boulder recipe to overwrite whatever was present in the Cargo.toml, but if LTO was enabled by Cargo.toml it would add flags that couldn't be disabled by RUSTFLAGS. The solution at the time was to build everything in debug profile, but this is a better approach. This overwrites any LTO configuration in the Cargo.toml so that it can be overrode by LTO flags added to RUSTFLAGS.