aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2021-08-30 12:39:39 +0000
committerJan Beich <jbeich@FreeBSD.org>2021-08-30 17:31:16 +0000
commit64902acb18f1783a98c0a22c8de800c9d478f114 (patch)
treebe8bf43100fe8ca4a909a31d254ee800c3b3b47f
parent501e1ed88f97d99d1e367812ae99fb4e352eeb3c (diff)
downloadports-64902acb18f1783a98c0a22c8de800c9d478f114.tar.gz
ports-64902acb18f1783a98c0a22c8de800c9d478f114.zip
x11/foot: enable PGO by default
From 2% (headless build, default config) to 12% (local) faster. Inspired by: Arch Linux
-rw-r--r--x11/foot/Makefile43
1 files changed, 40 insertions, 3 deletions
diff --git a/x11/foot/Makefile b/x11/foot/Makefile
index 1dbbd33d5ce4..0b5ace9a434b 100644
--- a/x11/foot/Makefile
+++ b/x11/foot/Makefile
@@ -1,6 +1,6 @@
PORTNAME= foot
DISTVERSION= 1.9.0
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= x11
MASTER_SITES= https://codeberg.org/dnkl/${PORTNAME}/archive/${DISTVERSIONFULL}${EXTRACT_SUFX}?dummy=/
@@ -23,10 +23,12 @@ USES= compiler:c11 meson pkgconfig xorg
USE_XORG= pixman
WRKSRC= ${WRKDIR}/${PORTNAME}
-OPTIONS_DEFINE= DOCS LTO NOTIFY UTF8PROC XDG
-OPTIONS_DEFAULT=LTO NOTIFY UTF8PROC XDG
+OPTIONS_DEFINE= DOCS LTO NOTIFY PGO UTF8PROC XDG
+OPTIONS_DEFAULT=LTO NOTIFY PGO UTF8PROC XDG
OPTIONS_EXCLUDE+= ${CC:T:Mgcc*:C/.+/LTO/} # undefined reference to `xstrdup'
OPTIONS_EXCLUDE_powerpc64= ${"${/usr/bin/ld:L:tA}"==/usr/bin/ld.lld:?LTO:} # LLVM bug 47353
+OPTIONS_EXCLUDE_FreeBSD_11= ${WAYLAND_DISPLAY:UPGO} # ./pgo hangs
+OPTIONS_EXCLUDE_FreeBSD_12= ${WAYLAND_DISPLAY:UPGO} # ./pgo hangs
DOCS_BUILD_DEPENDS= scdoc:textproc/scdoc
DOCS_MESON_ENABLED= docs
@@ -39,6 +41,15 @@ LTO_LDFLAGS= -fuse-ld=lld
NOTIFY_RUN_DEPENDS= notify-send:devel/libnotify
+PGO_USES= python:build
+PGO_MESON_ON= -Db_pgo=generate
+PGO_CFLAGS= ${PGO_CFLAGS_${CHOSEN_COMPILER_TYPE}}
+PGO_CFLAGS_clang= -Wno-ignored-optimization-argument # meson -Db_pgo=use
+PGO_SCRIPT_ARGS= --colors-regular --colors-bright --colors-256 --colors-rgb \
+ --scroll --scroll-region \
+ --attr-bold --attr-italic --attr-underline \
+ --sixel
+
UTF8PROC_DESC= Grapheme clustering using libutf8proc
UTF8PROC_LIB_DEPENDS= libutf8proc.so:textproc/utf8proc
UTF8PROC_MESON_ENABLED= grapheme-clustering
@@ -56,4 +67,30 @@ PLIST_FILES+= share/site-terminfo/${PORTNAME:C,^.,&/&,} \
MESON_ARGS+= -Dterminfo=disabled -Ddefault-terminfo=xterm-256color
.endif
+.if !defined(DEFAULT_POST_BUILD)
+post-build-PGO-on:
+ (cd ${BUILD_WRKSRC} && ./${PORTNAME}client --version) # -Wbackend-plugin/-Wmissing-profile
+.if defined(WAYLAND_DISPLAY)
+# Likely a local build, so optimize for the current config
+ (cd ${BUILD_WRKSRC} && LC_ALL=en_US.UTF-8 ./${PORTNAME} ${PYTHON_CMD} \
+ ${WRKSRC}/scripts/generate-alt-random-writes.py \
+ ${PGO_SCRIPT_ARGS})
+.else
+ (cd ${BUILD_WRKSRC} && ./${PORTNAME} --version) # -Wbackend-plugin/-Wmissing-profile
+ (cd ${BUILD_WRKSRC} && ${PYTHON_CMD} \
+ ${WRKSRC}/scripts/generate-alt-random-writes.py \
+ --seed=${:!${AWK} '/TIMESTAMP/ { print \$3 }' ${DISTINFO_FILE}!} \
+ --rows=67 --cols=135 \
+ ${PGO_SCRIPT_ARGS} \
+ pgo-input && ./pgo pgo-input)
+.endif
+ @if [ ${CHOSEN_COMPILER_TYPE} = clang ]; then \
+ llvm-profdata merge -o ${BUILD_WRKSRC}/default.profdata \
+ ${BUILD_WRKSRC}/default*.profraw; \
+ fi
+ ${RM} ${BUILD_COOKIE}
+ ${CONFIGURE_CMD} configure -Db_pgo=use ${BUILD_WRKSRC}
+ ${MAKE} -C${.CURDIR} build DEFAULT_POST_BUILD=1
+.endif
+
.include <bsd.port.mk>