Bug 224471 - [PATCH] bsd.gecko.mk: add conditional for ccache
Summary: [PATCH] bsd.gecko.mk: add conditional for ccache
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-gecko mailing list
URL: https://reviews.freebsd.org/D14154
Keywords: patch
: 232183 (view as bug list)
Depends on:
Reported: 2017-12-20 01:00 UTC by Charlie Li
Modified: 2020-04-04 14:41 UTC (History)
9 users (show)

See Also:

bsd.gecko.mk.patch (515 bytes, patch)
2017-12-20 01:00 UTC, Charlie Li
no flags Details | Diff
Add --with-cache=${CCACHE_BIN:Q} to MOZ_OPTIONS, when WITH_CCACHE_BUILD is defined (527 bytes, patch)
2020-04-04 13:59 UTC, Mikhail Teterin
no flags Details | Diff
Base the decision on whether to use ccache on ${CCACHE_BIN} being not-empty (506 bytes, patch)
2020-04-04 14:41 UTC, Mikhail Teterin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charlie Li 2017-12-20 01:00:00 UTC
Created attachment 188982 [details]

On systems with WITH_CCACHE_BUILD enabled, the Mozilla build system still ignores the presence of ccache, as the C and C++ compilers are executed with an explicit path to /usr/bin. This method of execution prevents any caching of C and C++ objects as intended by ccache.

This patch adds a conditional to allow use of ccache where available, through the --with-ccache flag present in the Mozilla build system's configure script.
Comment 1 Charlie Li 2018-10-11 20:33:51 UTC
Comment on attachment 188982 [details]

review D14154 updated with new patch. Prompted by competing proposal bug 232183.
Comment 2 Nuno Teixeira 2018-11-23 09:08:44 UTC
I've tested both patches on FreeBSD 11.2 RELEASE, poudriere 3.2.8, ports current:

- removing absolute pathnames does't work, ccache not called

- using --with-ccache works, cccache caches ok.


To have ccache working within poudriere, we just need patch:

MOZ_OPTIONS+=     --with-ccache

I not tested build outside poudriere.
Comment 3 Charlie Li 2018-11-23 15:29:50 UTC
(In reply to Nuno Teixeira from comment #2)
This syntax breaks dialog4ports. Thus, .if defined(WITH_CCACHE_BUILD).

Additionally, in poudriere with static ccache, where ccache lives in a different /ccache hierarchy that is not in $PATH, a build dependency on devel/ccache needs added for now. I'll update the phabricator review.
Comment 4 Nuno Teixeira 2018-11-24 01:53:09 UTC
${WITH_CCACHE_BUILD} breaks dialog4ports but activates MOZ_OPTIONS: --with-ccache

with defined{WITH_CCACHE_BUILD} unbreaks dialog4ports but --with-ccache is not included in build configure.

maybe better to change Makefile port instead of bsd.gecko.mk?
Comment 5 Charlie Li 2018-11-24 02:02:41 UTC
(In reply to Nuno Teixeira from comment #4)
Curly brackets in defined() is incorrect syntax. Please read/understand the patch again.

Everything living at the root of either comm-* (Thunderbird, SeaMonkey) or mozilla-* (Firefox) use the same complex build system, so inserting logic like this into individual port Makefiles is redundant.
Comment 6 Nuno Teixeira 2018-11-24 09:00:55 UTC
oops! My fault using wrong syntax.

I applied patch correctly and everything is working perfectly.

Very nice build results on a old Asus ROG G50V in poudriere using 2 cores for a single build of firefox:

02h40m 1st time build with ccache

00h40m build using ccache

Comment 7 Nuno Teixeira 2018-11-24 09:04:59 UTC

*02h25m* 1st time build with ccache

00h40m build using ccache
Comment 8 Walter Schwarzenfeld freebsd_triage 2019-08-16 14:49:10 UTC

*** This bug has been marked as a duplicate of bug 232183 ***
Comment 9 Walter Schwarzenfeld freebsd_triage 2019-08-16 15:40:51 UTC
Wrong PR.
Comment 10 Walter Schwarzenfeld freebsd_triage 2019-08-16 15:41:34 UTC
*** Bug 232183 has been marked as a duplicate of this bug. ***
Comment 11 Walter Schwarzenfeld freebsd_triage 2019-08-16 17:38:41 UTC

Comment 12 Baptiste Daroussin freebsd_committer 2019-09-05 13:58:32 UTC
This is not for portmgr, more to gecko@
Comment 13 Mikhail Teterin freebsd_committer 2020-04-04 13:59:03 UTC
Created attachment 213057 [details]
Add --with-cache=${CCACHE_BIN:Q} to MOZ_OPTIONS, when WITH_CCACHE_BUILD is defined

Instructions from:

Comment 14 Mikhail Teterin freebsd_committer 2020-04-04 14:41:28 UTC
Created attachment 213059 [details]
Base the decision on whether to use ccache on ${CCACHE_BIN} being not-empty

This variant leaves the logic on whether to enable ccache to bsd.ccache.mk, which sets CCACHE_BIN as appropriate.