From 7abac07275c3d2adafc0cec5767df65bf57bab60 Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Tue, 9 Oct 2018 10:24:44 +0200 Subject: [PATCH] rust: add armv7l targets --- .../patches/0001-Add-armv7l-targets.patch | 120 ++++++++++++++++++ srcpkgs/rust/template | 6 +- 2 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/rust/patches/0001-Add-armv7l-targets.patch diff --git a/srcpkgs/rust/patches/0001-Add-armv7l-targets.patch b/srcpkgs/rust/patches/0001-Add-armv7l-targets.patch new file mode 100644 index 00000000000000..49c52195d0efbe --- /dev/null +++ b/srcpkgs/rust/patches/0001-Add-armv7l-targets.patch @@ -0,0 +1,120 @@ +From b9f3dc661b9bbe0f1eee70dd8acb9c0203286c2d Mon Sep 17 00:00:00 2001 +From: Rasmus Thomsen +Date: Tue, 9 Oct 2018 10:20:47 +0200 +Subject: [PATCH] Add armv7l targets + +This spares us from having to hack around armv7l->armv7 for all +packages that need this. +--- + .../spec/armv7l_unknown_linux_gnueabihf.rs | 36 +++++++++++++++++ + .../spec/armv7l_unknown_linux_musleabihf.rs | 40 +++++++++++++++++++ + src/librustc_target/spec/mod.rs | 3 ++ + 3 files changed, 79 insertions(+) + create mode 100644 src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs + create mode 100644 src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs + +diff --git a/src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs +new file mode 100644 +index 000000000..14e8fa9dc +--- /dev/null ++++ b/src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs +@@ -0,0 +1,36 @@ ++// Copyright 2016 The Rust Project Developers. See the COPYRIGHT ++// file at the top-level directory of this distribution and at ++// http://rust-lang.org/COPYRIGHT. ++// ++// Licensed under the Apache License, Version 2.0 or the MIT license ++// , at your ++// option. This file may not be copied, modified, or distributed ++// except according to those terms. ++ ++use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; ++ ++pub fn target() -> TargetResult { ++ let base = super::linux_base::opts(); ++ Ok(Target { ++ llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), ++ target_endian: "little".to_string(), ++ target_pointer_width: "32".to_string(), ++ target_c_int_width: "32".to_string(), ++ data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), ++ arch: "arm".to_string(), ++ target_os: "linux".to_string(), ++ target_env: "gnu".to_string(), ++ target_vendor: "unknown".to_string(), ++ linker_flavor: LinkerFlavor::Gcc, ++ ++ options: TargetOptions { ++ // Info about features at https://wiki.debian.org/ArmHardFloatPort ++ features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), ++ cpu: "generic".to_string(), ++ max_atomic_width: Some(64), ++ abi_blacklist: super::arm_base::abi_blacklist(), ++ .. base ++ } ++ }) ++} +diff --git a/src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs b/src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs +new file mode 100644 +index 000000000..6e71cb307 +--- /dev/null ++++ b/src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs +@@ -0,0 +1,40 @@ ++// Copyright 2016 The Rust Project Developers. See the COPYRIGHT ++// file at the top-level directory of this distribution and at ++// http://rust-lang.org/COPYRIGHT. ++// ++// Licensed under the Apache License, Version 2.0 or the MIT license ++// , at your ++// option. This file may not be copied, modified, or distributed ++// except according to those terms. ++ ++use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; ++ ++pub fn target() -> TargetResult { ++ let base = super::linux_musl_base::opts(); ++ Ok(Target { ++ // It's important we use "gnueabihf" and not "musleabihf" here. LLVM ++ // uses it to determine the calling convention and float ABI, and LLVM ++ // doesn't support the "musleabihf" value. ++ llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), ++ target_endian: "little".to_string(), ++ target_pointer_width: "32".to_string(), ++ target_c_int_width: "32".to_string(), ++ data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), ++ arch: "arm".to_string(), ++ target_os: "linux".to_string(), ++ target_env: "musl".to_string(), ++ target_vendor: "unknown".to_string(), ++ linker_flavor: LinkerFlavor::Gcc, ++ ++ // Most of these settings are copied from the armv7_unknown_linux_gnueabihf ++ // target. ++ options: TargetOptions { ++ features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), ++ cpu: "generic".to_string(), ++ max_atomic_width: Some(64), ++ abi_blacklist: super::arm_base::abi_blacklist(), ++ .. base ++ } ++ }) ++} +diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs +index e54cd7731..615872f52 100644 +--- a/src/librustc_target/spec/mod.rs ++++ b/src/librustc_target/spec/mod.rs +@@ -372,6 +372,9 @@ supported_targets! { + ("armv7-unknown-cloudabi-eabihf", armv7_unknown_cloudabi_eabihf), + ("i686-unknown-cloudabi", i686_unknown_cloudabi), + ("x86_64-unknown-cloudabi", x86_64_unknown_cloudabi), ++ ++ ("armv7l-unknown-linux-gnueabihf", armv7l_unknown_linux_gnueabihf), ++ ("armv7l-unknown-linux-musleabihf", armv7l_unknown_linux_musleabihf), + } + + /// Everything `rustc` knows about how to compile for a specific target. +-- +2.19.1 + diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template index 68a18bc0a1c48a..83f015c1708ab5 100644 --- a/srcpkgs/rust/template +++ b/srcpkgs/rust/template @@ -1,7 +1,7 @@ # Template file for 'rust' pkgname=rust version=1.28.0 -revision=2 +revision=3 _rust_dist_version=1.28.0 _cargo_dist_version=0.30.0 # NB. if you push any(!) new version, don't forget to put a build @@ -79,8 +79,8 @@ case $XBPS_TARGET_MACHINE in x86_64-musl) _host_triplet=x86_64-unknown-linux-musl;; armv6l) _host_triplet=arm-unknown-linux-gnueabihf;; armv6l-musl) _host_triplet=arm-unknown-linux-musleabihf;; - armv7l) _host_triplet=armv7-unknown-linux-gnueabihf;; - armv7l-musl) _host_triplet=armv7-unknown-linux-musleabihf;; + armv7l) _host_triplet=armv7l-unknown-linux-gnueabihf;; + armv7l-musl) _host_triplet=armv7l-unknown-linux-musleabihf;; aarch64) _host_triplet=aarch64-unknown-linux-gnu;; aarch64-musl) _host_triplet=aarch64-unknown-linux-musl;; *) broken="Please add your triplet to the rust template!";;