customcc: Improve wrapper script efficiency and capabilities

Operating Systems / DragonFlyBSD - John Marino [marino.st] - 21 October 2014 10:41 UTC

The wrapper script had some deficies, such as:
- awk called every invocation
- cc and gcc treated the same
- c++ and g++ treated the same
- evals for variables not used
- every invocation of c++ or g++ called cc -dumpmachine
- g++ hardcoded to dports include scheme
- no support for "CC" or "gcov" (both defined by base compilers)

The update addresses these by:
- awk eliminated by pushing INCOPT definition to defaults/compilers.conf
- cc -dumpmachine eliminated during creation of defaults/compilers.conf It was only used for dports gcc, so with the assumption that the dports compiler matches the uname information (a decent assumption), this was predefined, yet overridable by /etc/compilers.conf
- cc is treated separately from gcc
- CC and c++ are treated the same but separately from g++
- by wrapper default, gcc and g++ refer to base gcc4.7, but the default compilers.conf sets them to the same as the specified dports gcc
- Support for clang, clang++, clang-cpp, CC, and gcov was added
- Support for base clang, clang++, and clang-cpp was added in anticipation of bringing clang into base.
- variables are only evaluated if used.
- supports the ability to have gcc, g++, clang, clang++ point to base compilers while cc, c++, CC point to custom compiler. However, the custom compiler can also point to any combination of cc, gcc, c++, and g++ and that's controllable by compilers.conf.

The /etc/defaults/compilers.conf file was augmented and support for clang35 from dports added. man 5 compilers.conf was edited accordingly with placeholders for _CLANG, _CLANGCXX and _CLANGCPP which aren't applicable until clang comes into base.

571f588 customcc: Improve wrapper script efficiency and capabilities
etc/defaults/compilers.conf | 73 +++++++++++++++++++
libexec/customcc/Makefile | 15 +++-
libexec/customcc/cc.sh | 152 ++++++++++++++++++++++++++++++---------
share/man/man5/compilers.conf.5 | 88 ++++++++++++++++-------
4 files changed, 265 insertions(+), 63 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share