|
| 1 | +# Recipes |
| 2 | + |
| 3 | +This section contains some recipes for common tasks that you may want to |
| 4 | +perform when contributing to rustup. |
| 5 | + |
| 6 | +## Supporting a new compilation target |
| 7 | + |
| 8 | +Adding support for a new compilation target involves the following steps: |
| 9 | + |
| 10 | +1. Informing rustup of the new target: |
| 11 | + |
| 12 | + Since you are here, it is quite likely that you are promoting a target from |
| 13 | + tier 3 to tier 2. As such, it is often sufficient to just cross-compile |
| 14 | + rustup from Linux to that target. |
| 15 | + |
| 16 | + You can refer to [rustup#4688] for a practical example for this step. You |
| 17 | + can find in that PR nearly all places where you would need to mention your |
| 18 | + new target in the rustup codebase. |
| 19 | + |
| 20 | + Notably, you would need to add a line in |
| 21 | + `ci/actions-templates/linux-builds-template.yaml` to include it in rustup's |
| 22 | + CI, while disabling the build for this target in all scenarios. At the |
| 23 | + moment of writing, this is done by appending the YAML comment |
| 24 | + `# skip-pr skip-master skip-stable` |
| 25 | + at the end of the line when mentioning your target in that file. |
| 26 | + |
| 27 | + [rustup#4688]: https://github.com/rust-lang/rustup/pull/4688 |
| 28 | + |
| 29 | +2. Stabilizing the target: |
| 30 | + |
| 31 | + When your new target reaches stable Rust, you can then enable the target in |
| 32 | + certain CI scenarios, depending on the popularity of the target. At the |
| 33 | + moment of writing, this is done by removing certain occurrences of `skip-*` |
| 34 | + in the aforementioned YAML comment. In most cases, you would only need to |
| 35 | + enable the target for the `stable` CI scenario by removing `skip-stable`. |
| 36 | + |
| 37 | + You can refer to [rustup#4816] for a practical example for this step. |
| 38 | + |
| 39 | + Do note that when creating the PR for this step, you will need to prove that |
| 40 | + the target's CI is indeed working by removing `skip-pr` in a separate commit |
| 41 | + to temporarily enable this target in this PR's CI. Once the CI is green, you |
| 42 | + can send the link ([example][send-link]) to that CI run in the PR thread for |
| 43 | + verification. After that, you can safely drop the temporary commit to get |
| 44 | + the PR ready for merging. |
| 45 | + |
| 46 | + [rustup#4816]: https://github.com/rust-lang/rustup/pull/4816 |
| 47 | + [send-link]: https://github.com/rust-lang/rustup/pull/4816#issuecomment-4263419604 |
0 commit comments