From patchwork Sun Feb 4 18:07:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJcS293Bz9s72 for ; Mon, 5 Feb 2018 05:08:24 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DE89286AEA; Sun, 4 Feb 2018 18:08:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EfTr10FoA138; Sun, 4 Feb 2018 18:08:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 50DBD86ACC; Sun, 4 Feb 2018 18:08:17 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D0CA51C1540 for ; Sun, 4 Feb 2018 18:08:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C4E9887A30 for ; Sun, 4 Feb 2018 18:08:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id La2TGmd-3+Ks for ; Sun, 4 Feb 2018 18:08:15 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by hemlock.osuosl.org (Postfix) with ESMTPS id 00FB187774 for ; Sun, 4 Feb 2018 18:08:14 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 5D1525FFF3 for ; Sun, 4 Feb 2018 19:08:10 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:40 +0100 Message-Id: <20180204180749.29942-2-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 01/10] rustc: new virtual package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The compiler for the Rust programming language is called rustc. There is only one reference implementation for it, based on LLVM, from the Rust project [1]. It can generate code for various architectures so it can be labeled as a cross-compiler. But, as for GCC, building it from source takes time. So it would be sensible to have at least one package which provides it as a pre-built version, fetched from the upstream project. Later another package can be added, to build it from source code. In addition to the compiler, the standard library for the host and/or the target should also be fetched/built. So, add a virtual package named rustc to enable support for multiple providers. Currently, only the host variant will be available to allow the user to cross-compile Rust programs for the target. [1] http://rust-lang.org Signed-off-by: Eric Le Bihan --- package/Config.in.host | 1 + package/rustc/Config.in.host | 31 +++++++++++++++++++++++++++++++ package/rustc/rustc.mk | 20 ++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 package/rustc/Config.in.host create mode 100644 package/rustc/rustc.mk diff --git a/package/Config.in.host b/package/Config.in.host index dd6415bba5..2f20dd0e48 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -46,6 +46,7 @@ menu "Host utilities" source "package/qemu/Config.in.host" source "package/raspberrypi-usbboot/Config.in.host" source "package/rauc/Config.in.host" + source "package/rustc/Config.in.host" source "package/s6-rc/Config.in.host" source "package/sam-ba/Config.in.host" source "package/squashfs/Config.in.host" diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host new file mode 100644 index 0000000000..a49f635d65 --- /dev/null +++ b/package/rustc/Config.in.host @@ -0,0 +1,31 @@ +config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + bool + depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + # The pre-built Rust standard library is only available for the + # following architectures/ABIs, and is built against glibc. + default y if BR2_i386 + default y if BR2_x86_64 + default y if BR2_aarch64 + default y if BR2_arm && !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 + default y if BR2_powerpc || BR2_powerpc64 + default y if (BR2_mips || BR2_mipsel) && !BR2_MIPS_CPU_MIPS32R6 + default y if (BR2_mips64 || BR2_mips64el) && !BR2_MIPS_CPU_MIPS64R6 \ + && BR2_MIPS_NABI64 + depends on BR2_TOOLCHAIN_USES_GLIBC + +config BR2_PACKAGE_HOST_RUSTC_ARCH + string + default "armv7" if BR2_ARM_CPU_ARMV7A + default BR2_ARCH if !BR2_ARM_CPU_ARMV7A + +config BR2_PACKAGE_HOST_RUSTC_ABI + string + default "eabi" if BR2_ARM_EABI + default "eabihf" if BR2_ARM_EABIHF + default "abi64" if BR2_MIPS_NABI64 + +config BR2_PACKAGE_HAS_HOST_RUSTC + bool + +config BR2_PACKAGE_PROVIDES_HOST_RUSTC + string diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk new file mode 100644 index 0000000000..7a951c0cfd --- /dev/null +++ b/package/rustc/rustc.mk @@ -0,0 +1,20 @@ +################################################################################ +# +# rustc +# +################################################################################ + +RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH)) +RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI)) + +RUST_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI) + +ifeq ($(HOSTARCH),x86) +RUSTC_HOST_ARCH = i686 +else +RUSTC_HOST_ARCH = $(HOSTARCH) +endif + +RUST_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu + +$(eval $(host-virtual-package)) From patchwork Sun Feb 4 18:07:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJcY4Xl5z9s72 for ; Mon, 5 Feb 2018 05:08:29 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B017A87A0F; Sun, 4 Feb 2018 18:08:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VrS4Ka28di0E; Sun, 4 Feb 2018 18:08:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 5735C879DF; Sun, 4 Feb 2018 18:08:24 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id CB91D1C1540 for ; Sun, 4 Feb 2018 18:08:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C74688696E for ; Sun, 4 Feb 2018 18:08:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MIvPmZb708gH for ; Sun, 4 Feb 2018 18:08:22 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by whitealder.osuosl.org (Postfix) with ESMTPS id CBD3686ACC for ; Sun, 4 Feb 2018 18:08:21 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 44B845FFB4 for ; Sun, 4 Feb 2018 19:08:14 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:41 +0100 Message-Id: <20180204180749.29942-3-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 02/10] rust-bin: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This package provides a pre-built version of rustc, the compiler for the Rust programming language, fetched from the upstream project. A pre-built version of the standard library for the host as well as one for the chosen target are also fetched and installed. Only the host variant is provided to allow the user to cross-compile Rust programs and run them on the target. This package could also be used to provide a bootstrap compiler when building Rust from source. So, in order to add it as a build dependency, the compiler and standard libraries are only installed in $(HOST_DIR) if the package is explicitly selected. The menuconfig entry for rustc is also updated to expose this provider. Signed-off-by: Eric Le Bihan --- DEVELOPERS | 1 + package/rust-bin/rust-bin.hash | 33 +++++++++++++++++++++++ package/rust-bin/rust-bin.mk | 61 ++++++++++++++++++++++++++++++++++++++++++ package/rustc/Config.in.host | 29 ++++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 package/rust-bin/rust-bin.hash create mode 100644 package/rust-bin/rust-bin.mk diff --git a/DEVELOPERS b/DEVELOPERS index 4f2c84758e..7e04f872ac 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -548,6 +548,7 @@ F: package/hicolor-icon-theme/ F: package/jemalloc/ F: package/meson/ F: package/ninja/ +F: package/rust-bin/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/ diff --git a/package/rust-bin/rust-bin.hash b/package/rust-bin/rust-bin.hash new file mode 100644 index 0000000000..5b34a6aa0c --- /dev/null +++ b/package/rust-bin/rust-bin.hash @@ -0,0 +1,33 @@ +# From https://static.rust-lang.org/dist/rustc-1.23.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 243de2826b2d545b8428414a3f7e86ce5e86163ec927a374958052a047b55e69 rustc-1.23.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rustc-1.23.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 d72674a683dcc8a07ad72d6ae08b96a7dfc72cf08433e2ae69c0f8a2b9c79c17 rustc-1.23.0-x86_64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-aarch64-unknown-linux-gnu.tar.xz.sha256 +sha256 0d9c976c46a277ef860ce5766387ea8e40f84657e5f9962cba91be62a00ca345 rust-std-1.23.0-aarch64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-arm-unknown-linux-gnueabi.tar.xz.sha256 +sha256 3d7ce58f6d2bbf6faf91049893e96611a172b0af02d98190e36a49e8b0f974ee rust-std-1.23.0-arm-unknown-linux-gnueabi.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-arm-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 0a2a43668c2ddc2516e85e1c097d2672acaf61541d2b70f40daba548b3ccbee1 rust-std-1.23.0-arm-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-armv7-unknown-linux-gnueabihf.tar.xz.sha256 +sha256 b2f7f4e2e31d86302e929d0435b6f40778c22fc9306f0850b0edc4738ff2634e rust-std-1.23.0-armv7-unknown-linux-gnueabihf.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 f9659f844ccd2e25e9f01a49fb7adf0ce26cbbec7a4df7081dd2d0929a86b2d3 rust-std-1.23.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-mips-unknown-linux-gnu.tar.xz.sha256 +sha256 8324d9c1eacba0de31fff29841d0f0567261489ee46a270e30be929095bfe19a rust-std-1.23.0-mips-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-mips64-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 521f70f3346ff8e28e33350fd5ad9bbba7dfc9038389f3965bcfa2f1d1a498a5 rust-std-1.23.0-mips64-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-mips64el-unknown-linux-gnuabi64.tar.xz.sha256 +sha256 d08f5792bd0d4f5d3d81a4ec1b3a2b36e7c389de2ecf2e777e390461ff015d08 rust-std-1.23.0-mips64el-unknown-linux-gnuabi64.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-mipsel-unknown-linux-gnu.tar.xz.sha256 +sha256 77291fff357b9e1764a4d7975bdbecdb37aeb0d37d85ccb68f7d785f4da1a056 rust-std-1.23.0-mipsel-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-powerpc-unknown-linux-gnu.tar.xz.sha256 +sha256 d1b862d32c4921058ff4ea5b7fead3b2954b5f0f036603b1c58a600e602d1f25 rust-std-1.23.0-powerpc-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-powerpc64-unknown-linux-gnu.tar.xz.sha256 +sha256 e03bf7907914c88d2f19e719f07641b1b1ffbb65cf9daae8b028f4ab4619b4ff rust-std-1.23.0-powerpc64-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-powerpc64le-unknown-linux-gnu.tar.xz.sha256 +sha256 674f74245341119409e203109c22d432d0ed3312a6ff4d3b03cab251e61cc53a rust-std-1.23.0-powerpc64le-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/rust-std-1.23.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 0d87225dd081c7ea5002fdeb21983d23bc52fa37d23c88d5c97b2c44660f8af9 rust-std-1.23.0-x86_64-unknown-linux-gnu.tar.xz +# Locally generated +sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2 LICENSE-APACHE +sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3 LICENSE-MIT diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk new file mode 100644 index 0000000000..255573e582 --- /dev/null +++ b/package/rust-bin/rust-bin.mk @@ -0,0 +1,61 @@ +################################################################################ +# +# rust-bin +# +################################################################################ + +RUST_BIN_VERSION = 1.23.0 +RUST_BIN_SITE = https://static.rust-lang.org/dist +RUST_BIN_LICENSE = Apache-2.0 or MIT +RUST_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT + +HOST_RUST_BIN_PROVIDES = host-rustc + +HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz + +HOST_RUST_BIN_EXTRA_DOWNLOADS = \ + rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz \ + rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME).tar.xz + +HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME)/rust-std-$(RUST_HOST_NAME) + +define HOST_RUST_BIN_LIBSTD_EXTRACT + mkdir -p $(@D)/std + $(foreach f,$(HOST_RUST_BIN_EXTRA_DOWNLOADS), \ + $(call suitable-extractor,$(f)) $(DL_DIR)/$(f) | \ + $(TAR) -C $(@D)/std $(TAR_OPTIONS) - + ) + cd $(@D)/rustc/lib/rustlib; \ + ln -sf ../../../std/$(HOST_RUST_BIN_LIBSTD_HOST_PREFIX)/lib/rustlib/$(RUST_HOST_NAME) +endef + +HOST_RUST_BIN_POST_EXTRACT_HOOKS += HOST_RUST_BIN_LIBSTD_EXTRACT + +HOST_RUST_BIN_INSTALL_OPTS = \ + --prefix=$(HOST_DIR) \ + --disable-ldconfig + +ifeq ($(BR2_PACKAGE_HOST_RUST_BIN),y) +define HOST_RUST_BIN_INSTALL_RUSTC + (cd $(@D); \ + ./install.sh $(HOST_RUST_BIN_INSTALL_OPTS)) +endef + +define HOST_RUST_BIN_INSTALL_LIBSTD_HOST + (cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME); \ + ./install.sh $(HOST_RUST_BIN_INSTALL_OPTS)) +endef + +define HOST_RUST_BIN_INSTALL_LIBSTD_TARGET + (cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME); \ + ./install.sh $(HOST_RUST_BIN_INSTALL_OPTS)) +endef +endif + +define HOST_RUST_BIN_INSTALL_CMDS + $(HOST_RUST_BIN_INSTALL_RUSTC) + $(HOST_RUST_BIN_INSTALL_LIBSTD_HOST) + $(HOST_RUST_BIN_INSTALL_LIBSTD_TARGET) +endef + +$(eval $(host-generic-package)) diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host index a49f635d65..66c50c4579 100644 --- a/package/rustc/Config.in.host +++ b/package/rustc/Config.in.host @@ -24,8 +24,37 @@ config BR2_PACKAGE_HOST_RUSTC_ABI default "eabihf" if BR2_ARM_EABIHF default "abi64" if BR2_MIPS_NABI64 +config BR2_PACKAGE_HOST_RUSTC + bool "host rustc" + depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + help + Compiler for the Rust language + + http://www.rust-lang.org + +if BR2_PACKAGE_HOST_RUSTC + +choice + prompt "Rust compiler variant" + default BR2_PACKAGE_HOST_RUST_BIN + help + Select a Rust compiler + +config BR2_PACKAGE_HOST_RUST_BIN + bool "host rust (pre-built)" + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will install pre-built versions of the compiler + for the host and the Rust standard library for the target. + +endchoice + config BR2_PACKAGE_HAS_HOST_RUSTC bool config BR2_PACKAGE_PROVIDES_HOST_RUSTC string + default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN + +endif + From patchwork Sun Feb 4 18:07:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJcb37QRz9s72 for ; Mon, 5 Feb 2018 05:08:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7E61A86EFF; Sun, 4 Feb 2018 18:08:28 +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 Y9iGy9JdnYtg; Sun, 4 Feb 2018 18:08:27 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3B4568638F; Sun, 4 Feb 2018 18:08:27 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id EC2511C1540 for ; Sun, 4 Feb 2018 18:08:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E592387A17 for ; Sun, 4 Feb 2018 18:08:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BdwpQ8Gdk6HL for ; Sun, 4 Feb 2018 18:08:26 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by hemlock.osuosl.org (Postfix) with ESMTPS id 22EF387ACF for ; Sun, 4 Feb 2018 18:08:26 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id ACA3F5FFB4 for ; Sun, 4 Feb 2018 19:08:21 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:42 +0100 Message-Id: <20180204180749.29942-4-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 03/10] cargo-bin: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This new package fetches a binary version of Cargo, suitable to bootstrap the host variants of the Rust compiler and Cargo, the package manager. Signed-off-by: Eric Le Bihan --- DEVELOPERS | 1 + package/cargo-bin/cargo-bin.hash | 8 ++++++++ package/cargo-bin/cargo-bin.mk | 13 +++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 package/cargo-bin/cargo-bin.hash create mode 100644 package/cargo-bin/cargo-bin.mk diff --git a/DEVELOPERS b/DEVELOPERS index 7e04f872ac..70ca569feb 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -541,6 +541,7 @@ F: package/xxhash/ N: Eric Le Bihan F: docs/manual/adding-packages-meson.txt F: package/adwaita-icon-theme/ +F: package/cargo-bin/ F: package/darkhttpd/ F: package/eudev/ F: package/execline/ diff --git a/package/cargo-bin/cargo-bin.hash b/package/cargo-bin/cargo-bin.hash new file mode 100644 index 0000000000..ea121547b4 --- /dev/null +++ b/package/cargo-bin/cargo-bin.hash @@ -0,0 +1,8 @@ +# From https://static.rust-lang.org/dist/cargo-0.24.0-i686-unknown-linux-gnu.tar.xz.sha256 +sha256 6ffc847e0ee2a1273223ce500f7b212d051e99a6d234e34585d0c55e21a963ea cargo-0.24.0-i686-unknown-linux-gnu.tar.xz +# From https://static.rust-lang.org/dist/cargo-0.24.0-x86_64-unknown-linux-gnu.tar.xz.sha256 +sha256 93b953c8c7a2088aef952de8dccd7f6ccf9b21bf94b735d3909961ffe831da8c cargo-0.24.0-x86_64-unknown-linux-gnu.tar.xz +# Locally generated +sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2 LICENSE-APACHE +sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3 LICENSE-MIT +sha256 8bd89f9222dc80292f4107347103b693ac66f3a083371f0629ccf42338abe880 LICENSE-THIRD-PARTY diff --git a/package/cargo-bin/cargo-bin.mk b/package/cargo-bin/cargo-bin.mk new file mode 100644 index 0000000000..0f235748ff --- /dev/null +++ b/package/cargo-bin/cargo-bin.mk @@ -0,0 +1,13 @@ +################################################################################ +# +# cargo-bin +# +################################################################################ + +CARGO_BIN_VERSION = 0.24.0 +CARGO_BIN_SITE = https://static.rust-lang.org/dist +CARGO_BIN_SOURCE = cargo-$(CARGO_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz +CARGO_BIN_LICENSE = Apache-2.0 or MIT +CARGO_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT + +$(eval $(host-generic-package)) From patchwork Sun Feb 4 18:07:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJcm1QtTz9s72 for ; Mon, 5 Feb 2018 05:08:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8500187147; Sun, 4 Feb 2018 18:08:38 +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 3ZQ2EsY4xIbd; Sun, 4 Feb 2018 18:08:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 015A986425; Sun, 4 Feb 2018 18:08:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id CB2921C1540 for ; Sun, 4 Feb 2018 18:08:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C70C2879DF for ; Sun, 4 Feb 2018 18:08:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oNdhRXUsuPUT for ; Sun, 4 Feb 2018 18:08:35 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by hemlock.osuosl.org (Postfix) with ESMTPS id D7CCC87774 for ; Sun, 4 Feb 2018 18:08:34 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id B74D05FF7A for ; Sun, 4 Feb 2018 19:08:25 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:43 +0100 Message-Id: <20180204180749.29942-5-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 04/10] rust: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This new package provides rustc, the compiler for the Rust programming language, built from source. Currently, only the host variant is built. The Rust compiler uses LLVM as its backend: a copy of LLVM source code is provided and CMake is used to build it. It is possible to use a pre-built external copy. When LLVM/clang will be available in Buildroot, it would be possible to benefit from this feature and thus decrease build time. LLVM is configured to generate code for x86, ARM, PowerPC and MIPS architectures. The Rust compiler uses Cargo as its build system and is written in Rust. Therefore this package depends on cargo-bin and rust-bin. The internal build process is as follows: 1. stage0 compiler, provided by rust-bin, is used to build stage1 compiler. 2. stage1 compiler builds the final Rust compiler (stage2 compiler) and the standard library for the host architecture. 3. the standard library for the target architecture is built. The target architecture to support is given by the GNU/LLVM target triple. Rust supports some predefined targets [1]. As the build system expects the triple to be in the form of -unknown- and Buildroot toolchain wrapper uses -buildroot-, the package Makefile uses $(RUST_TARGET_NAME) defined in the rustc package and uses it instead of $(GNU_TARGET_NAME). When compiling Rust code with this compiler, the generated program only depends on the target C library, as it is statically linked to the Rust standard library and any other code from Rust packages (a.k.a. "crates"). If the jemalloc package is selected, support for this memory allocator will be enabled in the target standard library. The menuconfig entry for rustc is also updated to expose this provider. [1] https://forge.rust-lang.org/platform-support.html Signed-off-by: Eric Le Bihan --- DEVELOPERS | 1 + package/rust/rust.hash | 5 +++ package/rust/rust.mk | 79 ++++++++++++++++++++++++++++++++++++++++++++ package/rustc/Config.in.host | 19 +++++++++++ 4 files changed, 104 insertions(+) create mode 100644 package/rust/rust.hash create mode 100644 package/rust/rust.mk diff --git a/DEVELOPERS b/DEVELOPERS index 70ca569feb..0e041d6f40 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -550,6 +550,7 @@ F: package/jemalloc/ F: package/meson/ F: package/ninja/ F: package/rust-bin/ +F: package/rust/ F: package/s6/ F: package/s6-dns/ F: package/s6-linux-init/ diff --git a/package/rust/rust.hash b/package/rust/rust.hash new file mode 100644 index 0000000000..d6731b6dc2 --- /dev/null +++ b/package/rust/rust.hash @@ -0,0 +1,5 @@ +# From https://static.rust-lang.org/dist/rustc-1.23.0-src.tar.xz.sha256 +sha256 7196032371b50dd5582465b3bfa79ffd783b74f0711420d99b61b26c96fb3d80 rustc-1.23.0-src.tar.xz +# Locally generated +sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2 LICENSE-APACHE +sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3 LICENSE-MIT diff --git a/package/rust/rust.mk b/package/rust/rust.mk new file mode 100644 index 0000000000..6d6ac4370a --- /dev/null +++ b/package/rust/rust.mk @@ -0,0 +1,79 @@ +################################################################################ +# +# rust +# +################################################################################ + +RUST_VERSION = 1.23.0 +RUST_SOURCE = rustc-$(RUST_VERSION)-src.tar.xz +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_DEPENDENCIES = \ + toolchain \ + host-rust-bin \ + host-cargo-bin \ + host-python \ + $(BR2_CMAKE_HOST_DEPENDENCY) + +ifeq ($(BR2_PACKAGE_JEMALLOC),y) +HOST_RUST_DEPENDENCIES += jemalloc +HOST_RUST_JEMALLOC_ENABLED = true +HOST_RUST_JEMALLOC_CONF = 'jemalloc = "$(STAGING_DIR)/usr/lib/libjemalloc_pic.a"' +else +HOST_RUST_JEMALLOC_ENABLED = false +endif + +HOST_RUST_VERBOSITY = $(if $(VERBOSE),2,0) + +# Some vendor crates contain Cargo.toml.orig files. The associated +# .cargo-checksum.json file will contain a checksum for Cargo.toml.orig but +# support/scripts/apply-patches.sh will delete them. This will cause the build +# to fail, as Cargo will not be able to find the file and verify the checksum. +# So, remove all Cargo.toml.orig entries from the affected .cargo-checksum.json +# files +define HOST_RUST_EXCLUDE_ORIG_FILES + for file in $$(find $(@D) -name '*.orig'); do \ + crate=$$(dirname $${file}); \ + fn=$${crate}/.cargo-checksum.json; \ + sed -i -e 's/"Cargo.toml.orig":"[a-z0-9]\+",//g' $${fn}; \ + done +endef + +HOST_RUST_POST_EXTRACT_HOOKS += HOST_RUST_EXCLUDE_ORIG_FILES + +define HOST_RUST_CONFIGURE_CMDS + ( \ + echo '[build]'; \ + echo 'target = ["$(RUST_TARGET_NAME)"]'; \ + echo 'cargo = "$(HOST_CARGO_BIN_DIR)/cargo/bin/cargo"'; \ + echo 'rustc = "$(HOST_RUST_BIN_DIR)/rustc/bin/rustc"'; \ + echo 'python = "$(HOST_DIR)/bin/python2"'; \ + echo 'submodules = false'; \ + echo 'vendor = true'; \ + echo 'compiler-docs = false'; \ + echo 'docs = false'; \ + echo 'verbose = $(HOST_RUST_VERBOSITY)'; \ + echo '[install]'; \ + echo 'prefix = "$(HOST_DIR)"'; \ + echo '[rust]'; \ + echo 'use-jemalloc = $(HOST_RUST_JEMALLOC_ENABLED)'; \ + echo '[target.$(RUST_TARGET_NAME)]'; \ + echo 'cc = "$(TARGET_CROSS)gcc"'; \ + echo $(HOST_RUST_JEMALLOC_CONF); \ + ) > $(@D)/config.toml +endef + +define HOST_RUST_BUILD_CMDS + cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py build +endef + +define HOST_RUST_INSTALL_CMDS + cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py dist + cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py install +endef + +$(eval $(host-generic-package)) diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host index 66c50c4579..d93ff05209 100644 --- a/package/rustc/Config.in.host +++ b/package/rustc/Config.in.host @@ -40,6 +40,24 @@ choice help Select a Rust compiler +config BR2_PACKAGE_HOST_RUST + bool "host rust" + depends on BR2_HOST_GCC_AT_LEAST_4_7 # required by LLVM + # triggers ICE on trunc_int_for_mode, at explow.c:56 + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64 + select BR2_PACKAGE_HAS_HOST_RUSTC + help + This package will build the compiler for the host as well as + two flavors of the standard library: one for the host, another + for the target. Both are installed in the host directory. + +comment "host-rust needs a toolchain w/ gcc >= 5" + depends on BR2_aarch64 + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5 + +comment "host-rust needs host gcc >= 4.7" + depends on !BR2_HOST_GCC_AT_LEAST_4_7 + config BR2_PACKAGE_HOST_RUST_BIN bool "host rust (pre-built)" select BR2_PACKAGE_HAS_HOST_RUSTC @@ -54,6 +72,7 @@ config BR2_PACKAGE_HAS_HOST_RUSTC config BR2_PACKAGE_PROVIDES_HOST_RUSTC string + default "host-rust" if BR2_PACKAGE_HOST_RUST default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN endif From patchwork Sun Feb 4 18:07:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJcw4dXKz9sP9 for ; Mon, 5 Feb 2018 05:08:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F331F86D65; Sun, 4 Feb 2018 18:08:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9stgxVuCH5Tu; Sun, 4 Feb 2018 18:08:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 69D4C86C6A; Sun, 4 Feb 2018 18:08:45 +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 EDB511C1540 for ; Sun, 4 Feb 2018 18:08:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id EAEE786EEC for ; Sun, 4 Feb 2018 18:08:41 +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 1mon-ZIq1w5z for ; Sun, 4 Feb 2018 18:08:41 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by fraxinus.osuosl.org (Postfix) with ESMTPS id D6D5486432 for ; Sun, 4 Feb 2018 18:08:40 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 1BB485FFA2 for ; Sun, 4 Feb 2018 19:08:33 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:44 +0100 Message-Id: <20180204180749.29942-6-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 05/10] libssh2: add host variant X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Allow build of host variant of libssh2, which depends on host-openssl. Signed-off-by: Eric Le Bihan --- package/libssh2/libssh2.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/libssh2/libssh2.mk b/package/libssh2/libssh2.mk index 18e772c722..c5b0bd855e 100644 --- a/package/libssh2/libssh2.mk +++ b/package/libssh2/libssh2.mk @@ -40,4 +40,10 @@ else LIBSSH2_CONF_OPTS += --without-libz endif +HOST_LIBSSH2_DEPENDENCIES += host-openssl +HOST_LIBSSH2_CONF_OPTS += --with-openssl \ + --with-libssl-prefix=$(HOST_DIR)/usr \ + --without-libgcrypt + $(eval $(autotools-package)) +$(eval $(host-autotools-package)) From patchwork Sun Feb 4 18:07:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJd02ZZHz9sP9 for ; Mon, 5 Feb 2018 05:08:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B7A9626BAE; Sun, 4 Feb 2018 18:08:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n3i2Hf1pyY3R; Sun, 4 Feb 2018 18:08:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 0E735272EB; Sun, 4 Feb 2018 18:08:48 +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 2CD991C1540 for ; Sun, 4 Feb 2018 18:08:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2A20C86432 for ; Sun, 4 Feb 2018 18:08:45 +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 WhQDii6Fb7tl for ; Sun, 4 Feb 2018 18:08:44 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by fraxinus.osuosl.org (Postfix) with ESMTPS id B86248638F for ; Sun, 4 Feb 2018 18:08:44 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id C658F5FFAF for ; Sun, 4 Feb 2018 19:08:39 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:45 +0100 Message-Id: <20180204180749.29942-7-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 06/10] libhttpparser: add host variant X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Allow build of host variant of libhttpparser. Signed-off-by: Eric Le Bihan --- package/libhttpparser/libhttpparser.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/libhttpparser/libhttpparser.mk b/package/libhttpparser/libhttpparser.mk index 8ff0413322..1df26017e7 100644 --- a/package/libhttpparser/libhttpparser.mk +++ b/package/libhttpparser/libhttpparser.mk @@ -23,4 +23,13 @@ define LIBHTTPPARSER_INSTALL_TARGET_CMDS $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) PREFIX=$(TARGET_DIR)/usr install endef +define HOST_LIBHTTPPARSER_BUILD_CMDS + $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) library package +endef + +define HOST_LIBHTTPPARSER_INSTALL_CMDS + $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) PREFIX=$(HOST_DIR)/usr install +endef + $(eval $(generic-package)) +$(eval $(host-generic-package)) From patchwork Sun Feb 4 18:07:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJd54M6cz9sP9 for ; Mon, 5 Feb 2018 05:08:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 16E17819BA; Sun, 4 Feb 2018 18:08:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aB48BwzbNd+p; Sun, 4 Feb 2018 18:08:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 5708581090; Sun, 4 Feb 2018 18:08:50 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id BFA2F1C1540 for ; Sun, 4 Feb 2018 18:08:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A9D71805BC for ; Sun, 4 Feb 2018 18:08:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0sZExOU2o7zO for ; Sun, 4 Feb 2018 18:08:49 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by whitealder.osuosl.org (Postfix) with ESMTPS id C07A686B78 for ; Sun, 4 Feb 2018 18:08:48 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id C3D665FFD8 for ; Sun, 4 Feb 2018 19:08:43 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:46 +0100 Message-Id: <20180204180749.29942-8-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 07/10] libcurl: add host variant X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Eric Le Bihan --- package/libcurl/libcurl.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk index a1d2aa7a60..39ed3e4da5 100644 --- a/package/libcurl/libcurl.mk +++ b/package/libcurl/libcurl.mk @@ -88,4 +88,18 @@ endef LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP endif +HOST_LIBCURL_DEPENDENCIES = host-openssl +HOST_LIBCURL_CONF_OPTS = \ + --disable-manual \ + --disable-ntlm-wb \ + --disable-curldebug \ + --with-ssl \ + --without-gnutls \ + --without-mbedtls \ + --without-polarssl \ + --without-nss + +HOST_LIBCURL_POST_PATCH_HOOKS += LIBCURL_FIX_DOT_PC + $(eval $(autotools-package)) +$(eval $(host-autotools-package)) From patchwork Sun Feb 4 18:07:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJd92Zmgz9sP9 for ; Mon, 5 Feb 2018 05:09:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 437D287AAD; Sun, 4 Feb 2018 18:08:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a0K1FdJIDVZH; Sun, 4 Feb 2018 18:08:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id ED86787A17; Sun, 4 Feb 2018 18:08:57 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BBEF01C1540 for ; Sun, 4 Feb 2018 18:08:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B6B6B87A13 for ; Sun, 4 Feb 2018 18:08:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id itG35txFggfS for ; Sun, 4 Feb 2018 18:08:55 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9731787A05 for ; Sun, 4 Feb 2018 18:08:55 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 81A255FFA8 for ; Sun, 4 Feb 2018 19:08:47 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:47 +0100 Message-Id: <20180204180749.29942-9-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 08/10] cargo: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This new package provides Cargo, the Rust official package manager. Cargo is written in Rust and uses Cargo as its build system. It also depends on other Rust packages. Normally, a previously installed version of Cargo would be used to: 1. Fetch the dependencies. 2. Build the new version of Cargo, using the available Rust compiler. But the fetching step prevents offline builds. So instead two features of Cargo are leveraged: vendoring [1] and local registry. First, a tarball of the build dependencies generated using `cargo vendor` is fetched along with Cargo source code. Then, the build process is as follows: 1. The tarball of the build dependencies is uncompressed in a local registry. 2. A snapshot of Cargo, provided by cargo-bin, builds the final version of Cargo. 3. A configuration file telling Cargo how to cross-compile programs for the target is generated and installed. Currently, only the host variant is provided. [1] https://github.com/alexcrichton/cargo-vendor Signed-off-by: Eric Le Bihan --- DEVELOPERS | 1 + package/Config.in.host | 1 + package/cargo/Config.in.host | 8 ++++ package/cargo/cargo.hash | 8 ++++ package/cargo/cargo.mk | 91 ++++++++++++++++++++++++++++++++++++++++++++ package/cargo/config.in | 2 + 6 files changed, 111 insertions(+) create mode 100644 package/cargo/Config.in.host create mode 100644 package/cargo/cargo.hash create mode 100644 package/cargo/cargo.mk create mode 100644 package/cargo/config.in diff --git a/DEVELOPERS b/DEVELOPERS index 0e041d6f40..c524cb6ac5 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -542,6 +542,7 @@ N: Eric Le Bihan F: docs/manual/adding-packages-meson.txt F: package/adwaita-icon-theme/ F: package/cargo-bin/ +F: package/cargo/ F: package/darkhttpd/ F: package/eudev/ F: package/execline/ diff --git a/package/Config.in.host b/package/Config.in.host index 2f20dd0e48..199a8e9856 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -2,6 +2,7 @@ menu "Host utilities" source "package/aespipe/Config.in.host" source "package/android-tools/Config.in.host" + source "package/cargo/Config.in.host" source "package/cbootimage/Config.in.host" source "package/checkpolicy/Config.in.host" source "package/cmake/Config.in.host" diff --git a/package/cargo/Config.in.host b/package/cargo/Config.in.host new file mode 100644 index 0000000000..0f1ca305c6 --- /dev/null +++ b/package/cargo/Config.in.host @@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_CARGO + bool "host cargo" + depends on BR2_PACKAGE_HAS_HOST_RUSTC + help + Cargo is the package manager for the Rust programming + language. + + https://crates.io/ diff --git a/package/cargo/cargo.hash b/package/cargo/cargo.hash new file mode 100644 index 0000000000..f0990484d9 --- /dev/null +++ b/package/cargo/cargo.hash @@ -0,0 +1,8 @@ +# Locally generated +sha256 a9d4291254a1d622d3c3cb942aaa56ab4059b8d04915c3af234f0362f14722e8 cargo-0.24.0.tar.gz +sha256 dc7240d60a869fa24a68c8734fb7c810c27cca0a6dad52df6279865e4e8e7fae rust-installer-4f994850808a572e2cc8d43f968893c8e942e9bf.tar.gz +sha256 a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2 LICENSE-APACHE +sha256 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3 LICENSE-MIT +sha256 8bd89f9222dc80292f4107347103b693ac66f3a083371f0629ccf42338abe880 LICENSE-THIRD-PARTY +# From http://pkgs.fedoraproject.org/repo/pkgs/cargo/cargo-0.23.0-vendor.tar.xz/sha512 +sha512 60c12ce49a53cf986490f5a5fdf606f0374677902edfdc4d48ab1ba6094f3f23efc59626cd3776649c9386a9cab2a60332e5693aad6acbcbb92132efdcf9fe21 cargo-0.24.0-vendor.tar.xz diff --git a/package/cargo/cargo.mk b/package/cargo/cargo.mk new file mode 100644 index 0000000000..dd060fed03 --- /dev/null +++ b/package/cargo/cargo.mk @@ -0,0 +1,91 @@ +################################################################################ +# +# cargo +# +################################################################################ + +CARGO_VERSION = 0.24.0 +CARGO_SITE = $(call github,rust-lang,cargo,$(CARGO_VERSION)) +CARGO_LICENSE = Apache-2.0 or MIT +CARGO_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT + +CARGO_DEPS_SHA512 = 60c12ce49a53cf986490f5a5fdf606f0374677902edfdc4d48ab1ba6094f3f23efc59626cd3776649c9386a9cab2a60332e5693aad6acbcbb92132efdcf9fe21 +CARGO_DEPS_SITE = http://pkgs.fedoraproject.org/repo/pkgs/cargo/$(CARGO_DEPS_SOURCE)/sha512/$(CARGO_DEPS_SHA512) +CARGO_DEPS_SOURCE = cargo-$(CARGO_VERSION)-vendor.tar.xz + +CARGO_INSTALLER_VERSION = 4f994850808a572e2cc8d43f968893c8e942e9bf +CARGO_INSTALLER_SITE = $(call github,rust-lang,rust-installer,$(CARGO_INSTALLER_VERSION)) +CARGO_INSTALLER_SOURCE = rust-installer-$(CARGO_INSTALLER_VERSION).tar.gz + +HOST_CARGO_EXTRA_DOWNLOADS = \ + $(CARGO_DEPS_SITE)/$(CARGO_DEPS_SOURCE) \ + $(CARGO_INSTALLER_SITE)/$(CARGO_INSTALLER_SOURCE) + +HOST_CARGO_DEPENDENCIES = \ + $(BR2_CMAKE_HOST_DEPENDENCY) \ + host-pkgconf \ + host-openssl \ + host-libhttpparser \ + host-libssh2 \ + host-libcurl \ + host-rustc \ + host-cargo-bin + +HOST_CARGO_SNAP_BIN = $(HOST_CARGO_BIN_DIR)/cargo/bin/cargo +HOST_CARGO_HOME = $(HOST_DIR)/share/cargo + +define HOST_CARGO_EXTRACT_DEPS + @mkdir -p $(@D)/vendor + $(call suitable-extractor,$(CARGO_DEPS_SOURCE)) \ + $(DL_DIR)/$(CARGO_DEPS_SOURCE) | \ + $(TAR) --strip-components=1 -C $(@D)/vendor $(TAR_OPTIONS) - +endef + +HOST_CARGO_POST_EXTRACT_HOOKS += HOST_CARGO_EXTRACT_DEPS + +define HOST_CARGO_EXTRACT_INSTALLER + @mkdir -p $(@D)/src/rust-installer + $(call suitable-extractor,$(CARGO_INSTALLER_SOURCE)) \ + $(DL_DIR)/$(CARGO_INSTALLER_SOURCE) | \ + $(TAR) --strip-components=1 -C $(@D)/src/rust-installer $(TAR_OPTIONS) - +endef + +HOST_CARGO_POST_EXTRACT_HOOKS += HOST_CARGO_EXTRACT_INSTALLER + +define HOST_CARGO_SETUP_DEPS + mkdir -p $(@D)/.cargo + ( \ + echo "[source.crates-io]"; \ + echo "registry = 'https://github.com/rust-lang/crates.io-index'"; \ + echo "replace-with = 'vendored-sources'"; \ + echo "[source.vendored-sources]"; \ + echo "directory = '$(@D)/vendor'"; \ + ) > $(@D)/.cargo/config +endef + +HOST_CARGO_PRE_CONFIGURE_HOOKS += HOST_CARGO_SETUP_DEPS + +HOST_CARGO_SNAP_OPTS = \ + --release \ + $(if $(VERBOSE),--verbose) + +HOST_CARGO_ENV = \ + RUSTFLAGS="-Clink-arg=-Wl,-rpath,$(HOST_DIR)/lib" \ + CARGO_HOME=$(HOST_CARGO_HOME) + +define HOST_CARGO_BUILD_CMDS + (cd $(@D); $(HOST_MAKE_ENV) $(HOST_CARGO_ENV) $(HOST_CARGO_SNAP_BIN) \ + build $(HOST_CARGO_SNAP_OPTS)) +endef + +define HOST_CARGO_INSTALL_CMDS + $(INSTALL) -D -m 0755 $(@D)/target/release/cargo $(HOST_DIR)/bin/cargo + $(INSTALL) -D package/cargo/config.in \ + $(HOST_DIR)/share/cargo/config + $(SED) 's/@RUST_TARGET_NAME@/$(RUST_TARGET_NAME)/' \ + $(HOST_DIR)/share/cargo/config + $(SED) 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \ + $(HOST_DIR)/share/cargo/config +endef + +$(eval $(host-generic-package)) diff --git a/package/cargo/config.in b/package/cargo/config.in new file mode 100644 index 0000000000..cc048c71c4 --- /dev/null +++ b/package/cargo/config.in @@ -0,0 +1,2 @@ +[target.@RUST_TARGET_NAME@] +linker = "@CROSS_PREFIX@gcc" From patchwork Sun Feb 4 18:07:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJdN5lXZz9sP9 for ; Mon, 5 Feb 2018 05:09:12 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 55EB88306B; Sun, 4 Feb 2018 18:09:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8YjNy84zfeIc; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 5F64E83376; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 1F14C1C1540 for ; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1B3B98461E for ; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ioQSAxN0x3Sb for ; Sun, 4 Feb 2018 18:09:03 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by whitealder.osuosl.org (Postfix) with ESMTPS id EF5B98124A for ; Sun, 4 Feb 2018 18:09:01 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 6186F5FFEA for ; Sun, 4 Feb 2018 19:08:54 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:48 +0100 Message-Id: <20180204180749.29942-10-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 09/10] docs/manual: document cargo-based packages X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add instructions for adding a package which uses Cargo as build system. Signed-off-by: Eric Le Bihan --- docs/manual/adding-packages-cargo.txt | 110 ++++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 112 insertions(+) create mode 100644 docs/manual/adding-packages-cargo.txt diff --git a/docs/manual/adding-packages-cargo.txt b/docs/manual/adding-packages-cargo.txt new file mode 100644 index 0000000000..8de7c97cb9 --- /dev/null +++ b/docs/manual/adding-packages-cargo.txt @@ -0,0 +1,110 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +=== Integration of Cargo-based packages + +Cargo is the package manager for the Rust programming language. It allows the +user to build programs or libraries written in Rust, but it also downloads and +manages their dependencies, to ensure repeatable builds. Cargo packages are +called "crates". + +[[cargo-package-tutorial]] + +==== Cargo-based package's +Config.in+ file + +The +Config.in+ file of Cargo-based package 'foo' should contain: + +--------------------------- +01: config BR2_PACKAGE_FOO +02: bool "foo" +03: depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS +04: select BR2_PACKAGE_HOST_CARGO +05: help +06: This is a comment that explains what foo is. +07: +08: http://foosoftware.org/foo/ +--------------------------- + +==== 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: + +------------------------------ +01: ################################################################################ +02: # +03: # foo +04: # +05: ################################################################################ +06: +07: FOO_VERSION = 1.0 +08: FOO_SOURCE = foo-$(FOO_VERSION).tar.gz +09: FOO_SITE = http://www.foosoftware.org/download +10: FOO_LICENSE = GPLv3+ +11: FOO_LICENSE_FILES = COPYING +12: +13: FOO_DEPENDENCIES = host-cargo +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/$(RUST_TARGET_NAME)/$(FOO_CARGO_MODE) +19: +20: FOO_CARGO_OPTS = \ +21: --$(FOO_CARGO_MODE) \ +22: --target=$(RUST_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 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: + +* +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. + +==== About Dependencies Management + +A crate can depend on other libraries from crates.io or git repositories, listed +in its Cargo.toml file. Before starting a build, Cargo usually downloads +automatically them. This step can also be performed independently, via the ++cargo fetch+ command. + +Cargo maintains a local cache of the registry index and of git checkouts of the +crates, whose location is given by +$CARGO_HOME+. As seen in the package +Makefile example at line 15, this environment variable is set to ++$(HOST_DIR)/share/cargo+. + +This dependency download mechanism is not convenient when performing an offline +build, as Cargo will fail to fetch the dependencies. In that case, it is advised +to generate a tarball of the dependencies using the +cargo vendor+ and add it to ++FOO_EXTRA_DOWNLOADS+. diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt index e542124cf9..e8d40daee4 100644 --- a/docs/manual/adding-packages.txt +++ b/docs/manual/adding-packages.txt @@ -36,6 +36,8 @@ include::adding-packages-waf.txt[] include::adding-packages-meson.txt[] +include::adding-packages-cargo.txt[] + include::adding-packages-kernel-module.txt[] include::adding-packages-asciidoc.txt[] From patchwork Sun Feb 4 18:07:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Le Bihan X-Patchwork-Id: 869074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zZJdS52cGz9sP9 for ; Mon, 5 Feb 2018 05:09:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A7D8F82DBB; Sun, 4 Feb 2018 18:09:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cu+2S6SdlM0V; Sun, 4 Feb 2018 18:09:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id DDA0B836D9; Sun, 4 Feb 2018 18:09:10 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 84E671C1540 for ; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 813818461E for ; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IsHagxyBW8P3 for ; Sun, 4 Feb 2018 18:09:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by whitealder.osuosl.org (Postfix) with ESMTPS id 27D6F84C8A for ; Sun, 4 Feb 2018 18:09:06 +0000 (UTC) Received: from localhost.localdomain (unknown [185.225.208.28]) (Authenticated sender: eric.le.bihan.dev) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 904F55FF10 for ; Sun, 4 Feb 2018 19:09:01 +0100 (CET) From: Eric Le Bihan To: buildroot@buildroot.org Date: Sun, 4 Feb 2018 19:07:49 +0100 Message-Id: <20180204180749.29942-11-eric.le.bihan.dev@free.fr> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> References: <20180204180749.29942-1-eric.le.bihan.dev@free.fr> Subject: [Buildroot] [PATCH v10 10/10] support/testing: add tests for Rust X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" To test the support for the Rust language, the following tests are added: - building Rust compiler and Cargo from source. - installing a pre-built Rust compiler and building Cargo from source. For each test, a Rust test program is built and installed in the root file system of a ARM vexpress QEMU system. The test is declared OK if the program can be run properly from the test system. Signed-off-by: Eric Le Bihan --- support/testing/tests/package/test_rust.py | 107 +++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 support/testing/tests/package/test_rust.py diff --git a/support/testing/tests/package/test_rust.py b/support/testing/tests/package/test_rust.py new file mode 100644 index 0000000000..8035f8b83a --- /dev/null +++ b/support/testing/tests/package/test_rust.py @@ -0,0 +1,107 @@ +import os +import tempfile +import subprocess +import shutil + +import infra.basetest + + +class TestRustBase(infra.basetest.BRTest): + + target = 'armv7-unknown-linux-gnueabihf' + crate = 'hello-world' + + def login(self): + img = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv7", + kernel="builtin", + options=["-initrd", img]) + self.emulator.login() + + def build_test_prog(self): + hostdir = os.path.join(self.builddir, 'host') + env = os.environ.copy() + env["PATH"] = "{}:".format(os.path.join(hostdir, 'bin')) + env["PATH"] + env["CARGO_HOME"] = os.path.join(hostdir, 'usr', 'share', 'cargo') + env["RUST_TARGET_PATH"] = os.path.join(hostdir, 'etc', 'rustc') + cargo = os.path.join(hostdir, 'bin', 'cargo') + workdir = os.path.join(tempfile.mkdtemp(suffix='-br2-testing-rust'), + self.crate) + manifest = os.path.join(workdir, 'Cargo.toml') + prog = os.path.join(workdir, 'target', self.target, 'debug', self.crate) + + cmd = [cargo, 'init', '--bin', '--vcs', 'none', '-vv', workdir] + ret = subprocess.call(cmd, + stdout=self.b.logfile, + stderr=self.b.logfile, + env=env) + if ret != 0: + raise SystemError("Cargo init failed") + + cmd = [ + cargo, 'build', '-vv', '--target', self.target, + '--manifest-path', manifest + ] + ret = subprocess.call(cmd, + stdout=self.b.logfile, + stderr=self.b.logfile, + env=env) + if ret != 0: + raise SystemError("Cargo build failed") + + shutil.copy(prog, os.path.join(self.builddir, 'target', 'usr', 'bin')) + self.b.build() + shutil.rmtree(workdir) + + def test_run(self): + self.build_test_prog() + self.login() + _, exit_code = self.emulator.run(self.crate) + self.assertEqual(exit_code, 0) + + +class TestRustBin(TestRustBase): + config = \ + """ + BR2_arm=y + BR2_cortex_a9=y + BR2_ARM_ENABLE_NEON=y + BR2_ARM_ENABLE_VFP=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" + BR2_SYSTEM_DHCP="eth0" + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3" + BR2_LINUX_KERNEL_DEFCONFIG="vexpress" + BR2_LINUX_KERNEL_DTS_SUPPORT=y + BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9" + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_PACKAGE_HOST_CARGO=y + BR2_PACKAGE_HOST_RUSTC=y + """ + + +class TestRust(TestRustBase): + config = \ + """ + BR2_arm=y + BR2_cortex_a9=y + BR2_ARM_ENABLE_NEON=y + BR2_ARM_ENABLE_VFP=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" + BR2_SYSTEM_DHCP="eth0" + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11.3" + BR2_LINUX_KERNEL_DEFCONFIG="vexpress" + BR2_LINUX_KERNEL_DTS_SUPPORT=y + BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9" + BR2_TARGET_ROOTFS_CPIO=y + # BR2_TARGET_ROOTFS_TAR is not set + BR2_PACKAGE_HOST_CARGO=y + BR2_PACKAGE_HOST_RUSTC=y + BR2_PACKAGE_HOST_RUST=y + """