@@ -104,8 +104,62 @@ Past releases can be found in [the archives].
104104
105105## Source code
106106
107+ If you want to build the Rust toolchain from source code, you can use the following
108+ links to download source code tarballs.
109+
107110{{#source_code_table}}
108111
112+ If you want to make sure that the published source tarball matches what is in the
113+ ` rust ` git repository, you can use the following script as a template:
114+
115+ <details >
116+ <summary >Script for reproducing source tarball contents</summary >
117+
118+ ``` bash
119+ #! /bin/bash
120+
121+ set -e
122+
123+ # You can use either a commit SHA or a stable release version (e.g. 1.XY.Z)
124+ TAG=a8cfc83801301c2b4f0fd030192e268eeb15d473
125+ # TAG=1.77.1
126+
127+ # Clone Rust toolchain repository from GitHub
128+ git clone https://github.com/rust-lang/rust
129+ cd rust
130+ git reset --hard ${TAG}
131+
132+ cat > config.toml << EOF
133+ [rust]
134+ # Use for a commit SHA
135+ channel = "nightly"
136+
137+ # Use for a stable release
138+ # channel = "stable"
139+
140+ [dist]
141+ compression-formats = ["xz"]
142+ compression-profile = "fast"
143+ EOF
144+
145+ # Build the source tarball from git into build/dist/
146+ ./x dist rustc-src
147+
148+ # Download source tarball for a commit SHA
149+ wget https://ci-artifacts.rust-lang.org/rustc-builds/${TAG} /rustc-nightly-src.tar.xz
150+
151+ # Download a source tarball for a stable release
152+ # wget https://static.rust-lang.org/dist/rustc-${TAG}-src.tar.xz
153+
154+ # Decompress the tarballs and compare their contents
155+ cd build/dist
156+ mkdir archive-local && tar -xf rustc-* -src.tar.xz --strip-components=1 -Carchive-local
157+ mkdir archive-ci && tar -xf ../../rustc-* -src.tar.xz --strip-components=1 -Carchive-ci
158+ diff --brief --recursive archive-local archive-ci
159+ ```
160+
161+ </details >
162+
109163[ installation page ] : https://www.rust-lang.org/tools/install
110164[ `rustup` ] : https://github.com/rust-lang/rustup.rs
111165[ other-rustup ] : https://github.com/rust-lang/rustup.rs#other-installation-methods
0 commit comments