Skip to content

Commit 9716685

Browse files
Alovchin91rami3l
authored andcommitted
Update rustup.rs website to offer Rustup on Windows on Arm
1 parent 84495dc commit 9716685

File tree

3 files changed

+70
-14
lines changed

3 files changed

+70
-14
lines changed

www/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,29 @@
8787
<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>
8888
</div>
8989

90+
<div id="platform-instructions-win-arm64" class="instructions display-none">
91+
<p>
92+
To install Rust, download and run
93+
<a class="windows-download" href="https://win.rustup.rs/aarch64">rustup&#x2011;init.exe</a>
94+
then follow the onscreen instructions.
95+
</p>
96+
<p>You may also need the <a href="https://rust-lang.github.io/rustup/installation/windows-msvc.html">Visual Studio prerequisites</a>.</p>
97+
<hr/>
98+
<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>
99+
<div class="copy-container">
100+
<pre class="rustup-command">curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh</pre>
101+
<button id="copy-button-win-arm64" class="copy-button" title="Copy curl command to clipboard to download Rustup" type="button">
102+
<div class="copy-icon">
103+
<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">
104+
<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>
105+
</svg>
106+
</div>
107+
<div id="copy-status-message-win-arm64" class="copy-button-text">Copied!</div>
108+
</button>
109+
</div>
110+
<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>
111+
</div>
112+
90113
<div id="platform-instructions-unknown" class="instructions display-none">
91114
<!-- unrecognized platform: ask for help -->
92115
<p>I don't recognize your platform.</p>
@@ -132,6 +155,16 @@
132155

133156
<hr/>
134157

158+
<div>
159+
<p>
160+
If you are running Windows on Arm,<br/>download and run
161+
<a class="windows-download" href="https://win.rustup.rs/aarch64">rustup&#x2011;init.exe</a>
162+
then follow the onscreen instructions.
163+
</p>
164+
</div>
165+
166+
<hr/>
167+
135168
<div>
136169
<p>
137170
If you are running Windows 32-bit,<br/>download and run
@@ -171,6 +204,16 @@
171204

172205
<hr/>
173206

207+
<div>
208+
<p>
209+
If you are running Windows on Arm,<br/>download and run
210+
<a class="windows-download" href="https://win.rustup.rs/aarch64">rustup&#x2011;init.exe</a>
211+
then follow the onscreen instructions.
212+
</p>
213+
</div>
214+
215+
<hr/>
216+
174217
<div>
175218
<p>
176219
If you are running Windows 32-bit,<br/>download and run

