mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-18 22:05:25 -05:00
PKGBUILD: do PGO with either gcc or clang, but nothing else
Before this, we assumed gcc was being used. The build would fail if clang (or something else) was used. Now, we check whether we’re compiling with gcc or clang, and disable PGO if it’s neither of them. Furthermore, we’re now adding the necessary flags needed to do PGO with clang. Note that ‘llvm-profdata’, from the ‘llvm’ package is needed for PGO:ing with clang. PGO is disabled if it isn’t available. It would be nice to have ‘llvm’ as an optional make dependency, but PKGBUILDs doesn’t appear to support such a thing. Finally, the -Wno-missing-profile flag, and its friends, have been removed; instead we execute “footclient --version” (and “foot --version”, in partial PGO builds) to ensure all generated binaries have been executed before we do the final build (with -Db_pgo=use). This fixes build failures with clang >= 11.x.
This commit is contained in:
parent
ae6a656f49
commit
628382bc90
1 changed files with 55 additions and 22 deletions
77
PKGBUILD
77
PKGBUILD
|
|
@ -14,37 +14,70 @@ pkgver() {
|
|||
}
|
||||
|
||||
build() {
|
||||
local compiler=other
|
||||
local do_pgo=no
|
||||
|
||||
# makepkg uses -O2 by default, but we *really* want -O3
|
||||
# -Wno-missing-profile since we're not exercising everything when doing PGO builds
|
||||
export CFLAGS+=" -O3 -Wno-missing-profile"
|
||||
CFLAGS+=" -O3"
|
||||
|
||||
# Figure out which compiler we're using, and whether or not to do PGO
|
||||
case $(${CC-cc} --version) in
|
||||
*GCC*)
|
||||
compiler=gcc
|
||||
do_pgo=yes
|
||||
;;
|
||||
|
||||
*clang*)
|
||||
compiler=clang
|
||||
|
||||
# We need llvm to be able to manage the profiling data
|
||||
if command -v llvm-profdata > /dev/null; then
|
||||
do_pgo=yes
|
||||
|
||||
# Meson adds -fprofile-correction, which Clang doesn't
|
||||
# understand
|
||||
CFLAGS+=" -Wno-ignored-optimization-argument"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
meson --prefix=/usr --buildtype=release --wrap-mode=nofallback -Db_lto=true ..
|
||||
|
||||
find -name "*.gcda" -delete
|
||||
meson configure -Db_pgo=generate
|
||||
ninja
|
||||
if [[ ${do_pgo} == yes ]]; then
|
||||
find -name "*.gcda" -delete
|
||||
meson configure -Db_pgo=generate
|
||||
ninja
|
||||
|
||||
script_options="--scroll --scroll-region --colors-regular --colors-bright --colors-256 --colors-rgb --attr-bold --attr-italic --attr-underline --sixel"
|
||||
local script_options="--scroll --scroll-region --colors-regular --colors-bright --colors-256 --colors-rgb --attr-bold --attr-italic --attr-underline --sixel"
|
||||
|
||||
tmp_file=$(mktemp)
|
||||
tmp_file=$(mktemp)
|
||||
|
||||
if [[ -v WAYLAND_DISPLAY ]]; then
|
||||
./foot \
|
||||
--config /dev/null \
|
||||
--term=xterm \
|
||||
sh -c "../scripts/generate-alt-random-writes.py ${script_options} ${tmp_file} && cat ${tmp_file}"
|
||||
else
|
||||
../scripts/generate-alt-random-writes.py \
|
||||
--rows=67 \
|
||||
--cols=135 \
|
||||
${script_options} \
|
||||
${tmp_file}
|
||||
./pgo ${tmp_file} ${tmp_file} ${tmp_file}
|
||||
if [[ -v WAYLAND_DISPLAY ]]; then
|
||||
./footclient --version
|
||||
./foot \
|
||||
--config /dev/null \
|
||||
--term=xterm \
|
||||
sh -c "../scripts/generate-alt-random-writes.py ${script_options} ${tmp_file} && cat ${tmp_file}"
|
||||
else
|
||||
./footclient --version
|
||||
./foot --version
|
||||
../scripts/generate-alt-random-writes.py \
|
||||
--rows=67 \
|
||||
--cols=135 \
|
||||
${script_options} \
|
||||
${tmp_file}
|
||||
./pgo ${tmp_file} ${tmp_file} ${tmp_file}
|
||||
fi
|
||||
|
||||
rm "${tmp_file}"
|
||||
|
||||
if [[ ${compiler} == clang ]]; then
|
||||
llvm-profdata merge default_*profraw --output=default.profdata
|
||||
fi
|
||||
|
||||
meson configure -Db_pgo=use
|
||||
fi
|
||||
|
||||
rm "${tmp_file}"
|
||||
|
||||
meson configure -Db_pgo=use
|
||||
ninja
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue