#28 [DO-NOT-MERGE] Only build in release mode / with optimizations when shipping binaries
Closed by decathorpe. Opened by decathorpe.
Unknown source main

Download 28.patch

This required to no longer set RUSTFLAGS explicitly in a few places to ensure they are not getting set three times:

  • The "%__cargo" macro no longer defines RUSTFLAGS explicitly.
  • The "%cargo_build" and "%cargo_test" macros now explicitly unset RUSTFLAGS from the build environment. The "rpm" profile already contains settings that are equivalent to the default RUSTFLAGS.

Since RUSTFLAGS are already defined in the default build environment, no packages that ship binaries should be impacted by this change (except maybe for rare cases of environments where RUSTFLAGS is not set and the package uses the private "%__cargo" macro directly).

I've built rust-packaging with this change applied in COPR to make test builds easier:
https://copr.fedorainfracloud.org/coprs/decathorpe/rust-packaging-make-it-faster/

Hm, thinking about it, unset RUSTFLAGS is not enough. It should probably be RUSTFLAGS=--cap-lints=warn to match the current errors-as-warnings behaviour.

rebased onto 44f39cf1a7f96c52e4acd0010b81b2b941dc9782

I think my previous comment(s) and also https://pagure.io/fedora-rust/rust-packaging/issue/29 should be addressed with the latest version.

The "rpm" profile already contains settings that are equivalent to the default RUSTFLAGS.

It contains opt-level, codegen-units, debug, and strip, but what about -Cforce-frame-pointers=yes and -Clink-arg=%_package_note_flags? And any custom %build_rustflags that a package may set?

Ah. I forgot about those two flags ... you are correct. I'll need to think about this some more ...

Pull-Request has been closed by decathorpe

Metadata