Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 May 2012 00:17:56 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        freebsd-ports@FreeBSD.org
Cc:        Gerald Pfeifer <gerald@FreeBSD.org>
Subject:   Re: WITH_GCC
Message-ID:  <4FAC3084.80101@FreeBSD.org>
In-Reply-To: <4FAB6E01.50108@FreeBSD.org>
References:  <CAGFTUwPUFdP=Z20%2BbL59qFuh_V6R1R-GcyrK03dxESL6ZyGz7A@mail.gmail.com> <4F578AA7.4060008@FreeBSD.org> <4F990D9A.3090100@FreeBSD.org> <4FA643FA.3050206@FreeBSD.org> <4FAB6E01.50108@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
on 10/05/2012 10:28 Andriy Gapon said the following:
> Here's an updated version of the patch.
> It should allow for initial bootstrapping of GCC itself.

Next version of the patch...
Hopefully it should handle the bootstrapping better by accounting for lang/gcc*
ports dependencies and avoiding creating any circular dependencies.
For simplicity the GCC ports and their dependencies are forced to be built with
the base GCC, although this does not have to be required.

--- /usr/ports/Mk/bsd.gcc.mk.orig	2012-05-06 11:12:55.628670003 +0300
+++ /usr/ports/Mk/bsd.gcc.mk	2012-05-10 18:49:27.218670582 +0300
@@ -98,6 +98,30 @@ CONFIGURE_ENV+=	F77="${F77}" FC="${FC}"
 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 +167,11 @@ IGNORE=		Couldn't find your current GCCV
 # 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
@@ -178,24 +207,39 @@ _USE_GCC:=	${GCC_DEFAULT_VERSION}
 . if ${_USE_GCC} == ${_GCCVERSION_${v}_V}
 .  if ${OSVERSION} < ${_GCCVERSION_${v}_L} || ${OSVERSION} > ${_GCCVERSION_${v}_R}
 V:=			${_GCCVERSION_${v}_V:S/.//}
-_GCC_BUILD_DEPENDS:=	gcc${V}
 _GCC_PORT_DEPENDS:=	gcc${V}
+.   if ${V} == ${GCC_DEFAULT_V}
+_GCC_BUILD_DEPENDS:=	gcc
+.   else
+_GCC_BUILD_DEPENDS:=	gcc${V}
+.   endif
+_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}
+CFLAGS+=		${CFLAGS.${CC}}
+CXXFLAGS+=		${CXXFLAGS.${CC}}
 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}

-- 
Andriy Gapon



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