Skip to content
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

Finalise Rustup Windows Arm64 support #3840

Merged
merged 1 commit into from
Jun 5, 2024
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
43 changes: 43 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,29 @@
<p class="other-platforms-help">You appear to be running Windows 64-bit. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
</div>

<div id="platform-instructions-win-arm64" class="instructions display-none">
<p>
To install Rust, download and run
<a class="windows-download" href="https://win.rustup.rs/aarch64">rustup&#x2011;init.exe</a>
then follow the onscreen instructions.
</p>
<p>You may also need the <a href="https://rust-lang.github.io/rustup/installation/windows-msvc.html">Visual Studio prerequisites</a>.</p>
<hr/>
<p>If you're a Windows Subsystem for Linux user run the following in your terminal, then follow the onscreen instructions to install Rust.</p>
<div class="copy-container">
<pre class="rustup-command">curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh</pre>
<button id="copy-button-win-arm64" class="copy-button" title="Copy curl command to clipboard to download Rustup" type="button">
<div class="copy-icon">
<svg width="24" height="25" viewBox="0 0 24 25" xmlns="http://www.w3.org/2000/svg" alt="Copy curl command to clipboard to download Rustup">
<path d="M18 20h2v3c0 1-1 2-2 2H2c-.998 0-2-1-2-2V5c0-.911.755-1.667 1.667-1.667h5A3.323 3.323 0 0110 0a3.323 3.323 0 013.333 3.333h5C19.245 3.333 20 4.09 20 5v8.333h-2V9H2v14h16v-3zM3 7h14c0-.911-.793-1.667-1.75-1.667H13.5c-.957 0-1.75-.755-1.75-1.666C11.75 2.755 10.957 2 10 2s-1.75.755-1.75 1.667c0 .911-.793 1.666-1.75 1.666H4.75C3.793 5.333 3 6.09 3 7z"></path><path d="M4 19h6v2H4zM12 11H4v2h8zM4 17h4v-2H4zM15 15v-3l-4.5 4.5L15 21v-3l8.027-.032L23 15z"></path>
</svg>
</div>
<div id="copy-status-message-win-arm64" class="copy-button-text">Copied!</div>
</button>
</div>
<p class="other-platforms-help">You appear to be running Windows on Arm. If not, <a class="default-platform-button" href="#">display all supported installers</a>.</p>
</div>

<div id="platform-instructions-unknown" class="instructions display-none">
<!-- unrecognized platform: ask for help -->
<p>I don't recognize your platform.</p>
Expand Down Expand Up @@ -132,6 +155,16 @@

<hr/>

<div>
<p>
If you are running Windows on Arm,<br/>download and run
<a class="windows-download" href="https://win.rustup.rs/aarch64">rustup&#x2011;init.exe</a>
then follow the onscreen instructions.
</p>
</div>

<hr/>

<div>
<p>
If you are running Windows 32-bit,<br/>download and run
Expand Down Expand Up @@ -171,6 +204,16 @@

<hr/>

<div>
<p>
If you are running Windows on Arm,<br/>download and run
<a class="windows-download" href="https://win.rustup.rs/aarch64">rustup&#x2011;init.exe</a>
rami3l marked this conversation as resolved.
Show resolved Hide resolved
then follow the onscreen instructions.
</p>
</div>

<hr/>

