Skip to content

Commit

Permalink
Merge #922 #926
Browse files Browse the repository at this point in the history
922: When building for linux, replace all vendors with 'unknown' r=taiki-e a=kanavin

Some build systems such as the Yocto project define custom rust targets, of the form 'arch-somevendor-linux-{gnu|musl}' (only the 'somevendor' part is custom, the rest matches rust's definitions).

This causes mismatches with crossbeam's lists of targets which are built from the standard rust target list, and always have 'unknown' as the vendor.

This change simply replaces such custom vendors with 'unknown' when the third component of the target is 'linux'.

---
Note from Alex: this is a reworked and hopefully better/more precise/acceptable version of #751

926: crossbeam-epoch: Bump memoffset to 0.7 r=taiki-e a=glittershark

mostly to keep the number of dupes of crates in my dependency graph down

Co-authored-by: Alexander Kanavin <alex@linutronix.de>
Co-authored-by: Griffin Smith <root@gws.fyi>
  • Loading branch information
3 people committed Nov 17, 2022
3 parents c840da4 + e78e511 + ac18a14 commit 0a14e12
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 5 deletions.
13 changes: 13 additions & 0 deletions build-common.rs
@@ -0,0 +1,13 @@
// The target triplets have the form of 'arch-vendor-system'.
//
// When building for Linux (e.g. the 'system' part is
// 'linux-something'), replace the vendor with 'unknown'
// so that mapping to rust standard targets happens correctly.
fn convert_custom_linux_target(target: String) -> String {
let mut parts: Vec<&str> = target.split('-').collect();
let system = parts[2];
if system == "linux" {
parts[1] = "unknown";
};
parts.join("-")
}
2 changes: 1 addition & 1 deletion crossbeam-epoch/Cargo.toml
Expand Up @@ -38,7 +38,7 @@ autocfg = "1"

[dependencies]
cfg-if = "1"
memoffset = "0.6"
memoffset = "0.7"
scopeguard = { version = "1.1", default-features = false }

# Enable the use of loom for concurrency testing.
Expand Down
1 change: 1 addition & 0 deletions crossbeam-epoch/build-common.rs
3 changes: 2 additions & 1 deletion crossbeam-epoch/build.rs
Expand Up @@ -15,10 +15,11 @@
use std::env;

include!("no_atomic.rs");
include!("build-common.rs");

fn main() {
let target = match env::var("TARGET") {
Ok(target) => target,
Ok(target) => convert_custom_linux_target(target),
Err(e) => {
println!(
"cargo:warning={}: unable to get TARGET environment variable: {}",
Expand Down
1 change: 1 addition & 0 deletions crossbeam-queue/build-common.rs
3 changes: 2 additions & 1 deletion crossbeam-queue/build.rs
Expand Up @@ -15,10 +15,11 @@
use std::env;

include!("no_atomic.rs");
include!("build-common.rs");

fn main() {
let target = match env::var("TARGET") {
Ok(target) => target,
Ok(target) => convert_custom_linux_target(target),
Err(e) => {
println!(
"cargo:warning={}: unable to get TARGET environment variable: {}",
Expand Down
1 change: 1 addition & 0 deletions crossbeam-skiplist/build-common.rs
3 changes: 2 additions & 1 deletion crossbeam-skiplist/build.rs
Expand Up @@ -15,10 +15,11 @@
use std::env;

include!("no_atomic.rs");
include!("build-common.rs");

fn main() {
let target = match env::var("TARGET") {
Ok(target) => target,
Ok(target) => convert_custom_linux_target(target),
Err(e) => {
println!(
"cargo:warning={}: unable to get TARGET environment variable: {}",
Expand Down
1 change: 1 addition & 0 deletions crossbeam-utils/build-common.rs
3 changes: 2 additions & 1 deletion crossbeam-utils/build.rs
Expand Up @@ -27,10 +27,11 @@
use std::env;

include!("no_atomic.rs");
include!("build-common.rs");

fn main() {
let target = match env::var("TARGET") {
Ok(target) => target,
Ok(target) => convert_custom_linux_target(target),
Err(e) => {
println!(
"cargo:warning={}: unable to get TARGET environment variable: {}",
Expand Down

0 comments on commit 0a14e12

Please sign in to comment.