Skip to content

Generate the platform tier table from YAML #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 27 additions & 154 deletions platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,160 +13,33 @@ Platforms are identified by their "target triple" which is the string to inform
the compiler what kind of output should be produced. The columns below indicate
whether the corresponding component works on the specified platform.

## Tier 1

Tier 1 platforms can be thought of as "guaranteed to work".
Specifically they will each satisfy the following requirements:

* Official binary releases are provided for the platform.
* Automated testing is set up to run tests for the platform.
* Landing changes to the `rust-lang/rust` repository's master branch is gated on
tests passing.
* Documentation for how to use and how to build the platform is available.

| Target | std |rustc|cargo| notes |
|-------------------------------|-----|-----|-----|----------------------------|
| `i686-apple-darwin` | ✓ | ✓ | ✓ | 32-bit OSX (10.7+, Lion+) |
| `i686-pc-windows-gnu` | ✓ | ✓ | ✓ | 32-bit MinGW (Windows 7+) |
| `i686-pc-windows-msvc` | ✓ | ✓ | ✓ | 32-bit MSVC (Windows 7+) |
| `i686-unknown-linux-gnu` | ✓ | ✓ | ✓ | 32-bit Linux (2.6.18+) |
| `x86_64-apple-darwin` | ✓ | ✓ | ✓ | 64-bit OSX (10.7+, Lion+) |
| `x86_64-pc-windows-gnu` | ✓ | ✓ | ✓ | 64-bit MinGW (Windows 7+) |
| `x86_64-pc-windows-msvc` | ✓ | ✓ | ✓ | 64-bit MSVC (Windows 7+) |
| `x86_64-unknown-linux-gnu` | ✓ | ✓ | ✓ | 64-bit Linux (2.6.18+) |

## Tier 2

Tier 2 platforms can be thought of as "guaranteed to build". Automated tests
are not run so it's not guaranteed to produce a working build, but platforms
often work to quite a good degree and patches are always welcome! Specifically,
these platforms are required to have each of the following:

* Official binary releases are provided for the platform.
* Automated building is set up, but may not be running tests.
* Landing changes to the `rust-lang/rust` repository's master branch is gated on
platforms **building**. For some platforms only the standard library is
compiled, but for others `rustc` and `cargo` are too.

