From: Sascha Wildner Date: Tue, 14 Oct 2014 18:57:13 +0000 (+0200) Subject: Adjust the cc wrapper script and compilers.conf to dports. X-Git-Tag: v4.1.0~52 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/0bd9ff774520e584645eeb3c9bfb5dda584168e6 Adjust the cc wrapper script and compilers.conf to dports. Provide defaults for various GCCs for now. --- diff --git a/etc/defaults/compilers.conf b/etc/defaults/compilers.conf index 46549e6740..5cc88e3662 100644 --- a/etc/defaults/compilers.conf +++ b/etc/defaults/compilers.conf @@ -1,25 +1,48 @@ -# clang from SVN trunk # -clangsvn_CC=/usr/local/bin/clang -clangsvn_CXX=/usr/local/bin/clang++ -clangsvn_CFLAGS="-fno-color-diagnostics -Qunused-arguments -Wno-unknown-warning-option -std=gnu89" -clangsvn_CXXFLAGS="-fno-color-diagnostics -Qunused-arguments -Wno-unknown-warning-option -std=gnu++98" +# Copyright (c) 2014 The DragonFly Project. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name of The DragonFly Project nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific, prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# -# clang from pkgsrc +# lang/gcc5 (dports) # -clang_CC=/usr/pkg/bin/clang -clang_CXX=/usr/pkg/bin/clang++ -clang_CFLAGS="-fno-color-diagnostics -Qunused-arguments -Wno-unknown-warning-option -std=gnu89" -clang_CXXFLAGS="-fno-color-diagnostics -Qunused-arguments -Wno-unknown-warning-option -std=gnu++98" +gcc5_CC=/usr/local/bin/gcc5 +gcc5_CXX=/usr/local/bin/g++5 +gcc5_CPP=/usr/local/bin/cpp5 -# gnat-aux (i.e. gcc 4.6) from pkgsrc +# lang/gcc49 (dports) # -gcc46_CC=/usr/pkg/bin/gnatgcc -gcc46_CPP=/usr/pkg/bin/gnatcpp -gcc46_CXX=/usr/pkg/bin/gnatc++ +gcc49_CC=/usr/local/bin/gcc49 +gcc49_CXX=/usr/local/bin/g++49 +gcc49_CPP=/usr/local/bin/cpp49 -# pcc from pkgsrc +# lang/gcc48 (dports) # -pcc_CC=/usr/pkg/bin/pcc -pcc_CPP="/usr/pkg/bin/pcc -E" -pcc_CXX=/usr/libexec/gcc44/c++ +gcc48_CC=/usr/local/bin/gcc48 +gcc48_CXX=/usr/local/bin/g++48 +gcc48_CPP=/usr/local/bin/cpp48 diff --git a/libexec/customcc/cc.sh b/libexec/customcc/cc.sh index 428a042642..4f7a3ba628 100644 --- a/libexec/customcc/cc.sh +++ b/libexec/customcc/cc.sh @@ -31,26 +31,13 @@ # SUCH DAMAGE. # -CDIR=$(dirname $0) CNAME=$(basename $0) +CCVER3=`echo ${CCVER} | awk '{print substr($0, 1, 3);}'` -if [ "${CCVER}" = "clang" -o "${CCVER}" = "clangsvn" ]; then - if [ "${CNAME}" = "cpp" ]; then - exec ${CDIR}/../gcc44/cpp "$@" - else - INCOPT="-nobuiltininc -nostdinc \ - -isysroot @@INCPREFIX@@ \ - -isystem /usr/include \ - -isystem /usr/include/c++/4.4" - fi -elif [ "${CCVER}" = "gcc46" ]; then - GCC46VER=`gnatc++ -dumpversion` - GCC46MAC=`gnatc++ -dumpmachine` +if [ "${CCVER3}" = "gcc" ]; then INCOPT="-nostdinc \ -iprefix @@INCPREFIX@@ \ - -iwithprefixbefore /usr/include \ - -isystem /usr/pkg/include/c++/${GCC46VER} \ - -isystem /usr/pkg/include/c++/${GCC46VER}/${GCC46MAC}" + -iwithprefixbefore /usr/include" fi . /etc/defaults/compilers.conf @@ -64,9 +51,25 @@ CUSTOM_CPP=`eval echo \$\{${CCVER}_CPP\}` CUSTOM_CPPFLAGS=`eval echo \$\{${CCVER}_CPPFLAGS\}` if [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then + if [ -z ${CUSTOM_CC} ]; then + echo "${CCVER}_CC undefined, see compilers.conf(5)" + exit 1 + fi exec ${CUSTOM_CC} ${INCOPT} ${CUSTOM_CFLAGS} "$@" elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then - exec ${CUSTOM_CXX} ${INCOPT} ${CUSTOM_CXXFLAGS} "$@" + if [ -z ${CUSTOM_CXX} ]; then + echo "${CCVER}_CXX undefined, see compilers.conf(5)" + exit 1 + fi + INCOPT="${INCOPT} -isystem /usr/local/lib/${CCVER}/include/c++" + CXXMACHINE=`${CUSTOM_CXX} -dumpmachine` + MDINCOPT="-isystem \ + /usr/local/lib/${CCVER}/include/c++/${CXXMACHINE}" + exec ${CUSTOM_CXX} ${INCOPT} ${MDINCOPT} ${CUSTOM_CXXFLAGS} "$@" elif [ "${CNAME}" = "cpp" ]; then + if [ -z ${CUSTOM_CPP} ]; then + echo "${CCVER}_CPP undefined, see compilers.conf(5)" + exit 1 + fi exec ${CUSTOM_CPP} ${INCOPT} ${CUSTOM_CPPFLAGS} "$@" fi diff --git a/share/man/man5/compilers.conf.5 b/share/man/man5/compilers.conf.5 index 05001f1459..2ddf388704 100644 --- a/share/man/man5/compilers.conf.5 +++ b/share/man/man5/compilers.conf.5 @@ -29,7 +29,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 14, 2012 +.Dd October 14, 2014 .Dt COMPILERS.CONF 5 .Os .Sh NAME @@ -79,22 +79,19 @@ Any additional flags to pass to .El .Pp Currently, defaults are provided for -.Nm clang +.Nm gcc48 (installed from -.Xr pkgsrc 7 Ap s -.Pa lang/clang ) , -.Nm clangsvn -(installed from SVN trunk as described in -.Pa http://clang.llvm.org/get_started.html ) , -.Nm gcc46 +.Xr dports 7 Ap s +.Pa lang/gcc48 ) , +.Nm gcc49 (installed from -.Xr pkgsrc 7 Ap s -.Pa lang/gnat-aux ) , +.Xr dports 7 Ap s +.Pa lang/gcc49 ) , and -.Nm pcc +.Nm gcc5 (installed from -.Xr pkgsrc 7 Ap s -.Pa lang/pcc-current ) . +.Xr dports 7 Ap s +.Pa lang/gcc5 ) . .Sh IMPLEMENTATION NOTES In .Dx , @@ -144,13 +141,13 @@ external compiler configuration file .Sh EXAMPLES Once configured the compiler can be used like this: .Bd -literal -offset indent -env CCVER=clang make +env CCVER= make .Ed .Pp To try building world and kernel, use: .Bd -literal -offset indent cd /usr/src -env WORLD_CCVER= make -DNO_GCC47 buildworld +env WORLD_CCVER= make buildworld env WORLD_CCVER= make buildkernel KERNCONF=MYCONF .Ed .Sh SEE ALSO