Date: Thu, 10 May 2012 10:28:01 +0300 From: Andriy Gapon <avg@FreeBSD.org> To: bf1783@gmail.com Cc: Gerald Pfeifer <gerald@FreeBSD.org>, "b. f." <bf1783@googlemail.com>, freebsd-ports@FreeBSD.org Subject: Re: WITH_GCC Message-ID: <4FAB6E01.50108@FreeBSD.org> In-Reply-To: <4FA643FA.3050206@FreeBSD.org> References: <CAGFTUwPUFdP=Z20%2BbL59qFuh_V6R1R-GcyrK03dxESL6ZyGz7A@mail.gmail.com> <4F578AA7.4060008@FreeBSD.org> <4F990D9A.3090100@FreeBSD.org> <4FA643FA.3050206@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
on 06/05/2012 12:27 Andriy Gapon said the following:
> My makefile-fu and ports-infrastructure-fu are really weak (maybe non-existent
> even), but here is my attempt: [see the attachment].
>
> The idea behind the patch:
> - if WITH_GCC is not defined, then everything should be as before
> - 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 [*]
>
> [*] Note that 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.
>
Here's an updated version of the patch.
It should allow for initial bootstrapping of GCC itself.
BTW, what would be the more appropriate name for such a knob - WITH_GCC or WANT_GCC?
--- /usr/ports/Mk/bsd.gcc.mk.orig 2012-05-06 11:12:55.628670003 +0300
+++ /usr/ports/Mk/bsd.gcc.mk 2012-05-09 14:21:40.318673080 +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
--
Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FAB6E01.50108>