| Target | std |rustc|cargo| notes |
|-----------------------------------|-----|-----|-----|-------------------------------------|
| `aarch64-apple-ios` | ✓ | | | ARM64 iOS |
| `aarch64-fuchsia` | ✓ | | | ARM64 Fuchsia |
| `aarch64-linux-android` | ✓ | | | ARM64 Android |
| `aarch64-unknown-linux-gnu` | ✓ | ✓ | ✓ | ARM64 Linux |
| `aarch64-unknown-linux-musl` | ✓ | | | ARM64 Linux with MUSL |
| `arm-linux-androideabi` | ✓ | | | ARMv7 Android |
| `arm-unknown-linux-gnueabi` | ✓ | ✓ | ✓ | ARMv6 Linux |
| `arm-unknown-linux-gnueabihf` | ✓ | ✓ | ✓ | ARMv6 Linux, hardfloat |
| `arm-unknown-linux-musleabi` | ✓ | | | ARMv6 Linux with MUSL |
| `arm-unknown-linux-musleabihf` | ✓ | | | ARMv6 Linux, MUSL, hardfloat |
| `armv5te-unknown-linux-gnueabi` | ✓ | | | ARMv5TE Linux |
| `armv7-apple-ios` | ✓ | | | ARMv7 iOS, Cortex-a8 |
| `armv7-linux-androideabi` | ✓ | | | ARMv7a Android |
| `armv7-unknown-linux-gnueabihf` | ✓ | ✓ | ✓ | ARMv7 Linux |
| `armv7-unknown-linux-musleabihf` | ✓ | | | ARMv7 Linux with MUSL |
| `armv7s-apple-ios` | ✓ | | | ARMv7 iOS, Cortex-a9 |
| `asmjs-unknown-emscripten` | ✓ | | | asm.js via Emscripten |
| `i386-apple-ios` | ✓ | | | 32-bit x86 iOS |
| `i586-pc-windows-msvc` | ✓ | | | 32-bit Windows w/o SSE |
| `i586-unknown-linux-gnu` | ✓ | | | 32-bit Linux w/o SSE |
| `i586-unknown-linux-musl` | ✓ | | | 32-bit Linux w/o SSE, MUSL |
| `i686-linux-android` | ✓ | | | 32-bit x86 Android |
| `i686-unknown-freebsd` | ✓ | ✓ | ✓ | 32-bit FreeBSD |
| `i686-unknown-linux-musl` | ✓ | | | 32-bit Linux with MUSL |
| `mips-unknown-linux-gnu` | ✓ | ✓ | ✓ | MIPS Linux |
| `mips-unknown-linux-musl` | ✓ | | | MIPS Linux with MUSL |
| `mips64-unknown-linux-gnuabi64` | ✓ | ✓ | ✓ | MIPS64 Linux, n64 ABI |
| `mips64el-unknown-linux-gnuabi64` | ✓ | ✓ | ✓ | MIPS64 (LE) Linux, n64 ABI |
| `mipsel-unknown-linux-gnu` | ✓ | ✓ | ✓ | MIPS (LE) Linux |
| `mipsel-unknown-linux-musl` | ✓ | | | MIPS (LE) Linux with MUSL |
| `powerpc-unknown-linux-gnu` | ✓ | ✓ | ✓ | PowerPC Linux |
| `powerpc64-unknown-linux-gnu` | ✓ | ✓ | ✓ | PPC64 Linux |
| `powerpc64le-unknown-linux-gnu` | ✓ | ✓ | ✓ | PPC64LE Linux |
| `riscv32imac-unknown-none-elf` | * | | | Bare RISC-V (RV32IMAC ISA) |
| `riscv32imc-unknown-none-elf` | * | | | Bare RISC-V (RV32IMC ISA) |
| `riscv64gc-unknown-none-elf` | * | | | Bare RISC-V (RV64IMAFDC ISA) |
| `riscv64imac-unknown-none-elf` | * | | | Bare RISC-V (RV64IMAC ISA) |
| `s390x-unknown-linux-gnu` | ✓ | ✓ | ✓ | S390x Linux |
| `sparc64-unknown-linux-gnu` | ✓ | | | SPARC Linux |
| `sparcv9-sun-solaris` | ✓ | | | SPARC Solaris 10/11, illumos |
| `wasm32-unknown-unknown` | ✓ | | | WebAssembly |
| `wasm32-unknown-emscripten` | ✓ | | | WebAssembly via Emscripten |
| `x86_64-apple-ios` | ✓ | | | 64-bit x86 iOS |
| `x86_64-fortanix-unknown-sgx` | ✓ | | | [Fortanix ABI] for 64-bit Intel SGX |
| `x86_64-fuchsia` | ✓ | | | 64-bit Fuchsia |
| `x86_64-linux-android` | ✓ | | | 64-bit x86 Android |
| `x86_64-rumprun-netbsd` | ✓ | | | 64-bit NetBSD Rump Kernel |
| `x86_64-sun-solaris` | ✓ | | | 64-bit Solaris 10/11, illumos |
| `x86_64-unknown-cloudabi` | ✓ | | | 64-bit CloudABI |
| `x86_64-unknown-freebsd` | ✓ | ✓ | ✓ | 64-bit FreeBSD |
| `x86_64-unknown-linux-gnux32` | ✓ | | | 64-bit Linux |
| `x86_64-unknown-linux-musl` | ✓ | ✓ | ✓ | 64-bit Linux with MUSL |
| `x86_64-unknown-netbsd` | ✓ | ✓ | ✓ | NetBSD/amd64 |
| `x86_64-unknown-redox` | ✓ | | | Redox OS |

[Fortanix ABI]: https://edp.fortanix.com

<em>*</em> These are bare-metal microcontroller targets that only have access to
the core library, not std.

## Tier 2.5

Tier 2.5 platforms can be thought of as "guaranteed to build", but without
builds available through `rustup`. Automated tests are not run so it's not
guaranteed to produce a working build, but platforms often work to quite a good
degree and patches are always welcome! Specifically, these platforms are
required to have each of the following:

* Automated building is set up, but may not be running tests.
* Landing changes to the `rust-lang/rust` repository's master branch is gated on
platforms **building**. For some platforms only the standard library is
compiled, but for others `rustc` and `cargo` are too.

**This status is accidental: no new platforms should reach this state**

| Target | std |rustc|cargo| notes |
|-----------------------------------|-----|-----|-----|------------------------------|
| `aarch64-unknown-cloudabi` | ✓ | | | ARM64 CloudABI |
| `armv7-unknown-cloudabi-eabihf` | ✓ | | | ARMv7 CloudABI, hardfloat |
| `i686-unknown-cloudabi` | ✓ | | | 32-bit CloudABI |
| `powerpc-unknown-linux-gnuspe` | ✓ | | | PowerPC SPE Linux |
| `sparc-unknown-linux-gnu` | ✓ | | | 32-bit SPARC Linux |

## Tier 3

Tier 3 platforms are those which the Rust codebase has support for, but
which are not built or tested automatically, and may not work.
Official builds are not available.

