summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuel Haupt <ehaupt@FreeBSD.org>2011-02-28 13:39:53 +0000
committerEmanuel Haupt <ehaupt@FreeBSD.org>2011-02-28 13:39:53 +0000
commit3bfe3f791913a66924ebb0bb9bfbebe1f4caedab (patch)
tree417309e6ab8f1b0163824107cb40d049f90f9f4f
parentBSDBuild is a simple, self-contained and portable build system derived from the (diff)
Allow the use of non-default compilers such as clang.
PR: 155008 Submitted by: avilla
Notes
Notes: svn path=/head/; revision=269982
-rw-r--r--devel/ccache/Makefile16
-rw-r--r--devel/ccache/files/ccache-howto-freebsd.txt.in19
-rw-r--r--devel/ccache/files/world-c++.in4
-rw-r--r--devel/ccache/files/world-cc.in4
-rw-r--r--devel/ccache/files/world-ccache.in9
5 files changed, 31 insertions, 21 deletions
diff --git a/devel/ccache/Makefile b/devel/ccache/Makefile
index 3a11ec7766ac..ce7160c773c8 100644
--- a/devel/ccache/Makefile
+++ b/devel/ccache/Makefile
@@ -7,6 +7,7 @@
PORTNAME= ccache
PORTVERSION= 3.1.4
+PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://samba.org/ftp/ccache/ CRITICAL
@@ -26,7 +27,7 @@ PORTDOCS= *
.if !defined(WITHOUT_COMPILER_LINKS)
HOWTO= ccache-howto-freebsd.txt
CCLINKDIR= libexec/ccache
-PLIST_DIRS= ${CCLINKDIR}
+PLIST_DIRS= ${CCLINKDIR}/world ${CCLINKDIR}
SUB_FILES= ${HOWTO} pkg-message
.endif
@@ -42,10 +43,10 @@ CCACHE_COMPILERS+= clang clang++ llvm-gcc llvm-c++ llvm-g++
.if defined(EXTRA_COMPILERS)
CCACHE_COMPILERS+= ${EXTRA_COMPILERS}
.endif
-WORLD_COMPILERS= world-cc world-c++
PLIST_FILES+= ${CCACHE_COMPILERS:S|^|${CCLINKDIR}/|} \
- ${WORLD_COMPILERS:S|^|${CCLINKDIR}/|}
-SUB_FILES+= ${WORLD_COMPILERS}
+ ${CCACHE_COMPILERS:S|^|${CCLINKDIR}/world/|} \
+ ${CCLINKDIR}/world/ccache
+SUB_FILES+= world-ccache
SUB_LIST+= CCACHE_COMPILERS="${CCACHE_COMPILERS}" \
CCLINKDIR="${CCLINKDIR}" \
ICCPREFIX="${LOCALBASE}/intel_cc_80/bin" \
@@ -69,12 +70,11 @@ do-install:
${INSTALL_PROGRAM} ${WRKSRC}/ccache ${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1
.if !defined(WITHOUT_COMPILER_LINKS)
- @${MKDIR} ${PREFIX}/${CCLINKDIR}
+ @${MKDIR} ${PREFIX}/${CCLINKDIR}/world
+ ${INSTALL_SCRIPT} ${WRKDIR}/world-ccache ${PREFIX}/${CCLINKDIR}/world/ccache
.for link in ${CCACHE_COMPILERS}
${LN} -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${link}
-.endfor
-.for script in ${WORLD_COMPILERS}
- ${INSTALL_SCRIPT} ${WRKDIR}/${script} ${PREFIX}/${CCLINKDIR}
+ ${LN} -sf ccache ${PREFIX}/${CCLINKDIR}/world/${link}
.endfor
.endif
.if !defined(NOPORTDOCS)
diff --git a/devel/ccache/files/ccache-howto-freebsd.txt.in b/devel/ccache/files/ccache-howto-freebsd.txt.in
index 5d898333d471..6306573de59b 100644
--- a/devel/ccache/files/ccache-howto-freebsd.txt.in
+++ b/devel/ccache/files/ccache-howto-freebsd.txt.in
@@ -2,12 +2,14 @@
# $FreeBSD$
#
-To use ccache add the following to /etc/make.conf
+To use ccache add the following to /etc/make.conf.
+You can replace cc and c++ with the compilers of your choice.
+(remember that only GCC and Clang can build world and kernel)
.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*))
.if !defined(NOCCACHE)
-CC:=${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world-cc,1}
-CXX:=${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world-c++,1}
+CC:=${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world/cc,1}
+CXX:=${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world/c++,1}
.endif
.endif
@@ -47,18 +49,25 @@ reset PATH=$CCACHE_PATH and try again.
Ccache has installed links for the following compilers
%%CCACHE_COMPILERS%%
in %%PREFIX%%/%%CCLINKDIR%%
+and %%PREFIX%%/%%CCLINKDIR%%/world
+
+Clang will return a lot of 'unused argument' warnings: they are harmless.
+Just add this to /etc/make.conf if you want to hide them:
+.if ${CC:T} == "clang"
+CFLAGS+= -Qunused-arguments
+.endif
!!! WARNING !!!
Please make sure you have the compiler installed before you do this or your
build will fail because it will not be able to find the compiler.
-Any time you change CC/CXX you need to reinstall devel/libtool15 or you
+Any time you change CC/CXX you need to reinstall devel/libtool or you
will run in to problems.
--
Ccache's default cache size is 1GB and this is larger than the default size of
-the root partition (/) on FreeBSD. To over come this you may specify a new
+the root partition (/) on FreeBSD. To over come this you may specify a new
cache location on a different partition with the following examples.
For Korn/Bourne shells Add the following to /etc/profile:
diff --git a/devel/ccache/files/world-c++.in b/devel/ccache/files/world-c++.in
deleted file mode 100644
index b7d97d8ec808..000000000000
--- a/devel/ccache/files/world-c++.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-unset CCACHE_PATH
-export CCACHE_COMPILERCHECK=content
-exec %%PREFIX%%/%%CCLINKDIR%%/c++ "$@"
diff --git a/devel/ccache/files/world-cc.in b/devel/ccache/files/world-cc.in
deleted file mode 100644
index e81d1432d613..000000000000
--- a/devel/ccache/files/world-cc.in
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-unset CCACHE_PATH
-export CCACHE_COMPILERCHECK=content
-exec %%PREFIX%%/%%CCLINKDIR%%/cc "$@"
diff --git a/devel/ccache/files/world-ccache.in b/devel/ccache/files/world-ccache.in
new file mode 100644
index 000000000000..2b27aeefeb3f
--- /dev/null
+++ b/devel/ccache/files/world-ccache.in
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+[ "${0##*/}" = "ccache" ] &&
+printf "Please, use one of the compiler links in\n%%PREFIX%%/%%CCLINKDIR%%/world\nto invoke ccache\n" >&2 &&
+exit 1
+
+unset CCACHE_PATH
+export CCACHE_COMPILERCHECK=content
+exec %%PREFIX%%/%%CCLINKDIR%%/${0##*/} "$@"