From patchwork Sun Sep 29 17:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 1169043 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46hBzZ4qjJz9s7T for ; Mon, 30 Sep 2019 03:17:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id F011385C05; Sun, 29 Sep 2019 17:17:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b7NXqjVZc55q; Sun, 29 Sep 2019 17:17:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E3F4885C97; Sun, 29 Sep 2019 17:17:08 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id BCF811BF356 for ; Sun, 29 Sep 2019 17:17:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B4F7C85C05 for ; Sun, 29 Sep 2019 17:17:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KzQsR7jrLwIY for ; Sun, 29 Sep 2019 17:17:06 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 02B8C85D3D for ; Sun, 29 Sep 2019 17:17:06 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2a01:e0a:174:1c70:221a:6ff:fec6:f80a]) (Authenticated sender: eric.le.bihan.dev) by smtp1-g21.free.fr (Postfix) with ESMTPSA id 7CF68B00535 for ; Sun, 29 Sep 2019 19:17:02 +0200 (CEST) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 29 Sep 2019 19:16:53 +0200 Message-Id: <20190929171656.30187-4-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190929171656.30187-1-eric.le.bihan.dev@free.fr> References: <20190929171656.30187-1-eric.le.bihan.dev@free.fr> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/6] package/rust: declare as cargo provider 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" Enable build of cargo along with Rust compiler and declare this package as a cargo provider. Signed-off-by: Eric Le Bihan --- package/cargo/Config.in.host | 8 ++++++++ package/rust/rust.mk | 23 ++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/package/cargo/Config.in.host b/package/cargo/Config.in.host index bae30d2f57..d1bb913573 100644 --- a/package/cargo/Config.in.host +++ b/package/cargo/Config.in.host @@ -14,6 +14,13 @@ choice help Select a Cargo package manager provider +config BR2_PACKAGE_HOST_RUST_CARGO + bool "host rust" + depends on BR2_PACKAGE_HOST_RUST + select BR2_PACKAGE_HAS_HOST_CARGO + help + Install Cargo built at the same time as the Rust compiler. + config BR2_PACKAGE_HOST_CARGO_BIN bool "host cargo (pre-built)" depends on BR2_PACKAGE_HOST_RUST_BIN @@ -32,4 +39,5 @@ config BR2_PACKAGE_PROVIDES_HOST_CARGO string depends on BR2_PACKAGE_HAS_HOST_CARGO default "host-cargo-bin" if !BR2_PACKAGE_HOST_RUST + default "host-rust" if BR2_PACKAGE_HOST_RUST depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS diff --git a/package/rust/rust.mk b/package/rust/rust.mk index 5d14fc6682..ff23cd8930 100644 --- a/package/rust/rust.mk +++ b/package/rust/rust.mk @@ -10,7 +10,7 @@ RUST_SITE = https://static.rust-lang.org/dist RUST_LICENSE = Apache-2.0 or MIT RUST_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT -HOST_RUST_PROVIDES = host-rustc +HOST_RUST_PROVIDES = host-rustc host-cargo HOST_RUST_DEPENDENCIES = \ toolchain \ @@ -38,6 +38,25 @@ endef HOST_RUST_POST_EXTRACT_HOOKS += HOST_RUST_EXCLUDE_ORIG_FILES +ifeq ($(BR2_PACKAGE_HOST_RUST_CARGO),y) + +define HOST_RUST_ENABLE_CARGO + echo 'extended = true'; \ + echo 'tools = ["cargo"]'; +endef + +define HOST_RUST_INSTALL_CARGO + find $(@D)/build/tmp/dist -maxdepth 2 -wholename '*cargo*/install.sh' \ + -exec {} --prefix=$(HOST_DIR) --disable-ldconfig \; + +endef + +HOST_RUST_POST_INSTALL_HOOKS += \ + HOST_RUST_INSTALL_CARGO \ + HOST_CARGO_INSTALL_CONFIG + +endif + define HOST_RUST_CONFIGURE_CMDS ( \ echo '[build]'; \ @@ -47,11 +66,13 @@ define HOST_RUST_CONFIGURE_CMDS echo 'python = "$(HOST_DIR)/bin/python2"'; \ echo 'submodules = false'; \ echo 'vendor = true'; \ + $(HOST_RUST_ENABLE_CARGO) \ echo 'compiler-docs = false'; \ echo 'docs = false'; \ echo 'verbose = $(HOST_RUST_VERBOSITY)'; \ echo '[install]'; \ echo 'prefix = "$(HOST_DIR)"'; \ + echo 'sysconfdir = "$(HOST_DIR)/etc"'; \ echo '[rust]'; \ echo 'channel = "stable"'; \ echo '[target.$(RUSTC_TARGET_NAME)]'; \