Last active
September 15, 2024 07:38
-
-
Save siddhesh/8a900d4abc0218eed18ba01fbd3b2c25 to your computer and use it in GitHub Desktop.
Helper script to build a branch+target combination for gcc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
worktree_root=PATH_TO/gcc-worktrees | |
gcc_root=$worktree_root/gcc | |
if [ -z $1 ]; then | |
echo "Usage: $0 <git commit ref> [target]" | |
exit 1 | |
fi | |
ref=$1 | |
if [ -z $2 ]; then | |
target="x86_64" | |
else | |
target="$2" | |
fi | |
case "$target" in | |
i686) | |
config="--enable-sanitizers --enable-clocale=gnu --with-system-zlib --enable-shared --enable-cet --with-demangler-in-ld --enable-libmpx i686-linux --with-fpmath=sse --disable-bootstrap" | |
runtest=true | |
;; | |
ubsan) | |
config="--with-build-config=bootstrap-ubsan --enable-languages=c,c++,fortran,lto --disable-multilib --enable-shared" | |
runtest=false | |
;; | |
*) | |
config="--enable-bootstrap --enable-languages=c,c++,fortran,lto --enable-sanitizers" | |
runtest=true | |
;; | |
esac | |
pushd $gcc_root | |
worktree_path=$worktree_root/$ref-$target | |
git worktree unlock $worktree_path | |
git worktree prune | |
git branch -D $ref-$target | |
rm -rf $worktree_path | |
git worktree add -b $ref-$target $worktree_path $ref | |
pushd $worktree_path | |
mkdir build && cd build | |
../configure $config && \ | |
make -j$(nproc) > /dev/null && $runtest && \ | |
make -j$(nproc) check > $worktree_root/check-$ref-$target.out 2>&1 | |
popd # $worktree_path | |
popd # $gcc_root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment