Skip to content

Commit

Permalink
Update README for target information.
Browse files Browse the repository at this point in the history
Updated target information using the `target-info` command from `cross-dev`. Also added test detection for `cross-dev`, and fixed a bug with `powerpc64le-unknown-linux-gnu` using the wrong qemu architecture.
  • Loading branch information
Alexhuszagh committed Jun 8, 2022
1 parent cf38147 commit b0c6c1f
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 57 deletions.
96 changes: 49 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,56 +272,58 @@ terminate.

| Target | libc | GCC | C++ | QEMU | `test` |
|--------------------------------------|-------:|--------:|:---:|------:|:------:|
| `*-apple-ios` [1] | N/A | N/A | N/A | N/A ||
| `aarch64-linux-android` [2] | 9.0.0 | 4.9 || 5.1.0 ||
| `aarch64-unknown-linux-gnu` | 2.19 | 4.8.2 || 5.1.0 ||
| `aarch64-unknown-linux-musl` | 1.1.24 | 6.3.0 | | 5.1.0 ||
| `arm-linux-androideabi` [2] | 9.0.0 | 4.9 || 5.1.0 ||
| `arm-unknown-linux-gnueabi` | 2.17 | 8.3.0 || 5.1.0 ||
| `arm-unknown-linux-gnueabihf` | 2.27 | 7.3.0 || 5.1.0 ||
| `arm-unknown-linux-musleabi` | 1.1.24 | 6.3.0 | | 5.1.0 ||
| `arm-unknown-linux-musleabihf` | 1.1.24 | 6.3.0 | | 5.1.0 ||
| `aarch64-linux-android` [2] | 9.0.8 | 9.0.8 || 5.1.0 ||
| `aarch64-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `aarch64-unknown-linux-musl` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `arm-linux-androideabi` [2] | 9.0.8 | 9.0.8 || 5.1.0 ||
| `arm-unknown-linux-gnueabi` | 2.23 | 5.4.0 || 5.1.0 ||
| `arm-unknown-linux-gnueabihf` | 2.17 | 8.3.0 || 5.1.0 ||
| `arm-unknown-linux-musleabi` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `arm-unknown-linux-musleabihf` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `armv5te-unknown-linux-gnueabi` | 2.27 | 7.5.0 || 5.1.0 ||
| `armv5te-unknown-linux-musleabi` | 1.1.24 | 6.3.0 | | 5.1.0 ||
| `armv7-linux-androideabi` [2] | 9.0.0 | 4.9 || 5.1.0 ||
| `armv5te-unknown-linux-musleabi` | 1.1.24 | 9.2.0 | | 5.1.0 ||
| `armv7-linux-androideabi` [2] | 9.0.8 | 9.0.8 || 5.1.0 ||
| `armv7-unknown-linux-gnueabi` | 2.27 | 7.5.0 || 5.1.0 ||
| `armv7-unknown-linux-gnueabihf` | 2.15 | 4.6.2 || 5.1.0 ||
| `armv7-unknown-linux-musleabi` | 1.1.24 | 6.3.0 | | 5.1.0 ||
| `armv7-unknown-linux-musleabihf` | 1.1.24 | 6.3.0 | | 5.1.0 ||
| `asmjs-unknown-emscripten` [6] | 1.2.2 | 3.1.10 || N/A ||
| `i586-unknown-linux-gnu` | 2.23 | 5.3.1 || N/A ||
| `i586-unknown-linux-musl` | 1.1.24 | 6.3.0 | | N/A ||
| `i686-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A ||
| `i686-linux-android` [2] | 9.0.0 | 4.9 || 5.1.0 ||
| `i686-pc-windows-gnu` | N/A | 7.3.0 || N/A ||
| `i686-unknown-linux-gnu` | 2.15 | 4.6.2 || N/A ||
| `i686-unknown-linux-musl` | 1.1.24 | 6.3.0 | | N/A ||
| `mips-unknown-linux-gnu` | 2.23 | 5.3.1 || 5.1.0 ||
| `mips-unknown-linux-musl` | 1.1.24 | 6.3.0 || 5.1.0 ||
| `mips64-unknown-linux-gnuabi64` | 2.23 | 5.3.1 || 5.1.0 ||
| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.3.1 || 5.1.0 ||
| `mipsel-unknown-linux-gnu` | 2.23 | 5.3.1 || 5.1.0 ||
| `mipsel-unknown-linux-musl` | 1.1.24 | 6.3.0 || 5.1.0 ||
| `powerpc-unknown-linux-gnu` | 2.19 | 4.8.2 || 5.1.0 ||
| `powerpc64-unknown-linux-gnu` | 2.31 | 10.2.0 || 5.1.0 ||
| `powerpc64le-unknown-linux-gnu` | 2.19 | 4.8.2 || 5.1.0 ||
| `armv7-unknown-linux-gnueabihf` | 2.23 | 5.4.0 || 5.1.0 ||
| `armv7-unknown-linux-musleabi` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `armv7-unknown-linux-musleabihf` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `i586-unknown-linux-gnu` | 2.23 | 5.4.0 || N/A ||
| `i586-unknown-linux-musl` | 1.1.24 | 9.2.0 || N/A ||
| `i686-unknown-freebsd` [4] | 1.5 | 6.4.0 || N/A | |
| `i686-linux-android` [2] | 9.0.8 | 9.0.8 || 5.1.0 ||
| `i686-pc-windows-gnu` | N/A | 7.5 || N/A ||
| `i686-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `i686-unknown-linux-musl` | 1.1.24 | 9.2.0 || N/A ||
| `mips-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `mips-unknown-linux-musl` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `mips64-unknown-linux-gnuabi64` | 2.23 | 5.4.0 || 5.1.0 ||
| `mips64-unknown-linux-muslabi64` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.4.0 || 5.1.0 ||
| `mips64el-unknown-linux-muslabi64` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `mipsel-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `mipsel-unknown-linux-musl` | 1.1.24 | 9.2.0 || 5.1.0 ||
| `powerpc-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `powerpc64-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `powerpc64le-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `riscv64gc-unknown-linux-gnu` | 2.27 | 7.5.0 || 5.1.0 ||
| `s390x-unknown-linux-gnu` | 2.23 | 5.3.1 || 5.1.0 | |
| `sparc64-unknown-linux-gnu` | 2.31 | 10.2.0 || 5.1.0 ||
| `sparcv9-sun-solaris` [4] | 2.11 | 5.3.0 || N/A | |
| `thumbv6m-none-eabi` [5] | 2.2.0 | 5.3.1 | | N/A | |
| `thumbv7em-none-eabi` [5] | 2.2.0 | 5.3.1 | | N/A | |
| `thumbv7em-none-eabihf` [5] | 2.2.0 | 5.3.1 | | N/A | |
| `thumbv7m-none-eabi` [5] | 2.2.0 | 5.3.1 | | N/A | |
| `wasm32-unknown-emscripten` [6] | 1.2.2 | 3.1.10 || N/A ||
| `x86_64-linux-android` [2] | 9.0.0 | 4.9 || 5.1.0 ||
| `x86_64-pc-windows-gnu` | N/A | 7.3.0 || N/A ||
| `x86_64-sun-solaris` [4] | 2.11 | 5.3.0 || N/A | |
| `x86_64-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A ||
| `x86_64-unknown-dragonfly` [4] [3] | 4.6.0 | 5.3.0 || N/A | |
| `x86_64-unknown-linux-gnu` | 2.15 | 4.6.2 || N/A ||
| `x86_64-unknown-linux-musl` | 1.1.24 | 6.3.0 | | N/A ||
| `x86_64-unknown-netbsd` [4] | 7.0 | 5.3.0 || N/A | |
| `s390x-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `sparc64-unknown-linux-gnu` | 2.23 | 5.4.0 || 5.1.0 ||
| `thumbv6m-none-eabi` [5] | 2.2.0 | 4.9.3 | | N/A | |
| `thumbv7em-none-eabi` [5] | 2.2.0 | 4.9.3 | | N/A | |
| `thumbv7em-none-eabihf` [5] | 2.2.0 | 4.9.3 | | N/A | |
| `thumbv7m-none-eabi` [5] | 2.2.0 | 4.9.3 | | N/A | |
| `x86_64-linux-android` [2] | 9.0.8 | 9.0.8 || 5.1.0 ||
| `x86_64-pc-windows-gnu` | N/A | 7.3 || N/A ||
| `x86_64-unknown-freebsd` [4] | 1.5 | 6.4.0 || N/A | |
| `x86_64-unknown-dragonfly` [4] [3] | 6.0.1 | 5.3.0 || N/A | |
| `x86_64-unknown-linux-gnu` | 2.17 | 4.8.5 || 4.2.1 ||
| `x86_64-unknown-linux-musl` | 1.1.24 | 9.2.0 || N/A ||
| `x86_64-unknown-netbsd` [4] | 9.2.0 | 9.4.0 || N/A | |
<!--| `*-apple-ios` [1] | N/A | N/A | N/A | N/A | ✓ |-->
<!--| `asmjs-unknown-emscripten` [6] | 1.2.2 | 3.1.10 | ✓ | N/A | ✓ |-->
<!--| `wasm32-unknown-emscripten` [6] | 1.2.2 | 3.1.10 | ✓ | N/A | ✓ |-->
<!--| `sparcv9-sun-solaris` [4] | 2.11 | 5.3.0 | ✓ | N/A | |-->
<!--| `x86_64-sun-solaris` [4] | 2.11 | 5.3.0 | ✓ | N/A | |-->

