From: Patrick Havelange <patrick.havelange@essensium.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3 02/10] docs/manual/cargo: Update manual for cargo packages.
Date: Thu, 20 Feb 2020 17:01:11 +0100 [thread overview]
Message-ID: <20200220160119.3407-2-patrick.havelange@essensium.com> (raw)
In-Reply-To: <20200220160119.3407-1-patrick.havelange@essensium.com>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
---
docs/manual/adding-packages-cargo.txt | 54 +++++----------------------
1 file changed, 10 insertions(+), 44 deletions(-)
diff --git a/docs/manual/adding-packages-cargo.txt b/docs/manual/adding-packages-cargo.txt
index bb078b6981..9a496224e3 100644
--- a/docs/manual/adding-packages-cargo.txt
+++ b/docs/manual/adding-packages-cargo.txt
@@ -27,9 +27,9 @@ The +Config.in+ file of Cargo-based package 'foo' should contain:
==== Cargo-based package's +.mk+ file
-Buildroot does not (yet) provide a dedicated package infrastructure for
-Cargo-based packages. So, we will explain how to write a +.mk+ file for such a
-package. Let's start with an example:
+Buildroot provides a dedicated package infrastructure for Cargo-based packages.
+So, we will explain how to write a +.mk+ file for such a package. Let's start
+with an example:
------------------------------
01: ################################################################################
@@ -44,53 +44,19 @@ package. Let's start with an example:
10: FOO_LICENSE = GPL-3.0+
11: FOO_LICENSE_FILES = COPYING
12:
-13: FOO_DEPENDENCIES = host-rustc
-14:
-15: FOO_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
-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: --$(FOO_CARGO_MODE) \
-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))
+13: $(eval $(cargo-package))
--------------------------------
The Makefile starts with the definition of the standard variables for package
declaration (lines 7 to 11).
-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:
+As seen in line 13, it is based on the cargo-package infrastructure. Cargo will
+be invoked automatically by this infrastructure. The required dependencies of the
+crate will be downloaded and the buildroot dependencies will also be set.
-* +FOO_BUILD_CMDS+: Cargo is invoked to perform the build. The options required
- to configure the cross-compilation of the package are passed via
- +FOO_CONF_OPTS+.
-
-* +FOO_INSTALL_TARGET_CMDS+: The binary executable generated is installed on
- the target.
-
-In order to have Cargo available for the build, +FOO_DEPENDENCIES+ needs to
-contain +host-cargo+.
-
-To sum it up, to add a new Cargo-based package, the Makefile example can be
-copied verbatim then edited to replace all occurences of +FOO+ with the
-uppercase name of the new package and update the values of the standard
-variables.
+It is still possible to define custom build commands or install commands (i.e.
+with FOO_BUILD_CMDS and FOO_INSTALL_TARGET_CMDS).
+Those will then replace the commands from the cargo infrastructure.
==== About Dependencies Management
--
2.17.1
next prev parent reply other threads:[~2020-02-20 16:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 16:01 [Buildroot] [PATCH v3 01/10] package/pkg-cargo.mk: Introduce the cargo package infrastructure Patrick Havelange
2020-02-20 16:01 ` Patrick Havelange [this message]
2020-02-20 16:01 ` [Buildroot] [PATCH v3 03/10] package/ripgrep: convert to cargo infrastructure Patrick Havelange
2020-02-20 16:01 ` [Buildroot] [PATCH v3 04/10] support/download/dl-wrapper: rework backend parsing Patrick Havelange
2020-02-20 16:01 ` [Buildroot] [PATCH v3 05/10] docs/manual/adding-packages-generic: update for new FOO_PKGMGR value Patrick Havelange
2020-02-20 16:01 ` [Buildroot] [PATCH v3 06/10] package/pkg-cargo.mk: Introduce the cargo dl backend Patrick Havelange
2020-08-26 19:22 ` Thomas Petazzoni
2020-02-20 16:01 ` [Buildroot] [PATCH v3 07/10] docs/manual/adding-packages-cargo: update doc for new infra Patrick Havelange
2020-02-20 16:01 ` [Buildroot] [PATCH v3 08/10] package/ripgrep: bump to version 11.0.1 Patrick Havelange
2020-02-20 16:01 ` [Buildroot] [PATCH v3 09/10] package/ripgrep: add legal-info for dependencies Patrick Havelange
2020-08-26 19:26 ` Thomas Petazzoni
2020-02-20 16:01 ` [Buildroot] [PATCH v3 10/10] docs/manual/adding-packages-cargo: Update for legal-info Patrick Havelange
2020-04-29 13:53 ` [Buildroot] [PATCH v3 01/10] package/pkg-cargo.mk: Introduce the cargo package infrastructure Romain Naour
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200220160119.3407-2-patrick.havelange@essensium.com \
--to=patrick.havelange@essensium.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.