Created attachment 249688 [details] Patch for libtommath - Use framework helpers - Fix plist - Disable ccache "detection" - Don't override framework CFLAGS, make upstreams suggested optimization optional See also: https://docs.freebsd.org/en/books/porters-handbook/book/#dads-cflags
The broken plist was due to a patch file I forgot to add. Fixed in edab8726992480217bcef72d40947150d6. Can you please rebase your patch? I'll think about your other suggestions.
How about we merge LTO and optimizations in one single option? +OPTIONS_DEFINE= OPTIMIZED_CFLAGS +OPTIMIZED_CFLAGS_CFLAGS= -O3 -funroll-loops -fomit-frame-pointer +OPTIMIZED_CFLAGS_CMAKE_BOOL= COMPILE_LTO
What's wrong with the automatic ccache detection?
I'd rather see that we don't come up with new options since both are already establied in the tree. https://cgit.freebsd.org/ports/tree/Mk/bsd.options.desc.mk#n397 https://cgit.freebsd.org/ports/tree/Mk/bsd.options.desc.mk#n320 The ccache logic blindly assumes that if ccache happens to be installed that it should use it. It's going away in https://github.com/libtom/libtommath/pull/577
Created attachment 249743 [details] Patch for libtommath v2 Rebase, make LTO option default (seems to perform as good as -O3 etc) and tests runs fine
Ok, I'll put OPTIMIZED_CFLAGS in the defaults too, though.
Have you tested these on mutiple platforms? Doing some small tests on amd64 and aarch64 (VMs) suggests that LTO yields about the same performance on its own with stock CFLAGS.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8509bb6725e6252f5a9bc193b57a83f4843b0e04 commit 8509bb6725e6252f5a9bc193b57a83f4843b0e04 Author: Pietro Cerutti <gahr@FreeBSD.org> AuthorDate: 2024-04-06 12:18:31 +0000 Commit: Pietro Cerutti <gahr@FreeBSD.org> CommitDate: 2024-04-06 12:21:06 +0000 math/libtommath: small improvements - remove built-in ccache detection, see https://github.com/libtom/libtommath/pull/577/ - put OPTIMIZED_CFLAGS and LTO in OPTIONS, on by default PR: 278155 Reported by: diizzy math/libtommath/Makefile | 7 +++++++ math/libtommath/files/patch-CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 22 insertions(+)
Now they're both in OPTIONS. Feel free to tweak your build as you see fit. Thanks!