[1] iOS cross compilation is supported on macOS hosts.

Expand Down
34 changes: 29 additions & 5 deletions cross-dev/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![deny(missing_debug_implementations, rust_2018_idioms)]

use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};

Expand Down Expand Up @@ -72,6 +73,15 @@ struct Env {
#[derive(Debug, PartialEq, Deserialize)]
struct Matrix {
target: String,
#[serde(default)]
run: i64,
}

impl Matrix {
fn has_test(&self, target: &str) -> bool {
// bare-metal targets don't have unittests right now
self.run != 0 && !target.contains("-none-")
}
}

fn get_container_engine(engine: Option<&str>) -> Result<PathBuf, which::Error> {
Expand Down Expand Up @@ -117,6 +127,7 @@ fn image_info(
image: &str,
tag: &str,
verbose: bool,
has_test: bool,
) -> cross::Result<()> {
if !tag.starts_with("local") {
pull_image(engine, image, verbose)?;
Expand All @@ -127,6 +138,9 @@ fn image_info(
command.arg("-it");
command.arg("--rm");
command.args(&["-e", &format!("TARGET={target}")]);
if has_test {
command.args(&["-e", "HAS_TEST=1"]);
}
command.arg(image);
command.args(&["bash", "-c", TARGET_INFO_SCRIPT]);

Expand All @@ -145,10 +159,15 @@ fn target_info(
repository: &str,
tag: &str,
) -> cross::Result<()> {
let workflow: Workflow = serde_yaml::from_str(WORKFLOW)?;
let matrix = &workflow.jobs.generate_matrix.steps[0].env.matrix;
let matrix: Vec<Matrix> = serde_yaml::from_str(matrix)?;
let test_map: BTreeMap<&str, bool> = matrix
.iter()
.map(|i| (i.target.as_ref(), i.has_test(&i.target)))
.collect();

if targets.is_empty() {
let workflow: Workflow = serde_yaml::from_str(WORKFLOW)?;
let matrix = &workflow.jobs.generate_matrix.steps[0].env.matrix;
let matrix: Vec<Matrix> = serde_yaml::from_str(matrix)?;
targets = matrix
.iter()
.map(|t| t.target.clone())
Expand All @@ -157,8 +176,13 @@ fn target_info(
}

for target in targets {
let image = format_image(registry, repository, &target, tag);
image_info(engine, &target, &image, tag, verbose)?;
let target = target.as_ref();
let image = format_image(registry, repository, target, tag);
let has_test = test_map
.get(&target)
.cloned()
.ok_or_else(|| eyre::eyre!("invalid target name {}", target))?;
image_info(engine, target, &image, tag, verbose, has_test)?;
}

Ok(())
Expand Down
11 changes: 6 additions & 5 deletions cross-dev/target_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ case "${arch}" in
qarch="ppc64"
;;
powerpc64le)
if [ "${CROSS_RUNNER}" = "qemu-user" ]; then
qarch="ppc64le"
else
qarch="ppc64"
fi
qarch="ppc64le"
;;
riscv64*)
qarch="riscv64"
Expand Down Expand Up @@ -325,4 +321,9 @@ if [ "$qemu" != "" ]; then
else
printf " N/A |"
fi
if [ "${HAS_TEST}" != "" ]; then
printf " ✓ |"
else
printf " |"
fi
printf "\n"

0 comments on commit b0c6c1f

Please sign in to comment.