Skip to content

Commit 0dd3d28

Browse files
committed
Rename cargo executable to cargo-clif
This allows executing it like cargo clif build if you add it to your PATH. It also fixes infinite recursion on Windows when invoking it as Windows includes the current directory in PATH by default. Fixes rust-lang#971
1 parent 0467c6a commit 0dd3d28

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

Readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
3737
In the directory with your project (where you can do the usual `cargo build`), run:
3838

3939
```bash
40-
$ $cg_clif_dir/build/cargo build
40+
$ $cg_clif_dir/build/cargo-clif build
4141
```
4242

4343
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.

build_system/build_sysroot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ pub(crate) fn build_sysroot(
4646
// Build and copy cargo wrapper
4747
let mut build_cargo_wrapper_cmd = Command::new("rustc");
4848
build_cargo_wrapper_cmd
49-
.arg("scripts/cargo.rs")
49+
.arg("scripts/cargo-clif.rs")
5050
.arg("-o")
51-
.arg(target_dir.join("cargo"))
51+
.arg(target_dir.join("cargo-clif"))
5252
.arg("-g");
5353
spawn_and_wait(build_cargo_wrapper_cmd);
5454

docs/usage.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
99
In the directory with your project (where you can do the usual `cargo build`), run:
1010

1111
```bash
12-
$ $cg_clif_dir/build/cargo build
12+
$ $cg_clif_dir/build/cargo-clif build
1313
```
1414

1515
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.
@@ -32,7 +32,7 @@ In jit mode cg_clif will immediately execute your code without creating an execu
3232
> The jit mode will probably need cargo integration to make this possible.
3333
3434
```bash
35-
$ $cg_clif_dir/build/cargo jit
35+
$ $cg_clif_dir/build/cargo-clif jit
3636
```
3737

3838
or
@@ -45,7 +45,7 @@ There is also an experimental lazy jit mode. In this mode functions are only com
4545
first called.
4646

4747
```bash
48-
$ $cg_clif_dir/build/cargo lazy-jit
48+
$ $cg_clif_dir/build/cargo-clif lazy-jit
4949
```
5050

5151
## Shell
File renamed without changes.

scripts/tests.sh

+18-18
Original file line numberDiff line numberDiff line change
@@ -80,73 +80,73 @@ function base_sysroot_tests() {
8080

8181
function extended_sysroot_tests() {
8282
pushd rand
83-
../build/cargo clean
83+
../build/cargo-clif clean
8484
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
8585
echo "[TEST] rust-random/rand"
86-
../build/cargo test --workspace
86+
../build/cargo-clif test --workspace
8787
else
8888
echo "[AOT] rust-random/rand"
89-
../build/cargo build --workspace --target $TARGET_TRIPLE --tests
89+
../build/cargo-clif build --workspace --target $TARGET_TRIPLE --tests
9090
fi
9191
popd
9292

9393
pushd simple-raytracer
9494
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
9595
echo "[BENCH COMPILE] ebobby/simple-raytracer"
96-
hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo clean" \
96+
hyperfine --runs "${RUN_RUNS:-10}" --warmup 1 --prepare "../build/cargo-clif clean" \
9797
"RUSTC=rustc RUSTFLAGS='' cargo build" \
98-
"../build/cargo build"
98+
"../build/cargo-clif build"
9999

100100
echo "[BENCH RUN] ebobby/simple-raytracer"
101101
cp ./target/debug/main ./raytracer_cg_clif
102102
hyperfine --runs "${RUN_RUNS:-10}" ./raytracer_cg_llvm ./raytracer_cg_clif
103103
else
104-
../build/cargo clean
104+
../build/cargo-clif clean
105105
echo "[BENCH COMPILE] ebobby/simple-raytracer (skipped)"
106106
echo "[COMPILE] ebobby/simple-raytracer"
107-
../build/cargo build --target $TARGET_TRIPLE
107+
../build/cargo-clif build --target $TARGET_TRIPLE
108108
echo "[BENCH RUN] ebobby/simple-raytracer (skipped)"
109109
fi
110110
popd
111111

112112
pushd build_sysroot/sysroot_src/library/core/tests
113113
echo "[TEST] libcore"
114-
../../../../../build/cargo clean
114+
../../../../../build/cargo-clif clean
115115
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
116-
../../../../../build/cargo test
116+
../../../../../build/cargo-clif test
117117
else
118-
../../../../../build/cargo build --target $TARGET_TRIPLE --tests
118+
../../../../../build/cargo-clif build --target $TARGET_TRIPLE --tests
119119
fi
120120
popd
121121

122122
pushd regex
123123
echo "[TEST] rust-lang/regex example shootout-regex-dna"
124-
../build/cargo clean
124+
../build/cargo-clif clean
125125
export RUSTFLAGS="$RUSTFLAGS --cap-lints warn" # newer aho_corasick versions throw a deprecation warning
126126
# Make sure `[codegen mono items] start` doesn't poison the diff
127-
../build/cargo build --example shootout-regex-dna --target $TARGET_TRIPLE
127+
../build/cargo-clif build --example shootout-regex-dna --target $TARGET_TRIPLE
128128
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
129129
cat examples/regexdna-input.txt \
130-
| ../build/cargo run --example shootout-regex-dna --target $TARGET_TRIPLE \
130+
| ../build/cargo-clif run --example shootout-regex-dna --target $TARGET_TRIPLE \
131131
| grep -v "Spawned thread" > res.txt
132132
diff -u res.txt examples/regexdna-output.txt
133133
fi
134134

135135
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
136136
echo "[TEST] rust-lang/regex tests"
137-
../build/cargo test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
137+
../build/cargo-clif test --tests -- --exclude-should-panic --test-threads 1 -Zunstable-options -q
138138
else
139139
echo "[AOT] rust-lang/regex tests"
140-
../build/cargo build --tests --target $TARGET_TRIPLE
140+
../build/cargo-clif build --tests --target $TARGET_TRIPLE
141141
fi
142142
popd
143143

144144
pushd portable-simd
145145
echo "[TEST] rust-lang/portable-simd"
146-
../build/cargo clean
147-
../build/cargo build --all-targets --target $TARGET_TRIPLE
146+
../build/cargo-clif clean
147+
../build/cargo-clif build --all-targets --target $TARGET_TRIPLE
148148
if [[ "$HOST_TRIPLE" = "$TARGET_TRIPLE" ]]; then
149-
../build/cargo test -q
149+
../build/cargo-clif test -q
150150
fi
151151
popd
152152
}

0 commit comments

Comments
 (0)