ports/150609: [bsd.gcc.mk]: support overriding gcc/g++

Dmitry Marakasov amdmi3 at FreeBSD.org
Thu Sep 16 01:50:01 UTC 2010


>Number:         150609
>Category:       ports
>Synopsis:       [bsd.gcc.mk]: support overriding gcc/g++
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 16 01:50:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Marakasov
>Release:        FreeBSD 8.1-RELEASE i386
>Organization:
>Environment:
System: FreeBSD hades.panopticon 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Fri Jul 30 02:50:28 MSD 2010 root at hades.panopticon:/async/obj/usr/src/sys/HADES i386


>Description:
It's possible to override CC and CXX, and that's particularly useful for using ccache to build ports: one has to define CC=/usr/local/libexec/ccache/cc and CXX=/usr/local/libexec/ccache/c++ in the environement. However, that's not possible with ports that define USE_GCC >= 4.2, as gccNN and g++NN compilers are hardcoded. This change makes it possible to override these as well, e.g.

GCCNN_PREFIX=/usr/local/libexec/ccache/gcc
GXXNN_PREFIX=/usr/local/libexec/ccache/g++

for ccache, in which case /usr/local/libexec/ccache/g{cc,++}44 will be used for USE_GCC=4.4, etc.

The same thing works for at least distcc, possibly has other appliances.

>How-To-Repeat:
>Fix:

--- bsd.gcc.mk.patch begins here ---
Index: bsd.gcc.mk
===================================================================
RCS file: /home/amdmi3/projects/freebsd/FreeBSD.cvs/ports/Mk/bsd.gcc.mk,v
retrieving revision 1.46
diff -u -r1.46 bsd.gcc.mk
--- bsd.gcc.mk	4 Sep 2010 17:08:27 -0000	1.46
+++ bsd.gcc.mk	16 Sep 2010 01:24:54 -0000
@@ -48,6 +48,11 @@
 GCCVERSION_040500=	999999 999999 4.5
 GCCVERSION_040600=	999999 999999 4.6
 
+# User may override these to use wrappers for numbered gcc/g++, e.g
+# /usr/local/libexec/ccache/gcc and /usr/local/libexec/ccache/g++
+GCCNN_PREFIX?=	gcc
+GXXNN_PREFIX?=	g++
+
 #
 # No configurable parts below this.
 #
@@ -93,13 +98,13 @@
 RUN_DEPENDS+=	g77-34:${PORTSDIR}/lang/gcc34
 FC:=	g77-34
 F77:=	g77-34
-CC:=	gcc34
-CXX:=	g++34
+CC:=	${GCCNN_PREFIX}34
+CXX:=	${GXXNN_PREFIX}34
 .  else
 F77:=	f77
 FC:=	f77
-CC:=	gcc
-CXX:=	g++
+CC:=	${GCCNN_PREFIX}
+CXX:=	${GXXNN_PREFIX}
 .  endif
 
 . else
@@ -189,8 +194,8 @@
 V:=			${_GCCVERSION_${v}_V:S/.//}
 _GCC_BUILD_DEPENDS:=	gcc${V}
 _GCC_PORT_DEPENDS:=	gcc${V}
-CC:=			gcc${V}
-CXX:=			g++${V}
+CC:=			${GCCNN_PREFIX}${V}
+CXX:=			${GXXNN_PREFIX}${V}
 .   if ${_USE_GCC} != 3.4
 CFLAGS+=		-Wl,-rpath=${LOCALBASE}/lib/${_GCC_BUILD_DEPENDS}
 LDFLAGS+=		-Wl,-rpath=${LOCALBASE}/lib/${_GCC_BUILD_DEPENDS}
--- bsd.gcc.mk.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list