Created attachment 236447 [details] patch bsd.ccache.mk can disable ccache in some situations. Ports should be able to know when ccache is enabled but there is no single variable for this. I propose that bsd.ccache.mk would always set the variable CCACHE_ENABLED with values yes/no. For example, cmake based ports would be able to pass it to cmake: > CMAKE_ARGS+=-DUSE_CCACHE:BOOL=${CCACHE_ENABLED:tu} Currently there is no easy way to do this.
Moin moin Why do you not simply set NO_CCACHE=yes in the affected port? mfg Tobias
(In reply to Tobias C. Berner from comment #1) Because they have special handling of ccache, and it is triggered by the presence of the ccache program, not by what the user has set in make.conf. I don't want to disable it altogether, I just want the project to play along with ccache settings like all other ports do.
This port would still use ccache, regardless of the settings. It is nice to have a variable that just tells the port if ccache should be used or not.
(In reply to Yuri Victorovich from comment #3) You still could make use of it, I think, even without this change in the meantime, with something on the lines of: CMAKE_ARGS+=-DUSE_CCACHE:BOOL=${NO_CCACHE:DNO:UYES} I'll get back to you about the proposed change :)
(In reply to Tobias C. Berner from comment #4) Tobias, This line > CMAKE_ARGS+=-DUSE_CCACHE:BOOL=${NO_CCACHE:DNO:UYES} doesn't evaluate to the same. When no ccache settings are present in make.conf it evaluates to YES instead of NO. Also it is a lot less error-prone to have a single variable for all such ports to use.
Created attachment 236481 [details] patch Update patch: move explanation to the correct section.
Port that would benefit: graphics/filament Here https://github.com/google/filament/blob/main/CMakeLists.txt#L68 it looks for the ccache program which causes deviation from the ports framework ccache setting. The CCACHE_ENABLED value can be passed to cmake to limit ccache use to situations when ccache is enabled through the ports framework. ccache is in general very useful since it improved productivity of work on C/C++ ports by caching previous compilation results.
Comment on attachment 236481 [details] patch ship it :)
(In reply to Tobias C. Berner from comment #8) Thank you! ----------------------------------- Committed.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=679b9e2f43675a36fa552404c770ab620a350fa1 commit 679b9e2f43675a36fa552404c770ab620a350fa1 Author: Yuri Victorovich <yuri@FreeBSD.org> AuthorDate: 2022-09-12 07:41:44 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2022-09-12 07:47:54 +0000 Mk/bsd.ccache.mk: Add CCACHE_ENABLED variable for ports' convenience Some projects do some special handling when the ccache program is present. This causes problems because ports framework has its own ccache settings and mere presence of ccache program doesn't mean that ccache is enabled. The new CCACHE_ENABLED variable can be used to tell projects if ccache is really enabled. PR: 266310 Approved by: tcberner@ (as portmgr) Mk/bsd.ccache.mk | 8 ++++++++ 1 file changed, 8 insertions(+)