Created attachment 231985 [details] Patch. Samba's Python-based build system, waf, will with high probability rebuild the entire source during stage because it does not maintain the order of compiler arguments. This appears to defeat its own minimal-rebuild logic, and defeats ccache in most cases. Patch attached; reducing build time by ~50 %. If ccache is in use, it does not waste cache space on single-use objects and thereby improves the overall hit rate of a shared ccache. Two successive poudriere builds without the patch had port times of 13:18 and 13:22 minutes respectively. With the patch, the times were 6:05 and 5:47 minutes, all measured with "hot" ccache (i.e. the times are for the ccache lookups only, and the builds without the patch had cache hits for the different command lines as well). The upstream distribution's root Makefile already sets PYTHONHASHSEED to avoid this issue, but the port skips it by invoking waf directly.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=243bc134121f464a3a7b39a85debc78ddf2e8274 commit 243bc134121f464a3a7b39a85debc78ddf2e8274 Author: Stefan Eßer <se@FreeBSD.org> AuthorDate: 2022-03-11 15:00:50 +0000 Commit: Stefan Eßer <se@FreeBSD.org> CommitDate: 2022-03-11 15:00:50 +0000 net/samba41[23]: set PYTHONHASHSEED during build The build with CCACHE can be significantly sped up by passing PYTHONHASHSEED=1 in the environment to make the build reproducible with regard to the compiler commands issued. PR: 262092 Reported by: chris at chrullrich.net (Christian Ullrich) net/samba412/Makefile | 1 + net/samba413/Makefile | 1 + 2 files changed, 2 insertions(+)