summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Eklöf2021-03-28 14:37:22 +0200
committerDaniel Eklöf2021-03-28 14:37:22 +0200
commita569dbfa2f7bd9c12845ecccbcd034cc3c05803a (patch)
treed925b69d998598ccbc17a3c4ea64ce8fd6fa2ed3
parent037c6c97c339400eef398ab49be9b2d554574efd (diff)
downloadaur-a569dbfa2f7bd9c12845ecccbcd034cc3c05803a.tar.gz
Add support for doing PGO builds with Clang
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD85
2 files changed, 60 insertions, 27 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 1bd384b31ac..2c51c03a38a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = foot
pkgver = 1.7.1
- pkgrel = 1
+ pkgrel = 2
url = https://codeberg.org/dnkl/foot
arch = x86_64
arch = aarch64
diff --git a/PKGBUILD b/PKGBUILD
index a6fcb8b52c2..0bad336386a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,12 +1,12 @@
# Maintainer: Daniel Eklöf <daniel at ekloef dot se>
pkgname=('foot' 'foot-terminfo')
pkgver=1.7.1 # Don’t forget to update CHANGELOG.md
-pkgrel=1
+pkgrel=2
arch=('x86_64' 'aarch64')
url=https://codeberg.org/dnkl/foot
license=(mit)
depends=('libxkbcommon' 'wayland' 'pixman' 'fontconfig' 'fcft')
-makedepends=('meson' 'ninja' 'scdoc' 'python' 'ncurses' 'wayland-protocols' 'tllist')
+makedepends=('meson' 'ninja' 'scdoc' 'python' 'ncurses' 'wayland-protocols' 'tllist') # ‘llvm’, for PGO with clang
checkdepends=('check')
source=(${pkgname}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz)
sha256sums=('44a97d36dae6c9989aa68d2d69731679aa1f3e0c4ecc721cf79a80f5bdfdbc5f')
@@ -14,37 +14,70 @@ sha256sums=('44a97d36dae6c9989aa68d2d69731679aa1f3e0c4ecc721cf79a80f5bdfdbc5f')
build() {
cd foot
+ 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 -Db_lto=true . build
- find -name "*.gcda" -delete
- meson configure -Db_pgo=generate build
- ninja -C build
+ if [[ ${do_pgo} == yes ]]; then
+ find -name "*.gcda" -delete
+ meson configure -Db_pgo=generate build
+ ninja -C build
- local script_options="--scroll --scroll-region --colors-regular --colors-bright --colors-256 --colors-rgb --attr-bold --attr-italic --attr-underline"
-
- local tmp_file=$(mktemp)
-
- if [[ -v WAYLAND_DISPLAY ]]; then
- build/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}
- build/pgo ${tmp_file} ${tmp_file} ${tmp_file}
- fi
+ local script_options="--scroll --scroll-region --colors-regular --colors-bright --colors-256 --colors-rgb --attr-bold --attr-italic --attr-underline --sixel"
+
+ local tmp_file=$(mktemp)
+
+ if [[ -v WAYLAND_DISPLAY ]]; then
+ build/footclient --version
+ build/foot \
+ --config /dev/null \
+ --term=xterm \
+ sh -c "./scripts/generate-alt-random-writes.py ${script_options} ${tmp_file} && cat ${tmp_file}"
+ else
+ build/footclient --version
+ build/foot --version
+ ./scripts/generate-alt-random-writes.py \
+ --rows=67 \
+ --cols=135 \
+ ${script_options} \
+ ${tmp_file}
+ build/pgo ${tmp_file} ${tmp_file} ${tmp_file}
+ fi
- rm "${tmp_file}"
+ rm "${tmp_file}"
+
+ if [[ ${compiler} == clang ]]; then
+ llvm-profdata merge default_*profraw --output=build/default.profdata
+ fi
+
+ meson configure -Db_pgo=use build
+ fi
- meson configure -Db_pgo=use build
ninja -C build
}