<div>
<p>
If you are running Windows 32-bit,<br/>download and run
Expand Down
6 changes: 6 additions & 0 deletions www/rustup.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ hr {
#platform-instructions-unix > p,
#platform-instructions-win32 > p,
#platform-instructions-win64 > p,
#platform-instructions-win-arm64 > p,
#platform-instructions-default > p,
#platform-instructions-unknown > p {
width: 40rem;
Expand Down Expand Up @@ -138,6 +139,7 @@ hr {
#platform-instructions-unix div.copy-container,
#platform-instructions-win32 div.copy-container,
#platform-instructions-win64 div.copy-container,
#platform-instructions-win-arm64 div.copy-container,
#platform-instructions-default div.copy-container,
#platform-instructions-unknown div.copy-container {
display: flex;
Expand All @@ -147,6 +149,7 @@ hr {
#platform-instructions-unix button.copy-button,
#platform-instructions-win32 button.copy-button,
#platform-instructions-win64 button.copy-button,
#platform-instructions-win-arm64 button.copy-button,
#platform-instructions-default button.copy-button,
#platform-instructions-unknown button.copy-button {
height: 58px;
Expand All @@ -160,6 +163,7 @@ hr {
#platform-instructions-unix div.copy-icon,
#platform-instructions-win32 div.copy-icon,
#platform-instructions-win64 div.copy-icon,
#platform-instructions-win-arm64 div.copy-icon,
#platform-instructions-default div.copy-icon,
#platform-instructions-unknown div.copy-icon {
position: relative;
Expand All @@ -173,6 +177,7 @@ hr {
#platform-instructions-unix div.copy-button-text,
#platform-instructions-win32 div.copy-button-text,
#platform-instructions-win64 div.copy-button-text,
#platform-instructions-win-arm64 div.copy-button-text,
#platform-instructions-default div.copy-button-text,
#platform-instructions-unknown div.copy-button-text {
transition: opacity 0.2s ease-in-out;
Expand All @@ -187,6 +192,7 @@ hr {

#platform-instructions-win32 a.windows-download,
#platform-instructions-win64 a.windows-download,
#platform-instructions-win-arm64 a.windows-download,
#platform-instructions-default a.windows-download,
#platform-instructions-unknown a.windows-download {
display: block;
Expand Down
35 changes: 21 additions & 14 deletions www/rustup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// IF YOU CHANGE THIS FILE IT MUST BE CHANGED ON BOTH rust-www and rustup.rs

var platforms = ["default", "unknown", "win32", "win64", "unix"];
var platforms = ["default", "unknown", "win32", "win64", "win-arm64", "unix"];
var platform_override = null;
var rustup_install_command = "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh";

function detect_platform() {
async function detect_platform() {
"use strict";

if (platform_override !== null) {
Expand All @@ -29,6 +29,10 @@ function detect_platform() {
if (navigator.platform == "Win64" ||
navigator.userAgent.indexOf("WOW64") != -1 ||
navigator.userAgent.indexOf("Win64") != -1) { os = "win64"; }
if (navigator.userAgentData &&
navigator.userAgentData.platform == "Windows" &&
await navigator.userAgentData.getHighEntropyValues(["architecture", "bitness"])
.then(ua => ua.architecture == "arm" && ua.bitness == "64")) { os = "win-arm64"; }
if (navigator.platform == "FreeBSD x86_64") {os = "unix";}
if (navigator.platform == "FreeBSD amd64") {os = "unix";}
if (navigator.platform == "NetBSD x86_64") {os = "unix";}
Expand Down Expand Up @@ -68,10 +72,10 @@ function vis(elem, value) {
}
}

function adjust_for_platform() {
async function adjust_for_platform() {
"use strict";

var platform = detect_platform();
var platform = await detect_platform();

platforms.forEach(function (platform_elem) {
var platform_div = document.getElementById("platform-instructions-" + platform_elem);
Expand All @@ -94,7 +98,7 @@ function adjust_platform_specific_instrs(platform) {
if (el_is_inline) {
el_visible_style = "inline";
}
if (platform == "win64" || platform == "win32") {
if (platform == "win64" || platform == "win32" || platform == "win-arm64") {
if (el_is_not_win) {
vis(el, "none");
} else {
Expand All @@ -110,13 +114,13 @@ function adjust_platform_specific_instrs(platform) {
}
}

function cycle_platform() {
async function cycle_platform() {
if (platform_override == null) {
platform_override = 0;
} else {
platform_override = (platform_override + 1) % platforms.length;
}
adjust_for_platform();
await adjust_for_platform();
}

function set_up_cycle_button() {
Expand All @@ -127,9 +131,9 @@ function set_up_cycle_button() {
var idx=0;
var unlocked=false;

document.onkeypress = function(event) {
document.onkeypress = async function(event) {
if (event.key == "n" && unlocked) {
cycle_platform();
await cycle_platform();
}

if (event.key == key[idx]) {
Expand All @@ -138,7 +142,7 @@ function set_up_cycle_button() {
if (idx == key.length) {
vis(cycle_button, "block");
unlocked = true;
cycle_platform();
await cycle_platform();
}
} else if (event.key == key[0]) {
idx = 1;
Expand All @@ -148,9 +152,9 @@ function set_up_cycle_button() {
};
}

function go_to_default_platform() {
async function go_to_default_platform() {
platform_override = 0;
adjust_for_platform();
await adjust_for_platform();
}

// NB: This has no effect on rust-lang.org/install.html
Expand Down Expand Up @@ -190,6 +194,9 @@ function handle_copy_button_click(e) {
case 'copy-button-win64':
process_copy_button_click('copy-status-message-win64');
break;
case 'copy-button-win-arm64':
process_copy_button_click('copy-status-message-win-arm64');
break;
case 'copy-button-unknown':
process_copy_button_click('copy-status-message-unknown');
break;
Expand All @@ -208,8 +215,8 @@ function set_up_copy_button_clicks() {
})
}

(function () {
adjust_for_platform();
(async function () {
await adjust_for_platform();
set_up_cycle_button();
set_up_default_platform_buttons();
set_up_copy_button_clicks();
Expand Down
Loading