All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] docs/manual/adding-packages-cargo.txt: re-add FOO_CARGO_MODE variable
@ 2021-06-15 13:55 Stefan
  2021-07-20 21:47   ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan @ 2021-06-15 13:55 UTC (permalink / raw)
  To: buildroot

FOO_CARGO_MODE is needed for FOO_BIN_DIR, example wouldn't work without.
Fabrice Fontaine is correct that carco has no 'debug' profile, but default 'dev' profile builds into 'debug' directory. That's where we have to pick up files for install.

Signed-off-by: Stefan G?nsler <buildroot-git_21@green-sparklet.de>
---
 docs/manual/adding-packages-cargo.txt | 41 ++++++++++++++-------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/docs/manual/adding-packages-cargo.txt b/docs/manual/adding-packages-cargo.txt
index 8fcc80bcc6..8cbd641d65 100644
--- a/docs/manual/adding-packages-cargo.txt
+++ b/docs/manual/adding-packages-cargo.txt
@@ -47,31 +47,32 @@ package. Let's start with an example:
 13: FOO_DEPENDENCIES = host-rustc
 14:
 15: FOO_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
-16:
-17: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
-18:
-19: FOO_CARGO_OPTS = \
-20:    $(if $(BR2_ENABLE_DEBUG),,--release) \
-21:    --target=$(RUSTC_TARGET_NAME) \
-22:    --manifest-path=$(@D)/Cargo.toml
-23:
-24: define FOO_BUILD_CMDS
-25:    $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
-26:            cargo build $(FOO_CARGO_OPTS)
-27: endef
-28:
-29: define FOO_INSTALL_TARGET_CMDS
-30:    $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
-31:            $(TARGET_DIR)/usr/bin/foo
-32: endef
-33:
-34: $(eval $(generic-package))
+16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
+17:
+18: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
+19:
+20: FOO_CARGO_OPTS = \
+21:    $(if $(BR2_ENABLE_DEBUG),,--release) \
+22:    --target=$(RUSTC_TARGET_NAME) \
+23:    --manifest-path=$(@D)/Cargo.toml
+24:
+25: define FOO_BUILD_CMDS
+26:    $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
+27:            cargo build $(FOO_CARGO_OPTS)
+28: endef
+29:
+30: define FOO_INSTALL_TARGET_CMDS
+31:    $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
+32:            $(TARGET_DIR)/usr/bin/foo
+33: endef
+34:
+35: $(eval $(generic-package))
 --------------------------------

 The Makefile starts with the definition of the standard variables for package
 declaration (lines 7 to 11).

-As seen in line 34, it is based on the
+As seen in line 35, it is based on the
 xref:generic-package-tutorial[+generic-package+ infrastructure]. So, it defines
 the variables required by this particular infrastructure, where Cargo is
 invoked:
--
2.32.0.windows.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] docs/manual/adding-packages-cargo.txt: re-add FOO_CARGO_MODE variable
@ 2021-07-20 21:47   ` Thomas Petazzoni
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2021-07-20 21:47 UTC (permalink / raw)
  To: Stefan; +Cc: buildroot, Fabrice Fontaine

Hello Stefan,

On Tue, 15 Jun 2021 15:55:54 +0200
Stefan <buildroot-list_21@green-sparklet.de> wrote:

> +16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
> +17:
> +18: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
> +19:
> +20: FOO_CARGO_OPTS = \
> +21:    $(if $(BR2_ENABLE_DEBUG),,--release) \
> +22:    --target=$(RUSTC_TARGET_NAME) \
> +23:    --manifest-path=$(@D)/Cargo.toml
> +24:
> +25: define FOO_BUILD_CMDS
> +26:    $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
> +27:            cargo build $(FOO_CARGO_OPTS)
> +28: endef
> +29:
> +30: define FOO_INSTALL_TARGET_CMDS
> +31:    $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
> +32:            $(TARGET_DIR)/usr/bin/foo
> +33: endef
> +34:
> +35: $(eval $(generic-package))

Thanks for the patch. However, it seems like the only package that uses
this currently is not formatted like you're suggesting. See
package/ripgrep/ripgrep.mk. First, it uses BR2_ENABLE_RUNTIME_DEBUG
instead of BR2_ENABLE_DEBUG, and it does it in a different way.

Could you adjust the documentation according to what
package/ripgrep/ripgrep.mk is doing ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] docs/manual/adding-packages-cargo.txt: re-add FOO_CARGO_MODE variable
@ 2021-07-20 21:47   ` Thomas Petazzoni
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2021-07-20 21:47 UTC (permalink / raw)
  To: buildroot

Hello Stefan,

On Tue, 15 Jun 2021 15:55:54 +0200
Stefan <buildroot-list_21@green-sparklet.de> wrote:

> +16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
> +17:
> +18: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
> +19:
> +20: FOO_CARGO_OPTS = \
> +21:    $(if $(BR2_ENABLE_DEBUG),,--release) \
> +22:    --target=$(RUSTC_TARGET_NAME) \
> +23:    --manifest-path=$(@D)/Cargo.toml
> +24:
> +25: define FOO_BUILD_CMDS
> +26:    $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
> +27:            cargo build $(FOO_CARGO_OPTS)
> +28: endef
> +29:
> +30: define FOO_INSTALL_TARGET_CMDS
> +31:    $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
> +32:            $(TARGET_DIR)/usr/bin/foo
> +33: endef
> +34:
> +35: $(eval $(generic-package))

Thanks for the patch. However, it seems like the only package that uses
this currently is not formatted like you're suggesting. See
package/ripgrep/ripgrep.mk. First, it uses BR2_ENABLE_RUNTIME_DEBUG
instead of BR2_ENABLE_DEBUG, and it does it in a different way.

Could you adjust the documentation according to what
package/ripgrep/ripgrep.mk is doing ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-20 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 13:55 [Buildroot] [PATCH] docs/manual/adding-packages-cargo.txt: re-add FOO_CARGO_MODE variable Stefan
2021-07-20 21:47 ` Thomas Petazzoni
2021-07-20 21:47   ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.