--- bsd.gcc.mk.orig 2012-05-16 08:35:39.359670220 +0300 +++ bsd.gcc.mk 2012-05-16 08:47:40.709674341 +0300 @@ -5,6 +5,13 @@ # # Created by: Edwin Groothuis # +# For users: +# if you would like to use GCC from ports as your ports compiler, you can +# specify that with a WITH_GCC knob in your make.conf. +# +# Example: +# WITH_GCC= 4.6 # use GCC 4.6 to compile ports +# # For port developers: # If your port needs a specific (minimum) version of GCC, you can easily # specify that with a "USE_GCC=" statement. Unless absolutely necessary @@ -26,6 +33,20 @@ # Due to object file incompatiblity between Fortran compilers, we strongly # recommend to use only one of them on any system. # +# Interaction between WITH_GCC user knob and USE_GCC port knob: +# - if WITH_GCC is defined, but USE_GCC is not defined, +# then USE_GCC gets set from WITH_GCC +# - if both are defined +# o if USE_GCC is a concrete version, then it wins +# o else (if USE_GCC has the "X+") form, then the minimum requested +# version becomes MAX(X, Y), where Y is from WITH_GCC; +# whether WITH_GCC has "Y" or "Y+" form doesn't matter in this case +# In all cases WITH_GCC can be used only to increase minimum required +# GCC version, unless a port wants a concrete fixed version. +# +# Note that the GCC ports and their dependencies are always built with +# the base GCC to avoid circular dependencies and bootstrapping problems. +# # If you are wondering what your port exactly does, use "make test-gcc" # to see some debugging. # @@ -98,6 +119,30 @@ MAKE_ENV+= F77="${F77}" FC="${FC}" FFLAGS="${FFLAGS}" .endif +.if defined(WITH_GCC) && ${PORTNAME} != gcc + +# See if we can use a later version or exclusively the one specified. +_WITH_GCC:= ${WITH_GCC:S/+//} + +# Check if WITH_GCC points to a valid version. +.for v in ${GCCVERSIONS} +. for j in ${GCCVERSION_${v}} +. if ${_WITH_GCC}==${j} +_WITH_GCCVERSION_OKAY= true; +. endif +. endfor +.endfor + +.if !defined(_WITH_GCCVERSION_OKAY) +IGNORE= Unknown version of GCC specified (WITH_GCC=${WITH_GCC}) +.endif + +.if !defined(USE_GCC) +USE_GCC:= ${WITH_GCC} +.undef _WITH_GCC +.endif + +.endif # WITH_GCC .if defined(USE_GCC) @@ -143,6 +188,11 @@ # get the first available version. # .if defined(_GCC_ORLATER) +. if defined(_WITH_GCC) +. if ${_USE_GCC} < ${_WITH_GCC} +_USE_GCC:= ${_WITH_GCC} +. endif +. endif . for v in ${GCCVERSIONS} . if ${_USE_GCC} == ${_GCCVERSION_${v}_V} _GCC_MIN1:= true @@ -180,22 +230,31 @@ V:= ${_GCCVERSION_${v}_V:S/.//} _GCC_BUILD_DEPENDS:= gcc${V} _GCC_PORT_DEPENDS:= gcc${V} +_GCC_OWN_DEPENDS!= (cd ${PORTSDIR}/lang/${_GCC_BUILD_DEPENDS} && ${MAKE} -V _UNIFIED_DEPENDS) +. for _CURDIR in ${.CURDIR} # only loop variable are expanded in variable modifiers +. if ${_GCC_OWN_DEPENDS:M*\:${_CURDIR}} != "" +.undef _GCC_BUILD_DEPENDS +.undef _GCC_PORT_DEPENDS +. else CC:= gcc${V} CXX:= g++${V} CPP:= cpp${V} -. if ${_USE_GCC} != 3.4 +. if ${_USE_GCC} != 3.4 CFLAGS+= -Wl,-rpath=${LOCALBASE}/lib/${_GCC_BUILD_DEPENDS} LDFLAGS+= -Wl,-rpath=${LOCALBASE}/lib/${_GCC_BUILD_DEPENDS} -. if defined (USE_FORTRAN) -. if ${USE_FORTRAN} == yes +. if defined (USE_FORTRAN) +. if ${USE_FORTRAN} == yes FFLAGS+= -Wl,-rpath=${LOCALBASE}/lib/${_GCC_BUILD_DEPENDS} -. endif +. endif +. endif . endif . endif +. endfor . endif . endif .endfor .undef V +.undef _GCC_OWN_DEPENDS .if defined(_GCC_BUILD_DEPENDS) BUILD_DEPENDS+= ${_GCC_PORT_DEPENDS}:${PORTSDIR}/lang/${_GCC_BUILD_DEPENDS} --- bsd.port.mk.orig 2012-05-06 12:14:36.049668562 +0300 +++ bsd.port.mk 2012-05-06 11:56:45.909668044 +0300 @@ -1678,7 +1678,7 @@ CONFIGURE_ENV+= MAKE=${GMAKE} .endif -.if defined(USE_GCC) || defined(USE_FORTRAN) +.if defined(USE_GCC) || defined(USE_FORTRAN) || defined(WITH_GCC) .include "${PORTSDIR}/Mk/bsd.gcc.mk" .endif