From patchwork Tue Jul 17 04:29:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Voss X-Patchwork-Id: 944714 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.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="f/gc4D+u"; dkim-atps=neutral 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 41V6ls6hLHz9s3Z for ; Tue, 17 Jul 2018 14:30:49 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6BF398968B; Tue, 17 Jul 2018 04:30: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 iHmiizK0HPTH; Tue, 17 Jul 2018 04:30:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 1FCA189573; Tue, 17 Jul 2018 04:30:45 +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 EC1981C16D0 for ; Tue, 17 Jul 2018 04:30:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E9B3289573 for ; Tue, 17 Jul 2018 04:30:43 +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 JeCYzvYZcN23 for ; Tue, 17 Jul 2018 04:30:43 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4C0758945A for ; Tue, 17 Jul 2018 04:30:43 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id j185-v6so59707ite.1 for ; Mon, 16 Jul 2018 21:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=y5uOVIZsmDjovMQtIaqKJLuAOewI8x4hWv9xI2LRF30=; b=f/gc4D+u9QJYs3sFLRHRDrD7fzhDOSVo+bHWIdGV3pwc5wKxrAGUnWF7QsjSfmXFzF A5GifMVpYJ8ce7ObdRW1rtE51kxrpvxyOpKo48TQCL2ex31RyETvfxG8J3g0DYbbA3bD Vu4YnHAngpR4FJUwCa4rKjC3ZctIhIy55S9hU28zXI1/PitL6zPq7fblCPKVpqqQTocO hCzkTlEi+NC7h/EkrJwEueJ1T+/IDR/AoERRB95CIs1puntLchyU+lzlcRJalVXV51Im ix5q8Cp9lNeCKjUPuD5XotFqT8/saSw0LB0/ouVatcl2Qu2jyjjp1+2dhofw1tzDQ1G4 K0GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=y5uOVIZsmDjovMQtIaqKJLuAOewI8x4hWv9xI2LRF30=; b=nZM8VTGNgt3TaTE0KEi9ZdCgQIb0SQAR3nPn6CBNSrsTtYWwJFAI59MXH6cgjJsqWn PZTNYirxu8lHcMLRFAqy2MDdCHOYwPKKm92sAZeEeXxErWrscAnqK8TvW2hi6Ntbh9hS 9qeiboRloLAKFXcWaqahNG5+FjulkejMYjZ6u6G2qYkOeD7UFPmiNZkmeunObw9glQdt kuOpCZNEMuOZz7XQCIls/CojtwYV7vcvvvaPETNSn9kaZoo/U3HrcdCPO+rzTDhlGLgJ Y81a2+i0crY289dtBV4WJm1sxoKNssvbi6jY5Po1v/M46ofz8AN4lMWmG6lXNO84Kqa8 oXBQ== X-Gm-Message-State: AOUpUlHTIJYICKAnJSwnKzQRFquWyqXSd0LeDdqdhNlcpOD4rhZhpXpK S6bWKdQ6UGL3LI97ZDdC+UvTU3ku X-Google-Smtp-Source: AAOMgpekkcB2tUpgcz8PbX6eFHu0sC1UI+m+ONptHfpfnzyfOa1ECYW+p/TONC1wAjOX/wI9K0tyNA== X-Received: by 2002:a02:c43:: with SMTP id g64-v6mr25736jad.138.1531801842328; Mon, 16 Jul 2018 21:30:42 -0700 (PDT) Received: from blueberry.localdomain ([209.252.171.88]) by smtp.gmail.com with ESMTPSA id u12-v6sm133402ita.1.2018.07.16.21.30.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jul 2018 21:30:41 -0700 (PDT) From: sam.voss@gmail.com To: buildroot@buildroot.org Date: Mon, 16 Jul 2018 23:29:53 -0500 Message-Id: <20180717042953.23648-1-sam.voss@gmail.com> X-Mailer: git-send-email 2.18.0 Subject: [Buildroot] [PATCH] rust: Modify Rust to be usable as host-tool only 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: , Cc: eric.le.bihan.dev@free.fr, Sam Voss MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Sam Voss Modify host-rust virtual package to default to host-rust-bin when no other selection has been made, as long as the host supports rust. This allows host only tools to still use rust when the target architecture does not support it. Add target-specific variable which is used to differentiate host and target arch requirements (BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS). A target package shall depend on this variable where a host package will use the previously defined BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS. The new "target" version is selectable for the same set of architectures as before, but now depends on the host variant. Signed-off-by: Sam Voss --- Note: this has been tested on x86_64 host compiling to: - x86_64 qemu target (building package to be upstreamed shortly) - mips64el (based on librsvg build failures seen at http://autobuild.buildroot.net/results/f33/f335ed517b402c094ed3b10a3da4cdc23620dbd6/defconfig) this target was only tested to compile, with no runtime tests. package/rust-bin/rust-bin.mk | 5 ++++- package/rust/rust.mk | 1 + package/rustc/Config.in.host | 21 ++++++++++++++++++--- package/rustc/rustc.mk | 2 ++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/package/rust-bin/rust-bin.mk b/package/rust-bin/rust-bin.mk index e10dbcebd0..c426da8d15 100644 --- a/package/rust-bin/rust-bin.mk +++ b/package/rust-bin/rust-bin.mk @@ -15,7 +15,10 @@ HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz HOST_RUST_BIN_EXTRA_DOWNLOADS = \ rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz \ - rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME).tar.xz + +ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y) +HOST_RUST_BIN_EXTRA_DOWNLOADS += rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME).tar.xz +endif HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME)/rust-std-$(RUSTC_HOST_NAME) diff --git a/package/rust/rust.mk b/package/rust/rust.mk index af5c366495..c11dbb23b0 100644 --- a/package/rust/rust.mk +++ b/package/rust/rust.mk @@ -19,6 +19,7 @@ HOST_RUST_DEPENDENCIES = \ host-python \ $(BR2_CMAKE_HOST_DEPENDENCY) + ifeq ($(BR2_PACKAGE_JEMALLOC),y) HOST_RUST_DEPENDENCIES += jemalloc HOST_RUST_JEMALLOC_ENABLED = true diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host index 2ae8f89d3f..d7f0efcd3f 100644 --- a/package/rustc/Config.in.host +++ b/package/rustc/Config.in.host @@ -14,6 +14,19 @@ config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS depends on BR2_TOOLCHAIN_USES_GLIBC depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" +config BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS + bool + 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 \ + && !(BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI) + default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le + 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_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS + config BR2_PACKAGE_HOST_RUSTC_ARCH string default "armv7" if BR2_ARM_CPU_ARMV7A @@ -66,9 +79,11 @@ config BR2_PACKAGE_HOST_RUST_BIN endchoice +endif + 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 + # Default to host-rust-bin as long as host arch supports it + default "host-rust-bin" if !BR2_PACKAGE_HOST_RUST + depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk index bed74f3c2c..6eea9b4fc5 100644 --- a/package/rustc/rustc.mk +++ b/package/rustc/rustc.mk @@ -7,7 +7,9 @@ RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH)) RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI)) +ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y) RUSTC_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI) +endif ifeq ($(HOSTARCH),x86) RUSTC_HOST_ARCH = i686