Bug 244532

Summary: www/chromium - Makefile.local contrib for ensuring ccache is used during build
Product: Ports & Packages Reporter: Sean Champ <lab+bsd>
Component: Individual Port(s)Assignee: freebsd-chromium (Nobody) <chromium>
Status: New ---    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (chromium)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
www/chromium - Makefile.local contrib for ensuring ccache is used during build none

Description Sean Champ 2020-03-01 01:50:38 UTC
Created attachment 212063 [details]
www/chromium - Makefile.local contrib for ensuring ccache is used during build

When building www/chromium under poudriere, locally - after some local configuration for ensuring ccache is used during port builds  - then taking a look at the shell cmds being used during the build, I'd noticed what seemed to indicate that ccache was not being used throughout the build. This was contrary to expectation, under local build configuration.

The following is an excerpt of the process log for the www/chormium build under poudriere - indicating direct calls to cc and c++ such that may not appear to be using any ccache wrappers, under the initial build configuration
~~~~
[root@buildhost ~ ]# procs
    0     0     0     0 -      0 -16    0:08.08 swapin   [kernel]
    1     1     0     0 -      0  52    0:00.03 wait     - /sbin/init --
{sic}
 6646  6646  1000  1000 pts/2  0  20    0:00.00 wait     | |-- -bash (bash)
 6696  6696     0     0 pts/2  0  20    0:00.00 wait     | | `-- su
 6705  6705     0     0 pts/2  0  20    0:00.00 wait     | |   `-- /usr/local/bin/bash -l
95303 95303     0     0 pts/2  0  26    0:01.20 select   | |     `-- /usr/local/libexec/poudriere/sh -e /usr/local/share/poudriere/bulk.sh -j builder-12~1 -p local -C www/chromium
16866 95303     0     0 pts/2  0  20    0:00.00 piperd   | |       |-- /usr/local/libexec/poudriere/sh -e /usr/local/share/poudriere/bulk.sh -j builder-12~1 -p local -C www/chromium
16873 16873     0     0 pts/2  0  20    0:00.05 select   | |       |-- sh: poudriere[builder-12~1-local][01]: build_pkg (chromium-79.0.3945.130) (sh)
43090 16873     0     0 pts/2  0  20    0:00.00 wait     | |       | `-- sh: poudriere[builder-12~1-local][01]: build_pkg (chromium-79.0.3945.130) (sh)
43091 16873     0     0 pts/2  0  52    0:00.00 wait     | |       |   `-- /usr/bin/make -C /usr/ports/www/chromium build
43094 16873     0     0 pts/2  0  52    0:00.00 wait     | |       |     `-- /bin/sh -e -c (cd /wrkdirs/usr/ports/www/chromium/work/chromium-79.0.3945.130; {sic}
43095 16873     0     0 pts/2  0  52    0:04.46 select   | |       |       `-- ninja -j3 -C out/Release -v chrome
87028 87028     0     0 pts/2  0  26    0:00.01 wait     | |       |         |-- c++ -MMD -MF obj/chrome/common/extensions/api/generated_api_types/accessibility_private.o.d {sic}
87029 87028     0     0 pts/2  0  76    0:03.01 -        | |       |         | `-- /usr/bin/c++ -cc1 -triple x86_64-unknown-freebsd12.1 -emit-obj {sic}
87073 87073     0     0 pts/2  0  52    0:00.01 wait     | |       |         |-- c++ -MMD -MF obj/chrome/common/extensions/api/generated_api_types/activity_log_private.o.d {sic}
87074 87073     0     0 pts/2  0  76    0:02.82 -        | |       |         | `-- /usr/bin/c++ -cc1 -triple x86_64-unknown-freebsd12.1 -emit-obj {sic}
87146 87146     0     0 pts/2  0  52    0:00.01 wait     | |       |         `-- c++ -MMD -MF obj/chrome/common/extensions/api/generated_api_types/cast_streaming_receiver_session.o.d {sic}87147 87146     0     0 pts/2  0  74    0:01.40 -        | |       |           `-- /usr/bin/c++ -cc1 -triple x86_64-unknown-freebsd12.1 -emit-obj {sic}
96231 95303     0     0 pts/2  0  52    0:09.53 piperd   | |       `-- /usr/local/libexec/poudriere/sh -e /usr/local/share/poudriere/bulk.sh -j builder-12~1 -p local -C www/chromium
87238 95303     0     0 pts/2  0  52    0:00.00 wait     | |         `-- /usr/local/libexec/poudriere/sh -e /usr/local/share/poudriere/bulk.sh -j builder-12~1 -p local -C www/chromium
87240 95303     0     0 pts/2  0  72    0:00.00 -        | |           |-- /usr/local/libexec/poudriere/sh -e /usr/local/share/poudriere/bulk.sh -j builder-12~1 -p local -C www/chromium
87241 95303     0     0 pts/2  0  72    0:00.00 -        | |           `-- /usr/local/libexec/poudriere/sh -e /usr/local/share/poudriere/bulk.sh -j builder-12~1 -p local -C www/chromium
{sic}
~~~~


Considering that the local build configuration had provided a ccache libexec wraper for LLVM 9.0 clang and clang++, one may've expected that that would be used throughout the build.

Subsequently, after trying to modify GN_ARGS for using the locally declared CC, CXX, .... it seemed that the build was still using 'cc' and 'c++' cmds

So, I've put together a Makefile.local for the www/chromium port, such that appears to serve to ensure that ccache will be used throughout the build. After some initial build testing, I hope it might be helpful to share the outcome, here - if perhaps others may notice any similar situation of ccache not being used throughout, though it may have been expected to have been used throughout, during the chromium build.


In the methdology used in this Makefile.local, a set of trivial wrapper scripts are generated for each of cc and c++ such that should simply call the CC or CXX cmd provided to the build. This may represent something of a trivial analogy onto cwrapper scripts used in pkgsrc.

Additionally, this Makefile.local should serve to ensure that any libtool-like cmds configured in the build - e.g llvm-ar as AR - will be used in the build, if the build would have called those cmds via any generic name such as e.g 'ar'.


Candidly, I'd tried using simply a modification on BINARY_ALIAS for CC and CXX, in this Makefile.local. Due to the characteristics of ccache configuration under arbitrary PATH and/or CCACHE_PATH, that did not work out for calling the intended CC and CXX, e.g when not using the base system cc as the ccache-wrapped CC, or similarly, for c++

If any contents of this Makefile.local could be of any use for the main port Makefile or under /usr/ports/Mk/Uses/ I think that would be great. If so or if not, I would present this contribution with the disclaimers: No warranty. #YMMV.

As I'm not sure if this concern about ccache may be occurring elsewhere, I simply thought it might be useful to share this item of build configuration here, for www/chromium builds.

Concerns:

- This does not provide any complex cwrapper system for the build, such as may be available in pkgsrc

- My own local make.conf may have affected the build configuration by side effect, in some way such that this Makefile.local may not be necessary without such a make.conf. I believe that this Makefile.local should be generally portable for other build configurations, with or without using ccache. I've not tested it under any other build configuration, though.

- Due to the methodolgy used for making an early binding on BINARY_LINKDIR in this Makefile.local, it cannot be used without modification when building ports-mgmt/pkg


Attached: Makefile.local contrib for www/chromium, as denoted