diff mbox series

[2/2] package/pkg-cargo.mk: generate debug symbols when BR2_ENABLE_DEBUG is set

Message ID 20221019220019.8418-3-moritz@h6t.eu
State Superseded
Headers show
Series Improve handling of debug builds in cargo packages | expand

Commit Message

Moritz Bitsch Oct. 19, 2022, 10 p.m. UTC
From: Moritz Bitsch <moritz@h6t.eu>

Adding -g to RUSTFLAGS enables debug symbol generation in rustc

Signed-off-by: Moritz Bitsch <moritz@h6t.eu>
---
 package/pkg-cargo.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index e0556252fa..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)))
+
 HOST_PKG_CARGO_ENV = \
 	$(PKG_COMMON_CARGO_ENV)