Skip to content

Commit 26f08f5

Browse files
authored
Refactor scripts (#46)
1 parent 8b191d7 commit 26f08f5

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

.github/workflows/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ jobs:
6262
path: target
6363
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }}
6464

65+
- name: Build
66+
run: |
67+
./prepare_build.sh
68+
./build.sh
69+
./clean_all.sh
70+
6571
- name: Prepare dependencies
6672
run: |
6773
git config --global user.email "[email protected]"

Readme.md

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ You can also use my [fork of gcc](https://github.com/antoyo/gcc) which already i
2121
```bash
2222
$ git clone https://github.com/antoyo/rustc_codegen_gcc.git
2323
$ cd rustc_codegen_gcc
24+
$ ./prepare_build.sh # download and patch sysroot src
25+
$ ./build.sh --release
26+
```
27+
28+
To run the tests:
29+
30+
```bash
2431
$ ./prepare.sh # download and patch sysroot src and install hyperfine for benchmarking
2532
$ ./test.sh --release
2633
```

build.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
#set -x
4+
set -e
5+
6+
export GCC_PATH=$(cat gcc_path)
7+
8+
export LD_LIBRARY_PATH="$GCC_PATH"
9+
export LIBRARY_PATH="$GCC_PATH"
10+
11+
if [[ "$1" == "--release" ]]; then
12+
export CHANNEL='release'
13+
CARGO_INCREMENTAL=1 cargo rustc --release
14+
else
15+
echo $LD_LIBRARY_PATH
16+
export CHANNEL='debug'
17+
cargo rustc
18+
fi
19+
20+
source config.sh
21+
22+
rm -r target/out || true
23+
mkdir -p target/out/gccjit
24+
25+
echo "[BUILD] sysroot"
26+
time ./build_sysroot/build_sysroot.sh $CHANNEL

prepare.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash --verbose
22
set -e
33

4-
rustup component add rust-src rustc-dev llvm-tools-preview
5-
./build_sysroot/prepare_sysroot_src.sh
4+
source prepare_build.sh
5+
66
cargo install hyperfine || echo "Skipping hyperfine install"
77

88
git clone https://github.com/rust-lang/regex.git || echo "rust-lang/regex has already been cloned"

prepare_build.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash --verbose
2+
set -e
3+
4+
rustup component add rust-src rustc-dev llvm-tools-preview
5+
./build_sysroot/prepare_sysroot_src.sh

0 commit comments

Comments
 (0)