customcc: Improve wrapper script efficiency and capabilities
authorJohn Marino <draco@marino.st>
Tue, 21 Oct 2014 13:11:34 +0000 (15:11 +0200)
committerJohn Marino <draco@marino.st>
Tue, 21 Oct 2014 15:41:58 +0000 (17:41 +0200)
commit571f588a5c6622ead0ed757b2884a76bb45bdb56
treef38fdcc5b140bf52004e52884b5a0c8593c6b739
parentfc4394d140be3e7dba4315d0af40b2efa433164e
customcc: Improve wrapper script efficiency and capabilities

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 <version>_CLANG, <version>_CLANGCXX and
<version>_CLANGCPP which aren't applicable until clang comes into base.
etc/defaults/compilers.conf
libexec/customcc/Makefile
libexec/customcc/cc.sh
share/man/man5/compilers.conf.5