diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e3defd583b..3d9b6898b6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,6 +62,12 @@ jobs: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain') }} + - name: Build + run: | + ./prepare_build.sh + ./build.sh + ./clean_all.sh + - name: Prepare dependencies run: | git config --global user.email "user@example.com" diff --git a/Readme.md b/Readme.md index 5306e8ac574..d6a7a717dca 100644 --- a/Readme.md +++ b/Readme.md @@ -21,6 +21,13 @@ You can also use my [fork of gcc](https://github.com/antoyo/gcc) which already i ```bash $ git clone https://github.com/antoyo/rustc_codegen_gcc.git $ cd rustc_codegen_gcc +$ ./prepare_build.sh # download and patch sysroot src +$ ./build.sh --release +``` + +To run the tests: + +```bash $ ./prepare.sh # download and patch sysroot src and install hyperfine for benchmarking $ ./test.sh --release ``` diff --git a/build.sh b/build.sh new file mode 100755 index 00000000000..9f1228687e2 --- /dev/null +++ b/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +#set -x +set -e + +export GCC_PATH=$(cat gcc_path) + +export LD_LIBRARY_PATH="$GCC_PATH" +export LIBRARY_PATH="$GCC_PATH" + +if [[ "$1" == "--release" ]]; then + export CHANNEL='release' + CARGO_INCREMENTAL=1 cargo rustc --release +else + echo $LD_LIBRARY_PATH + export CHANNEL='debug' + cargo rustc +fi + +source config.sh + +rm -r target/out || true +mkdir -p target/out/gccjit + +echo "[BUILD] sysroot" +time ./build_sysroot/build_sysroot.sh $CHANNEL diff --git a/prepare.sh b/prepare.sh index 8d57e77018e..503fa29b362 100755 --- a/prepare.sh +++ b/prepare.sh @@ -1,8 +1,8 @@ #!/bin/bash --verbose set -e -rustup component add rust-src rustc-dev llvm-tools-preview -./build_sysroot/prepare_sysroot_src.sh +source prepare_build.sh + cargo install hyperfine || echo "Skipping hyperfine install" git clone https://github.com/rust-lang/regex.git || echo "rust-lang/regex has already been cloned" diff --git a/prepare_build.sh b/prepare_build.sh new file mode 100755 index 00000000000..ccf53509830 --- /dev/null +++ b/prepare_build.sh @@ -0,0 +1,5 @@ +#!/bin/bash --verbose +set -e + +rustup component add rust-src rustc-dev llvm-tools-preview +./build_sysroot/prepare_sysroot_src.sh