Skip to content

Commit bdcbf47

Browse files
committed
Improve readme and build system help message
1 parent 3a27253 commit bdcbf47

File tree

3 files changed

+40
-31
lines changed

3 files changed

+40
-31
lines changed

Readme.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ If not please open an issue.
88
## Building and testing
99

1010
```bash
11-
$ git clone https://github.com/bjorn3/rustc_codegen_cranelift.git
11+
$ git clone https://github.com/bjorn3/rustc_codegen_cranelift
1212
$ cd rustc_codegen_cranelift
13-
$ ./y.rs prepare # download and patch sysroot src and install hyperfine for benchmarking
13+
$ ./y.rs prepare
1414
$ ./y.rs build
1515
```
1616

@@ -20,13 +20,12 @@ To run the test suite replace the last command with:
2020
$ ./test.sh
2121
```
2222

23-
This will implicitly build cg_clif too. Both `y.rs build` and `test.sh` accept a `--debug` argument to
24-
build in debug mode.
23+
For more docs on how to build and test see [build_system/usage.txt](build_system/usage.txt) or the help message of `./y.rs`.
2524

26-
Alternatively you can download a pre built version from [GHA]. It is listed in the artifacts section
25+
Alternatively you can download a pre built version from [Github Actions]. It is listed in the artifacts section
2726
of workflow runs. Unfortunately due to GHA restrictions you need to be logged in to access it.
2827

29-
[GHA]: https://github.com/bjorn3/rustc_codegen_cranelift/actions?query=branch%3Amaster+event%3Apush+is%3Asuccess
28+
[Github Actions]: https://github.com/bjorn3/rustc_codegen_cranelift/actions?query=branch%3Amaster+event%3Apush+is%3Asuccess
3029

3130
## Usage
3231

build_system/mod.rs

+1-25
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,8 @@ mod rustc_info;
1515
mod tests;
1616
mod utils;
1717

18-
const USAGE: &str = r#"The build system of cg_clif.
19-
20-
USAGE:
21-
./y.rs prepare [--out-dir DIR]
22-
./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features]
23-
./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features]
24-
./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features]
25-
26-
OPTIONS:
27-
--sysroot none|clif|llvm
28-
Which sysroot libraries to use:
29-
`none` will not include any standard library in the sysroot.
30-
`clif` will build the standard library using Cranelift.
31-
`llvm` will use the pre-compiled standard library of rustc which is compiled with LLVM.
32-
33-
--out-dir DIR
34-
Specify the directory in which the download, build and dist directories are stored.
35-
By default this is the working directory.
36-
37-
--no-unstable-features
38-
fSome features are not yet ready for production usage. This option will disable these
39-
features. This includes the JIT mode and inline assembly support.
40-
"#;
41-
4218
fn usage() {
43-
eprintln!("{USAGE}");
19+
eprintln!("{}", include_str!("usage.txt"));
4420
}
4521

4622
macro_rules! arg_error {

build_system/usage.txt

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
The build system of cg_clif.
2+
3+
USAGE:
4+
./y.rs prepare [--out-dir DIR]
5+
./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features]
6+
./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features]
7+
./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features]
8+
9+
OPTIONS:
10+
--debug
11+
Build cg_clif and the standard library in debug mode rather than release mode.
12+
Warning: An unoptimized cg_clif is very slow.
13+
14+
--sysroot none|clif|llvm
15+
Which sysroot libraries to use:
16+
`none` will not include any standard library in the sysroot.
17+
`clif` will build the standard library using Cranelift.
18+
`llvm` will use the pre-compiled standard library of rustc which is compiled with LLVM.
19+
20+
--out-dir DIR
21+
Specify the directory in which the download, build and dist directories are stored.
22+
By default this is the working directory.
23+
24+
--no-unstable-features
25+
Some features are not yet ready for production usage. This option will disable these
26+
features. This includes the JIT mode and inline assembly support.
27+
28+
REQUIREMENTS:
29+
* Rustup: The build system has a hard coded dependency on rustup to install the right nightly
30+
version and make sure it is used where necessary.
31+
* Git: `./y.rs prepare` uses git for applying patches and on Windows for downloading test repos.
32+
* Curl and tar (non-Windows only): Used by `./y.rs prepare` to download a single commit for
33+
repos. Git will be used to clone the whole repo when using Windows.
34+
* [Hyperfine](https://github.com/sharkdp/hyperfine/): Used for benchmarking with `./y.rs bench`.

0 commit comments

Comments
 (0)