Build AUR packages with clang and ThinLTO by default

aurb now builds with clang + lld + ThinLTO and bind-mounts a ThinLTO cache and its clang.cfg into the chroot; --gcc keeps the old gcc build. update-kernel still uses gcc.
This commit is contained in:
Daniele Fucini
2026-10-18 21:58:23 +02:00
parent ffd6289a0f
commit 81e2ed075e
3 changed files with 39 additions and 6 deletions
+24 -6
View File
@@ -1,15 +1,33 @@
#!/bin/bash
# aurb / aurs: aur build / aur sync with ccache mounted in the chroot (use with -c)
# aurb / aurs: aur build / aur sync with ccache and the ThinLTO cache mounted in the chroot (use with -c).
# Builds with clang by default (see aurutils-makepkg.conf); --gcc builds with gcc instead.
case "$(basename "$0")" in
aurb) cmd=build ;;
aurs) cmd=sync ;;
*) echo "Invoke as aurb or aurs" >&2; exit 1 ;;
esac
CCACHE_HOST_DIR="$HOME/.cache/ccache"
mkdir -p "$CCACHE_HOST_DIR"
baseconf="$HOME/.config/aurutils-makepkg.conf"
args=()
clang=1
for arg in "$@"; do
if [[ $arg == --gcc ]]; then clang=0; else args+=("$arg"); fi
done
exec aur "$cmd" \
--makepkg-conf "$HOME/.config/aurutils-makepkg.conf" \
conf=$baseconf
if ((clang)); then
conf=$(mktemp "${XDG_RUNTIME_DIR:-/tmp}/aurb-clang.XXXXXX.conf") || exit 1
trap 'rm -f "$conf"' EXIT
{ echo 'AURB_CLANG=1'; cat "$baseconf"; } > "$conf"
fi
CCACHE_HOST_DIR="$HOME/.cache/ccache"
THINLTO_HOST_DIR="$HOME/.cache/thinlto"
mkdir -p "$CCACHE_HOST_DIR" "$THINLTO_HOST_DIR"
aur "$cmd" \
--makepkg-conf "$conf" \
--bind-rw "$CCACHE_HOST_DIR" \
"$@"
--bind-rw "$THINLTO_HOST_DIR" \
--bind "$HOME/.config/aurb" \
"${args[@]}"