From patchwork Tue Jun 15 13:55:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan X-Patchwork-Id: 1492246 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G48x14zfJz9sRK for ; Tue, 15 Jun 2021 23:56:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F111760872; Tue, 15 Jun 2021 13:56:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gptqqpCXT938; Tue, 15 Jun 2021 13:56:02 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 42994607BE; Tue, 15 Jun 2021 13:56:01 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id E3B1F1BF313 for ; Tue, 15 Jun 2021 13:55:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D2DEC83B4B for ; Tue, 15 Jun 2021 13:55:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0BChm_zs7UVL for ; Tue, 15 Jun 2021 13:55:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from dd26228.kasserver.com (dd26228.kasserver.com [85.13.145.71]) by smtp1.osuosl.org (Postfix) with ESMTPS id EADEB83A7A for ; Tue, 15 Jun 2021 13:55:56 +0000 (UTC) Received: from [192.168.0.12] (unknown [77.47.81.137]) by dd26228.kasserver.com (Postfix) with ESMTPSA id 09DFA10002E for ; Tue, 15 Jun 2021 15:55:55 +0200 (CEST) From: Stefan To: buildroot@busybox.net Message-ID: <2e60c4dc-6a6f-7124-c512-2b4495482f4c@green-sparklet.de> Date: Tue, 15 Jun 2021 15:55:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] docs/manual/adding-packages-cargo.txt: re-add FOO_CARGO_MODE variable X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "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 --- docs/manual/adding-packages-cargo.txt | 41 ++++++++++++++------------- 1 file changed, 21 insertions(+), 20 deletions(-) -- 2.32.0.windows.1 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: