diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2018-11-07 16:43:17 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2018-11-14 09:42:04 +0000 |
commit | 650a1633a7325e3978b83a9b5921270e4c2b2812 (patch) | |
tree | 8df1f0ff46b1a0c0d27877bde9562a95909b2e96 /tcwg_kernel-build.sh | |
parent | 4c207930847d0780c0abb96a135a904b4bf9f6c3 (diff) |
tcwg_kernel-build.sh: Add logic to build Binutils and GCC using ABE.
Add several jenkins-helpers along the way.
Change-Id: I6b654f6a5cfa5386d5f691452aacaac11ff89f5b
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-x | tcwg_kernel-build.sh | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh index ad0c4d24..99565168 100755 --- a/tcwg_kernel-build.sh +++ b/tcwg_kernel-build.sh @@ -188,16 +188,121 @@ EOF ) } +# Prepare ABE tree for [partial] GNU builds prepare_abe () { + ( + set -euf -o pipefail + + clone_or_update_repo abe tested https://git-us.linaro.org/toolchain/abe.git > /dev/null + + cd abe + + # Add ccache wrappers. + rm -rf $(pwd)/bin + mkdir $(pwd)/bin + + cat > $(pwd)/bin/gcc <<EOF +#!/bin/sh +exec ccache /usr/bin/gcc "\$@" +EOF + chmod +x $(pwd)/bin/gcc + + cat > $(pwd)/bin/g++ <<EOF +#!/bin/sh +exec ccache /usr/bin/g++ "\$@" +EOF + chmod +x $(pwd)/bin/g++ + + export PATH=$(pwd)/bin:$PATH + + # TODO: Fix install_sysroot logic in ABE. + # ABE tries to install sysroot even for partial builds, e.g., + # with "--build binutils". Workaround by patching ABE. + sed -i -e "s/do_install_sysroot/:/" lib/control.sh + + ./configure --with-git-reference-dir=/home/tcwg-buildslave/snapshots-ref + ) } +# Build ABE component +# $1: Component -- Binutils or stage1 GCC. build_abe_1 () { + ( + set -euf -o pipefail + + local component="$1" + + clone_repo $component + + # Don't use ABE's repo clone functions and setup abe/snapshots/ directory + # to have the right entries. + local git_dir git_path + git_dir="$(basename ${git_repo[$component]})" + git_path="abe/snapshots/$git_dir" + rm -rf $git_path $git_path~master + ln -s $(pwd)/$component $git_path + ln -s $(pwd)/$component $git_path~master + + cd abe + + local gnu_target + gnu_target=$(print_gnu_target $target) + + # Remove previous build directories and .stamp files. + # We rely on ccache for fast rebuilds. + set +f; rm -rf builds/x86_64-unknown-linux-gnu/$gnu_target/$git_dir~master*; set -f + + export PATH=$(pwd)/bin:$PATH + + ccache -z + # Run "./abe.sh --build $component". + ./abe.sh \ + --build $component \ + --target $gnu_target \ + --extraconfigdir config/master \ + --disable update \ + binutils=binutils-gdb.git~master \ + gcc=gcc.git~master \ + --stage 1 + ccache -s + ) } +# Build binutils or GCC using ABE +# $1: Component -- Binutils or stage1 GCC. build_abe () { + ( + set -euf -o pipefail + + local component="$1" + + # Attempt to build GCC only if binutils build (in previous step) was OK. + if [ x"$component" = x"gcc" -a ! -f $run_step_prev_artifacts/build-ok ]; then + return + fi + + build_abe_1 $component & + res=0; wait $! || res=$? + + # Update artifacts on success. + if [ $res = 0 ]; then + echo "Finished build_abe $component" >> $top_artifacts/results + case "$component" in + binutils) echo "-2" >> $top_artifacts/results ;; + gcc) echo "-1" >> $top_artifacts/results ;; + *) assert false ;; + esac + + touch $run_step_artifacts/build-ok + fi + + if $tidy; then + git_clean $component + fi + ) } build_llvm_1 () |