From: Sascha Wildner Date: Tue, 23 Feb 2010 15:09:06 +0000 (+0100) Subject: Adjust the compiler wrapper script to use pkgsrc's clang for CCVER=clang. X-Git-Tag: v2.7.0~139 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1c4f2fa48567f20b32ef2963ca51c6d456c4b58b Adjust the compiler wrapper script to use pkgsrc's clang for CCVER=clang. * Move the definitions for the SVN version to 'clangsvn'. * Expand the compilers.conf(5) manual page a bit and give more (better) examples. Thanks to Jim Chapman for help with testing. --- diff --git a/etc/defaults/compilers.conf b/etc/defaults/compilers.conf index 4501f7e8b6..54cc1ad277 100644 --- a/etc/defaults/compilers.conf +++ b/etc/defaults/compilers.conf @@ -1,4 +1,11 @@ # clang from SVN trunk -clang_CC=/usr/local/bin/clang +# +clangsvn_CC=/usr/local/bin/clang +clangsvn_CFLAGS="-fno-color-diagnostics -Qunused-arguments -std=gnu89" +clangsvn_VERSION=4.1.2 + +# clang from pkgsrc +# +clang_CC=/usr/pkg/bin/clang clang_CFLAGS="-fno-color-diagnostics -Qunused-arguments -std=gnu89" clang_VERSION=4.1.2 diff --git a/libexec/customcc/cc.sh b/libexec/customcc/cc.sh index ac0daecb8a..1829f567ed 100644 --- a/libexec/customcc/cc.sh +++ b/libexec/customcc/cc.sh @@ -3,19 +3,27 @@ CDIR=$(dirname $0) CNAME=$(basename $0) -# XXX clang is called only for "cc" and "gcc" for now +# XXX clang needs some special handling +# +# it is called only for "cc" and "gcc" and even then it could have been +# run on c++ files # if [ "${CCVER}" = "clang" ]; then if [ "${CNAME}" = "cpp" ]; then exec ${CDIR}/../gcc41/cpp "$@" elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then exec ${CDIR}/../gcc41/c++ "$@" - else + elif [ -z $beenhere ]; then + export beenhere=1 + oldargs="$@" + export oldargs INCOPT="-nobuiltininc -nostdinc \ -isysroot @@INCPREFIX@@ \ -isystem /usr/include \ -isystem /usr/libdata/gcc41 \ -isystem /usr/include/c++/4.1" + elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then + exec ${CDIR}/../gcc41/cc $oldargs fi fi diff --git a/share/man/man5/compilers.conf.5 b/share/man/man5/compilers.conf.5 index 84da40121b..4fa7167ad6 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 August 11, 2009 +.Dd February 23, 2010 .Os .Dt COMPILERS.CONF 5 .Sh NAME @@ -88,14 +88,26 @@ with .Pp Once configured the compiler can then be used like this: .Bd -literal -offset indent -[build and install clang] +env CCVER=clang make +.Ed +.Pp +To build world and kernel, use the following instructions: +.Bd -literal -offset indent cd /usr/src -env WORLD_CCVER=clang make buildworld +fetch http://leaf.dragonflybsd.org/~swildner/world_clang.diff +patch -p1