2021-07-08 06:35:01 -06:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2023-03-02 07:40:00 -07:00
|
|
|
export DESTDIR="$1"
|
|
|
|
|
2021-07-08 06:35:01 -06:00
|
|
|
[ "$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-08-15 07:48:51 -06:00
|
|
|
*GCC*)
|
2021-07-17 21:47:02 -06:00
|
|
|
# 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 \
|
2021-07-27 07:59:03 -06:00
|
|
|
-Dime=false \
|
2021-07-08 06:35:01 -06:00
|
|
|
../..
|
|
|
|
|
|
|
|
# Generate PGO data.
|
|
|
|
{
|
|
|
|
meson configure \
|
2023-04-03 18:39:17 -06:00
|
|
|
-Db_pgo=generate
|
2021-07-08 06:35:01 -06:00
|
|
|
|
|
|
|
ninja
|
|
|
|
ninja test
|
|
|
|
|
|
|
|
# Required (gives some profiling data).
|
2023-04-03 18:39:17 -06:00
|
|
|
./utils/xtgettcap
|
2021-07-08 06:35:01 -06:00
|
|
|
./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 \
|
2023-04-03 18:39:17 -06:00
|
|
|
--override tweak.grapheme-shaping=no \
|
2021-07-08 06:35:01 -06:00
|
|
|
--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 \
|
2021-07-27 08:01:17 -06:00
|
|
|
"$DESTDIR/usr/share/doc" \
|
2021-07-08 06:35:01 -06:00
|
|
|
"$DESTDIR/usr/share/zsh" \
|
|
|
|
"$DESTDIR/usr/share/fish" \
|
|
|
|
"$DESTDIR/usr/share/bash-completion"
|