repo/wayland/foot-pgo/build
nitori 04189304f8
foot-pgo: asv patch
Haven't confirmed that it builds since I don't have a Wayland session to
use in my chroot, but it should build.
2024-01-02 15:53:16 +00:00

82 lines
1.5 KiB
Bash
Executable File

#!/bin/sh -e
export DESTDIR="$1"
[ "$WAYLAND_DISPLAY" ] || {
printf 'error: foot-pgo requires a running wayland session\n' >&2
exit 1
}
case $("$CC" --version) in
*clang*)
# Clang requires this for PGO.
export CFLAGS="$CFLAGS -Wno-ignored-optimization-argument"
;;
*GCC*)
# PGO with < -O3 is slow > GCC 10.1.X.
export CFLAGS="$CFLAGS -O3"
;;
esac
# Apply ASV patch.
patch -p1 < asv.patch
mkdir -p bld/release
cd bld/release
meson setup \
-Dprefix=/usr \
-Dbuildtype=release \
-Dime=false \
../..
# Generate PGO data.
{
meson configure \
-Db_pgo=generate
ninja
ninja test
# Required (gives some profiling data).
./utils/xtgettcap
./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 \
--override tweak.grapheme-shaping=no \
--term=xterm \
sh -c "$* && cat .pgotmp"
}
# Clang requires this for PGO.
case $("$CC" --version) in *clang*)
llvm-profdata merge default_*profraw --output=default.profdata
esac
meson configure -Db_pgo=use
ninja
ninja install
rm -rf \
"$DESTDIR/usr/share/doc" \
"$DESTDIR/usr/share/zsh" \
"$DESTDIR/usr/share/fish" \
"$DESTDIR/usr/share/bash-completion"