2021-07-08 06:35:01 -06:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
[ "$WAYLAND_DISPLAY" ] || {
|
|
|
|
printf 'error: foot-pgo requires a running wayland session\n' >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2021-07-17 21:47:02 -06:00
|
|
|
case $("$CC" --version) in
|
|
|
|
*clang*)
|
|
|
|
# Clang requires this for PGO.
|
|
|
|
export CFLAGS="$CFLAGS -Wno-ignored-optimization-argument"
|
|
|
|
;;
|
2021-07-08 06:35:01 -06:00
|
|
|
|
2021-07-17 21:47:02 -06:00
|
|
|
*gcc*)
|
|
|
|
# PGO with < -O3 is slow > GCC 10.1.X.
|
|
|
|
export CFLAGS="$CFLAGS -O3"
|
|
|
|
;;
|
2021-07-08 06:35:01 -06:00
|
|
|
esac
|
|
|
|
|
|
|
|
mkdir -p bld/release
|
|
|
|
cd bld/release
|
|
|
|
|
|
|
|
meson \
|
|
|
|
--prefix=/usr \
|
|
|
|
--buildtype=release \
|
|
|
|
--force-fallback-for=fcft,tllist \
|
2021-07-27 07:51:51 -06:00
|
|
|
-Ddocs=disabled \
|
2021-07-27 07:59:03 -06:00
|
|
|
-Dime=false \
|
2021-07-08 06:35:01 -06:00
|
|
|
-Db_lto=true \
|
|
|
|
../..
|
|
|
|
|
|
|
|
# Generate PGO data.
|
|
|
|
{
|
|
|
|
meson configure \
|
|
|
|
-Db_pgo=generate \
|
|
|
|
|
|
|
|
ninja
|
|
|
|
ninja test
|
|
|
|
|
|
|
|
# Required (gives some profiling data).
|
|
|
|
./footclient --version
|
|
|
|
|
|
|
|
set -- \
|
|
|
|
"$OLDPWD/scripts/generate-alt-random-writes.py" \
|
|
|
|
--scroll \
|
|
|
|
--scroll-region \
|
|
|
|
--colors-regular \
|
|
|
|
--colors-bright \
|
|
|
|
--colors-256 \
|
|
|
|
--colors-rgb \
|
|
|
|
--attr-bold \
|
|
|
|
--attr-italic \
|
|
|
|
--attr-underline \
|
|
|
|
--sixel \
|
|
|
|
.pgotmp
|
|
|
|
|
|
|
|
./foot \
|
|
|
|
--config=/dev/null \
|
|
|
|
--term=xterm \
|
|
|
|
sh -c "$* && cat .pgotmp"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Clang requires this for PGO.
|
2021-07-15 06:21:40 -06:00
|
|
|
case $("$CC" --version) in *clang*)
|
2021-07-08 06:35:01 -06:00
|
|
|
llvm-profdata merge default_*profraw --output=default.profdata
|
|
|
|
esac
|
|
|
|
|
|
|
|
meson configure -Db_pgo=use
|
|
|
|
|
|
|
|
ninja
|
|
|
|
ninja install
|
|
|
|
|
|
|
|
rm -rf \
|
|
|
|
"$DESTDIR/usr/share/zsh" \
|
|
|
|
"$DESTDIR/usr/share/fish" \
|
|
|
|
"$DESTDIR/usr/share/bash-completion"
|