From owner-freebsd-ports@FreeBSD.ORG Sun May 6 09:27:28 2012 Return-Path: Delivered-To: freebsd-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E0531065670; Sun, 6 May 2012 09:27:28 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 306F98FC08; Sun, 6 May 2012 09:27:27 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA25020; Sun, 06 May 2012 12:27:24 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1SQxkR-000DHG-V7; Sun, 06 May 2012 12:27:24 +0300 Message-ID: <4FA643FA.3050206@FreeBSD.org> Date: Sun, 06 May 2012 12:27:22 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120503 Thunderbird/12.0.1 MIME-Version: 1.0 To: bf1783@gmail.com References: <4F578AA7.4060008@FreeBSD.org> <4F990D9A.3090100@FreeBSD.org> In-Reply-To: <4F990D9A.3090100@FreeBSD.org> X-Enigmail-Version: 1.5pre Content-Type: multipart/mixed; boundary="------------050803090608010900050008" Cc: Gerald Pfeifer , "b. f." , freebsd-ports@FreeBSD.org Subject: WITH_GCC [Was: graphics/png does not build with lang/gcc] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 09:27:28 -0000 This is a multi-part message in MIME format. --------------050803090608010900050008 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit on 26/04/2012 11:55 Andriy Gapon said the following: > on 07/03/2012 18:19 Andriy Gapon said the following: >> on 07/03/2012 14:11 b. f. said the following: >>> you can just >>> install lang/gcc or lang/gcc46 and set USE_GCC=4.6 in your build >>> environment, an included Makefile, or on the command line > > And an additional problem with this recommendation is that if a port has e.g. > USE_GCC=4.2+ in its Makefile, then the user setting gets overridden (at least if > it's in make.conf). So a better way to ask for gcc46+ is needed. > >> BTW, our traditional taxonomy seems to be: "USE_XXX" is for stuff that ports >> really require, "WITH_XXX" is for user preferences. >> So it might make sense to create a WITH_GCC knob specifically for the use that you >> suggested above. 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. -- Andriy Gapon --------------050803090608010900050008 Content-Type: text/plain; charset=UTF-8; name="bsd.gcc.mk.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bsd.gcc.mk.patch" --- Mk/bsd.port.mk.orig 2012-05-06 12:14:36.049668562 +0300 +++ Mk/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 --- Mk/bsd.gcc.mk.orig 2012-05-06 11:12:55.628670003 +0300 +++ Mk/bsd.gcc.mk 2012-05-06 11:37:29.394675881 +0300 @@ -98,6 +98,30 @@ CONFIGURE_ENV+= F77="${F77}" FC="${FC}" MAKE_ENV+= F77="${F77}" FC="${FC}" FFLAGS="${FFLAGS}" .endif +.if defined(WITH_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 + +.endif # WITH_GCC + +.if !defined(USE_GCC) +USE_GCC= ${WITH_GCC} +.undef _WITH_GCC +.endif .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 --------------050803090608010900050008--