www/rustup.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ hr {
108108
#platform-instructions-unix > p,
109109
#platform-instructions-win32 > p,
110110
#platform-instructions-win64 > p,
111+
#platform-instructions-win-arm64 > p,
111112
#platform-instructions-default > p,
112113
#platform-instructions-unknown > p {
113114
width: 40rem;
@@ -138,6 +139,7 @@ hr {
138139
#platform-instructions-unix div.copy-container,
139140
#platform-instructions-win32 div.copy-container,
140141
#platform-instructions-win64 div.copy-container,
142+
#platform-instructions-win-arm64 div.copy-container,
141143
#platform-instructions-default div.copy-container,
142144
#platform-instructions-unknown div.copy-container {
143145
display: flex;
@@ -147,6 +149,7 @@ hr {
147149
#platform-instructions-unix button.copy-button,
148150
#platform-instructions-win32 button.copy-button,
149151
#platform-instructions-win64 button.copy-button,
152+
#platform-instructions-win-arm64 button.copy-button,
150153
#platform-instructions-default button.copy-button,
151154
#platform-instructions-unknown button.copy-button {
152155
height: 58px;
@@ -160,6 +163,7 @@ hr {
160163
#platform-instructions-unix div.copy-icon,
161164
#platform-instructions-win32 div.copy-icon,
162165
#platform-instructions-win64 div.copy-icon,
166+
#platform-instructions-win-arm64 div.copy-icon,
163167
#platform-instructions-default div.copy-icon,
164168
#platform-instructions-unknown div.copy-icon {
165169
position: relative;
@@ -173,6 +177,7 @@ hr {
173177
#platform-instructions-unix div.copy-button-text,
174178
#platform-instructions-win32 div.copy-button-text,
175179
#platform-instructions-win64 div.copy-button-text,
180+
#platform-instructions-win-arm64 div.copy-button-text,
176181
#platform-instructions-default div.copy-button-text,
177182
#platform-instructions-unknown div.copy-button-text {
178183
transition: opacity 0.2s ease-in-out;
@@ -187,6 +192,7 @@ hr {
187192

188193
#platform-instructions-win32 a.windows-download,
189194
#platform-instructions-win64 a.windows-download,
195+
#platform-instructions-win-arm64 a.windows-download,
190196
#platform-instructions-default a.windows-download,
191197
#platform-instructions-unknown a.windows-download {
192198
display: block;

www/rustup.js

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// IF YOU CHANGE THIS FILE IT MUST BE CHANGED ON BOTH rust-www and rustup.rs
22

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

7-
function detect_platform() {
7+
async function detect_platform() {
88
"use strict";
99

1010
if (platform_override !== null) {
@@ -29,6 +29,10 @@ function detect_platform() {
2929
if (navigator.platform == "Win64" ||
3030
navigator.userAgent.indexOf("WOW64") != -1 ||
3131
navigator.userAgent.indexOf("Win64") != -1) { os = "win64"; }
32+
if (navigator.userAgentData &&
33+
navigator.userAgentData.platform == "Windows" &&
34+
await navigator.userAgentData.getHighEntropyValues(["architecture", "bitness"])
35+
.then(ua => ua.architecture == "arm" && ua.bitness == "64")) { os = "win-arm64"; }
3236
if (navigator.platform == "FreeBSD x86_64") {os = "unix";}
3337
if (navigator.platform == "FreeBSD amd64") {os = "unix";}
3438
if (navigator.platform == "NetBSD x86_64") {os = "unix";}
@@ -68,10 +72,10 @@ function vis(elem, value) {
6872
}
6973
}
7074

71-
function adjust_for_platform() {
75+
async function adjust_for_platform() {
7276
"use strict";
7377

74-
var platform = detect_platform();
78+
var platform = await detect_platform();
7579

7680
platforms.forEach(function (platform_elem) {
7781
var platform_div = document.getElementById("platform-instructions-" + platform_elem);
@@ -94,7 +98,7 @@ function adjust_platform_specific_instrs(platform) {
9498
if (el_is_inline) {
9599
el_visible_style = "inline";
96100
}
97-
if (platform == "win64" || platform == "win32") {
101+
if (platform == "win64" || platform == "win32" || platform == "win-arm64") {
98102
if (el_is_not_win) {
99103
vis(el, "none");
100104
} else {
@@ -110,13 +114,13 @@ function adjust_platform_specific_instrs(platform) {
110114
}
111115
}
112116

113-
function cycle_platform() {
117+
async function cycle_platform() {
114118
if (platform_override == null) {
115119
platform_override = 0;
116120
} else {
117121
platform_override = (platform_override + 1) % platforms.length;
118122
}
119-
adjust_for_platform();
123+
await adjust_for_platform();
120124
}
121125

122126
function set_up_cycle_button() {
@@ -127,9 +131,9 @@ function set_up_cycle_button() {
127131
var idx=0;
128132
var unlocked=false;
129133

130-
document.onkeypress = function(event) {
134+
document.onkeypress = async function(event) {
131135
if (event.key == "n" && unlocked) {
132-
cycle_platform();
136+
await cycle_platform();
133137
}
134138

135139
if (event.key == key[idx]) {
@@ -138,7 +142,7 @@ function set_up_cycle_button() {
138142
if (idx == key.length) {
139143
vis(cycle_button, "block");
140144
unlocked = true;
141-
cycle_platform();
145+
await cycle_platform();
142146
}
143147
} else if (event.key == key[0]) {
144148
idx = 1;
@@ -148,9 +152,9 @@ function set_up_cycle_button() {
148152
};
149153
}
150154

151-
function go_to_default_platform() {
155+
async function go_to_default_platform() {
152156
platform_override = 0;
153-
adjust_for_platform();
157+
await adjust_for_platform();
154158
}
155159

156160
// NB: This has no effect on rust-lang.org/install.html
@@ -190,6 +194,9 @@ function handle_copy_button_click(e) {
190194
case 'copy-button-win64':
191195
process_copy_button_click('copy-status-message-win64');
192196
break;
197+
case 'copy-button-win-arm64':
198+
process_copy_button_click('copy-status-message-win-arm64');
199+
break;
193200
case 'copy-button-unknown':
194201
process_copy_button_click('copy-status-message-unknown');
195202
break;
@@ -208,8 +215,8 @@ function set_up_copy_button_clicks() {
208215
})
209216
}
210217

211-
(function () {
212-
adjust_for_platform();
218+
(async function () {
219+
await adjust_for_platform();
213220
set_up_cycle_button();
214221
set_up_default_platform_buttons();
215222
set_up_copy_button_clicks();

0 commit comments

Comments
 (0)