[Buildroot] [PATCH 1/1] package/pkg-cargo.mk: fix handling of debug and runtime debug builds
Moritz Bitsch
moritz at h6t.eu
Wed Oct 19 21:29:44 UTC 2022
Hi Yann,
Am 19.10.22 um 23:05 schrieb Yann E. MORIN:
> Moritz, All,
>
> On 2022-10-19 10:53 +0200, Moritz Bitsch via buildroot spake thusly:
>> From: Moritz Bitsch <moritz at h6t.eu>
>>
>> * when not supplying --release to cargo various optimizations get disabled,
>> resulting in slower runtime: use BR2_ENABLE_RUNTIME_DEBUG
>>
>> * Debug symbol generation can be controlled with the RUSTFLAGS variable:
>> add -g to RUSTFLAGS for debug symbols
> Two changes, two patches, please. Yes, they are very related, but the
> second one is a new feature, so should be a separate patch.
Sure, I'm going to split the commit and re submit the patch. Sorry for
the noise.
Regards,
Moritz Bitsch
>> Signed-off-by: Moritz Bitsch <moritz at h6t.eu>
>> ---
>> package/pkg-cargo.mk | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
>> index f7e3f39503..7ce7867f67 100644
>> --- a/package/pkg-cargo.mk
>> +++ b/package/pkg-cargo.mk
>> @@ -51,9 +51,15 @@ PKG_CARGO_ENV = \
>> # and should be removed when fixed upstream
>> #
>> ifeq ($(NORMALIZED_ARCH),arm)
>> - PKG_CARGO_ENV += RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition"
>> + PKG_CARGO_RUSTFLAGS += -Clink-arg=-Wl,--allow-multiple-definition
>> endif
>>
>> +ifeq ($(BR2_ENABLE_DEBUG),y)
>> + PKG_CARGO_RUSTFLAGS += -g
>> +endif
>> +
>> +PKG_CARGO_ENV += RUSTFLAGS=$(subst $(space),$(comma),$(strip $(PKG_CARGO_RUSTFLAGS)))
> I was about to say that we had the make-comma-list macro for that, and
> that's too bad I badly named it, because it also introduces a space
> after the comma, so it is not fitted here...
>
> We could tweak it not to introduce the space, but it is also used to
> create meson lists, and I'm not sure the space is required there or not.
> If it's not, then we can tweak it (and introduce make-comma-sp-list if
> needed elsewhere).
>
> Meh, forget it...
>
> Regards,
> Yann E. MORIN.
>
>> HOST_PKG_CARGO_ENV = \
>> $(PKG_COMMON_CARGO_ENV)
>>
>> @@ -119,7 +125,7 @@ define $(2)_BUILD_CMDS
>> $$($(2)_CARGO_ENV) \
>> cargo build \
>> --offline \
>> - $$(if $$(BR2_ENABLE_DEBUG),,--release) \
>> + $$(if $$(BR2_ENABLE_RUNTIME_DEBUG),,--release) \
>> --manifest-path Cargo.toml \
>> --locked \
>> $$($(2)_CARGO_BUILD_OPTS)
>> --
>> 2.37.3
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
More information about the buildroot
mailing list