Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 2010 12:03:30 +0100
From:      Alberto Villa <avilla@freebsd.org>
To:        ports@freebsd.org, ehaupt@freebsd.org
Subject:   ccache: support other world compilers
Message-ID:  <201012171203.34851.avilla@freebsd.org>

next in thread | raw e-mail | index | archive | help
--nextPart1550690.LUfWF1U4Tq
Content-Type: multipart/mixed;
  boundary="Boundary-01=_CO0CNDap2hSP4zV"
Content-Transfer-Encoding: 7bit


--Boundary-01=_CO0CNDap2hSP4zV
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

hello!

the attached patch allows ccache to use non-default compilers=20
(especially clang, as it's the only one which will actually work) to build=
=20
world and kernel. ehaupt@ suggested to let ports@ review it

it also updates documentation with the new instructions, and replaces=20
libtool15 with libtool

a couple of notes:
=2D the clang warnings about unused arguments are really harmless. read=20
more here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-
June/009539.html
=2D i replaced world-* with world/* (this would obviously require a note in=
=20
UPDATING) because of this (/sys/boot/i386/boot2/Makefile and others):
CC:=3D${CC:C/^(.*\/)?clang$/gcc/1}
world-clang wouldn't be replaced with world-gcc, while world/clang is=20
successfully changed to world/gcc. in addition, this allows to have only=20
one script (world/ccache), and just create links to it (like world/clang,=20
world/llvm-gcc...)

while i had no problems at building world with world/clang, i've not yet=20
tested the port installation, but i'll do it as soon as i have a free=20
tinderbox. meanwhile you can share your comments about the patch
=2D-=20
Alberto Villa, FreeBSD committer <avilla@FreeBSD.org>
http://people.FreeBSD.org/~avilla

Anything free is worth what you pay for it.

--Boundary-01=_CO0CNDap2hSP4zV
Content-Type: text/x-patch;
  charset="ISO-8859-1";
  name="ccache.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ccache.diff"

Index: Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/pcvs/ports/devel/ccache/Makefile,v
retrieving revision 1.57
diff -u -r1.57 Makefile
=2D-- Makefile	30 Nov 2010 22:37:33 -0000	1.57
+++ Makefile	17 Dec 2010 10:44:02 -0000
@@ -7,6 +7,7 @@
=20
 PORTNAME=3D	ccache
 PORTVERSION=3D	3.1.3
+PORTREVISION=3D	1
 CATEGORIES=3D	devel
 MASTER_SITES=3D	http://samba.org/ftp/ccache/ CRITICAL
=20
@@ -26,7 +27,7 @@
 .if !defined(WITHOUT_COMPILER_LINKS)
 HOWTO=3D		ccache-howto-freebsd.txt
 CCLINKDIR=3D	libexec/ccache
=2DPLIST_DIRS=3D	${CCLINKDIR}
+PLIST_DIRS=3D	${CCLINKDIR} ${CCLINKDIR}/world
 SUB_FILES=3D	${HOWTO} pkg-message
 .endif
=20
@@ -42,10 +43,9 @@
 .if defined(EXTRA_COMPILERS)
 CCACHE_COMPILERS+=3D	${EXTRA_COMPILERS}
 .endif
=2DWORLD_COMPILERS=3D	world-cc world-c++
 PLIST_FILES+=3D	${CCACHE_COMPILERS:S|^|${CCLINKDIR}/|} \
=2D		${WORLD_COMPILERS:S|^|${CCLINKDIR}/|}
=2DSUB_FILES+=3D	${WORLD_COMPILERS}
+		${CCACHE_COMPILERS:S|^|${CCLINKDIR}/world/|}
+SUB_FILES+=3D	world-ccache
 SUB_LIST+=3D	CCACHE_COMPILERS=3D"${CCACHE_COMPILERS}" \
 		CCLINKDIR=3D"${CCLINKDIR}" \
 		ICCPREFIX=3D"${LOCALBASE}/intel_cc_80/bin" \
@@ -69,12 +69,11 @@
 	${INSTALL_PROGRAM} ${WRKSRC}/ccache ${PREFIX}/bin
 	${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1
 .if !defined(WITHOUT_COMPILER_LINKS)
=2D	@${MKDIR} ${PREFIX}/${CCLINKDIR}
+	@${MKDIR} ${PREFIX}/${CCLINKDIR}/world
+	${INSTALL_SCRIPT} ${WRKDIR}/world-ccache ${PREFIX}/${CCLINKDIR}/world/cca=
che
 .for link in ${CCACHE_COMPILERS}
 	${LN} -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${link}
=2D.endfor
=2D.for script in ${WORLD_COMPILERS}
=2D	${INSTALL_SCRIPT} ${WRKDIR}/${script} ${PREFIX}/${CCLINKDIR}
+	${LN} -sf ccache ${PREFIX}/${CCLINKDIR}/world/${link}
 .endfor
 .endif
 .if !defined(NOPORTDOCS)
Index: files/ccache-howto-freebsd.txt.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/pcvs/ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v
retrieving revision 1.13
diff -u -r1.13 ccache-howto-freebsd.txt.in
=2D-- files/ccache-howto-freebsd.txt.in	17 Nov 2010 18:41:35 -0000	1.13
+++ files/ccache-howto-freebsd.txt.in	17 Dec 2010 10:44:02 -0000
@@ -2,12 +2,14 @@
 # $FreeBSD: ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v 1.13 20=
10/11/17 18:41:35 ehaupt Exp $
 #
=20
=2DTo 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)
=20
 .if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*))
 .if !defined(NOCCACHE)
=2DCC:=3D${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world-cc,1}
=2DCXX:=3D${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world-c++,1}
+CC:=3D${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world/cc,1}
+CXX:=3D${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world/c++,1}
 .endif
 .endif
=20
@@ -47,12 +49,16 @@
 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 -Qunused-arguments to CFLAGS if you want to hide them.
=20
 !!! 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.
=20
=2DAny time you change CC/CXX you need to reinstall devel/libtool15 or you=
=20
+Any time you change CC/CXX you need to reinstall devel/libtool or you=20
 will run in to problems.
=20
 --
Index: files/world-c++.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: files/world-c++.in
diff -N files/world-c++.in
=2D-- files/world-c++.in	31 Jul 2010 10:48:26 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
=2D#!/bin/sh
=2Dunset CCACHE_PATH
=2Dexport CCACHE_COMPILERCHECK=3Dcontent
=2Dexec %%PREFIX%%/%%CCLINKDIR%%/c++ "$@"
Index: files/world-cc.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: files/world-cc.in
diff -N files/world-cc.in
=2D-- files/world-cc.in	31 Jul 2010 10:48:26 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
=2D#!/bin/sh
=2Dunset CCACHE_PATH
=2Dexport CCACHE_COMPILERCHECK=3Dcontent
=2Dexec %%PREFIX%%/%%CCLINKDIR%%/cc "$@"
Index: files/world-ccache.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: files/world-ccache.in
diff -N files/world-ccache.in
=2D-- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/world-ccache.in	17 Dec 2010 10:44:02 -0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+[ "${0##*/}" =3D "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=3Dcontent
+exec %%PREFIX%%/%%CCLINKDIR%%/${0##*/} "$@"

--Boundary-01=_CO0CNDap2hSP4zV--

--nextPart1550690.LUfWF1U4Tq
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iJwEAAECAAYFAk0LQ4YACgkQ3xiC6kQ1CovKDgQAhntRDNNoHYVOcOk7O/+VJM5A
6YW20gpvHdmDK2nCYMTYGmGhTcIryUyv6APqpsqJz9JT9sKCNz4e0jq5b7drbMRA
TzNg08YN5SKo4lxGC4mRhri1ahfblvlwYvmROvkY/vHBQCyFnwgGhG2slCMm0Jj4
MmzR2CLRJ0qYNqNHFWM=
=fu0X
-----END PGP SIGNATURE-----

--nextPart1550690.LUfWF1U4Tq--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201012171203.34851.avilla>