| Target | std |rustc|cargo| notes |
|---------------------------------|-----|-----|-----|----------------------------------------------------------|
| `i686-pc-windows-msvc` (XP) | ✓ | | | Windows XP support |
| `i686-unknown-haiku` | ✓ | | | 32-bit Haiku |
| `i686-unknown-netbsd` | ✓ | | | NetBSD/i386 with SSE2 |
| `mips-unknown-linux-uclibc` | ✓ | | | MIPS Linux with uClibc |
| `mipsel-unknown-linux-uclibc` | ✓ | | | MIPS (LE) Linux with uClibc |
| `msp430-none-elf` | * | | | 16-bit MSP430 microcontrollers |
| `sparc64-unknown-netbsd` | ✓ | ✓ | | NetBSD/sparc64 |
| `thumbv6m-none-eabi` | * | | | Bare Cortex-M0, M0+, M1 |
| `thumbv7em-none-eabi` | * | | | Bare Cortex-M4, M7 |
| `thumbv7em-none-eabihf` | * | | | Bare Cortex-M4F, M7F, FPU, hardfloat |
| `thumbv7m-none-eabi` | * | | | Bare Cortex-M3 |
| `x86_64-pc-windows-msvc` (XP) | ✓ | | | Windows XP support |
| `x86_64-unknown-bitrig` | ✓ | ✓ | | 64-bit Bitrig |
| `x86_64-unknown-dragonfly` | ✓ | ✓ | | 64-bit DragonFlyBSD |
| `x86_64-unknown-haiku` | ✓ | | | 64-bit Haiku |
| `x86_64-unknown-openbsd` | ✓ | ✓ | | 64-bit OpenBSD |
| [NVPTX] | ** | | | `--emit=asm` generates PTX code that runs on NVIDIA GPUs |

[NVPTX]: https://github.com/japaric/nvptx#targets

<em>*</em> These are bare-metal microcontroller targets that only have access to
the core library, not std.

<em>**</em> There's backend support for these targets but no target built into
`rustc` (yet). You'll have to write your own target specification file (see the
links in the table). These targets only support the core library.
{% for tier in site.tiers %}
## {{ tier[0] }}

{{ tier[1].description }}

<table>
<tr>
<th>target</th>
<th>std</th>
<th>rustc</th>
<th>cargo</th>
<th>notes</th>
</tr>
{% for target in tier[1].platforms %}
<tr>
<td><code>{{ target.tuple }}</code></td>
<td>{{ target.std }}</td>
<td>{{ target.rustc }}</td>
<td>{{ target.cargo }}</td>
<td>{{ target.notes }}</td>
</tr>
{% endfor %}
</table>

{{ tier[1].footnotes }}

{% endfor %}

But those aren't the only platforms Rust can compile to! Those are the ones with
built-in target definitions and/or standard library support. When linking only
Expand Down
35 changes: 35 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,37 @@ mod channel {
}
}

mod tiers {
use serde::{Serialize, Deserialize};
use indexmap::IndexMap;

#[derive(Serialize, Deserialize)]
pub struct Platform {
pub tuple: String,
pub std: String,
pub rustc: Option<String>,
pub cargo: Option<String>,
pub notes: String,
}

#[derive(Serialize, Deserialize)]
pub struct Tier {
pub description: String,
pub platforms: Vec<Platform>,
pub footnotes: String,
}

/// `tiers.yaml` content.
#[derive(Serialize, Deserialize)]
#[serde(transparent)]
pub struct Tiers {
/// Maps Tier Name -> Data
pub tiers: IndexMap<String, Tier>,
}
}

mod config {
use super::tiers::Tiers;
use serde::Serialize;

#[derive(Serialize)]
Expand All @@ -32,12 +62,14 @@ mod config {
pub platforms: Vec<String>,
}

/// The Jekyll `_config.yaml` data.
#[derive(Serialize)]
pub struct Config {
pub exclude: &'static [&'static str],
pub include: &'static [&'static str],
pub rustup: Vec<String>,
pub channels: indexmap::IndexMap<&'static str, Channel>,
pub tiers: Tiers,
}
}

Expand All @@ -54,11 +86,14 @@ const CHANNELS: &[&str] = &["stable", "beta", "nightly"];
const CHANNEL_URL_PREFIX: &str = "https://static.rust-lang.org/dist/channel-rust-";

fn main() -> Result<(), Box<dyn Error>> {
let tiers: tiers::Tiers = serde_yaml::from_reader(File::open("tiers.yaml")?)?;

let mut cfg = config::Config {
exclude: &["target", "vendor"],
include: &["_rustinfra_config.json"],
rustup: Vec::new(),
channels: IndexMap::with_capacity(CHANNELS.len()),
tiers,
};

let rustup_url_regex = Regex::new(r"^rustup/dist/([^/]+)/rustup-init(?:\.exe)?$").unwrap();
Expand Down
Loading