diff --git a/build-common.rs b/build-common.rs new file mode 100644 index 000000000..272aaec0a --- /dev/null +++ b/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"; + }; + return parts.join("-"); +} diff --git a/crossbeam-epoch/build-common.rs b/crossbeam-epoch/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-epoch/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-epoch/build.rs b/crossbeam-epoch/build.rs index b3bd15a5a..978141aa5 100644 --- a/crossbeam-epoch/build.rs +++ b/crossbeam-epoch/build.rs @@ -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: {}", diff --git a/crossbeam-queue/build-common.rs b/crossbeam-queue/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-queue/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-queue/build.rs b/crossbeam-queue/build.rs index d0eb3f313..6975dd8c2 100644 --- a/crossbeam-queue/build.rs +++ b/crossbeam-queue/build.rs @@ -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: {}", diff --git a/crossbeam-skiplist/build-common.rs b/crossbeam-skiplist/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-skiplist/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-skiplist/build.rs b/crossbeam-skiplist/build.rs index d0eb3f313..6975dd8c2 100644 --- a/crossbeam-skiplist/build.rs +++ b/crossbeam-skiplist/build.rs @@ -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: {}", diff --git a/crossbeam-utils/build-common.rs b/crossbeam-utils/build-common.rs new file mode 120000 index 000000000..929510c73 --- /dev/null +++ b/crossbeam-utils/build-common.rs @@ -0,0 +1 @@ +../build-common.rs \ No newline at end of file diff --git a/crossbeam-utils/build.rs b/crossbeam-utils/build.rs index dd6604792..617162fb5 100644 --- a/crossbeam-utils/build.rs +++ b/crossbeam-utils/build.rs @@ -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: {}",