From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Aug 25 06:00:23 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 696BA1065696 for ; Wed, 25 Aug 2010 06:00:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 464368FC19 for ; Wed, 25 Aug 2010 06:00:23 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7P60N9q053190 for ; Wed, 25 Aug 2010 06:00:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o7P60Nwf053189; Wed, 25 Aug 2010 06:00:23 GMT (envelope-from gnats) Resent-Date: Wed, 25 Aug 2010 06:00:23 GMT Resent-Message-Id: <201008250600.o7P60Nwf053189@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, bf Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F391F1065670 for ; Wed, 25 Aug 2010 05:59:21 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E18AF8FC12 for ; Wed, 25 Aug 2010 05:59:21 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o7P5xLJE039430 for ; Wed, 25 Aug 2010 05:59:21 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o7P5xLSM039429; Wed, 25 Aug 2010 05:59:21 GMT (envelope-from nobody) Message-Id: <201008250559.o7P5xLSM039429@www.freebsd.org> Date: Wed, 25 Aug 2010 05:59:21 GMT From: bf To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/149955: [PATCH] bsd.port.mk: add a knob to use the devel/binutils port, rather than the base system binutils X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2010 06:00:23 -0000 >Number: 149955 >Category: ports >Synopsis: [PATCH] bsd.port.mk: add a knob to use the devel/binutils port, rather than the base system binutils >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Aug 25 06:00:22 UTC 2010 >Closed-Date: >Last-Modified: >Originator: bf >Release: 9-CURRENT amd64 >Organization: - >Environment: >Description: A growing number of ports need to use the utilities from the devel/binutils port, rather than the old base system binutils. Among them are many ports that USE_GCC=4.[456] or USE_FORTRAN. ports/136607 solved part (but not all) of this problem by hard-coding a dependence on devel/binutils in the lang/gcc4[456] ports, ensuring that these compilers would use the linker and assembler from devel/binutils implicitly. However, a number of ports still call the linker, assembler, and other utilities _explicitly_, and this was not addressed by ports/136607. This can result in a problematic mixing of different tool-chains (for example, like in math/blas, math/atlas, and math/lapack), or a hard-coded dependency on the base system binutils, when the newer binutils are desired. (This is because utilities like AR, AS, LD, OBJCOPY, OBJDUMP, and RANLIB are set in /usr/share/mk/sys.mk, ports/Mk/bsd.commands.mk, and ports/Mk/bsd.port.mk; and because the devel/binutils are usually preceded b y the like-named base system binutils in the system path.) To address this problem without requiring redundant code in individual port Makefiles, I propose the attached patch to bsd.port.mk. It will ensure that a choice of tool-chains is available, even in ports that do not use lang/gcc4[456]. With the patch, if USE_BINUTILS is defined in a port Makefile: --devel/binutils is added to BUILD_DEPENDS --the subset of utilities contained in BINUTILS (by default, all of them) is exposed to targets in port Makefiles, --added to the CONFIGURE_ENV (if the ports uses GNU_CONFIGURE or USE_BINUTILS_CONFIGURE is defined), and --added to the MAKE_ENV (if not contained in a blacklist BINUTILS_NO_MAKE_ENV). The whole can be disabled for debugging purposes by defining DISABLE_BINUTILS. The small number of ports that have devel/binutils as a run-time dependency, like lang/gcc4[456], will still need to add a RUN_DEPENDS. ports/Mk/bsd.gcc.mk can be altered to add USE_BINUTILS when USE_GCC=4.[456] or USE_FORTRAN is defined, and other ports that don't use lang/gcc[456] can add a line or two to their Makefiles, and make use of the variables provided in patching sources, if necessary. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: bsd.port.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v retrieving revision 1.644 diff -u -r1.644 bsd.port.mk --- bsd.port.mk 20 Aug 2010 12:15:02 -0000 1.644 +++ bsd.port.mk 25 Aug 2010 04:43:17 -0000 @@ -1734,6 +1734,22 @@ .include "${PORTSDIR}/Mk/bsd.gcc.mk" .endif +.if defined(USE_BINUTILS) && !defined(DISABLE_BINUTILS) +BUILD_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils +BINUTILS?= ADDR2LINE AR AS CPPFILT GPROF LD NM OBJCOPY OBJDUMP RANLIB \ + READELF SIZE STRINGS +BINUTILS_NO_MAKE_ENV?= +. for b in ${BINUTILS} +${b}= ${LOCALBASE}/bin/${b:C/PP/++/:L} +. if defined(GNU_CONFIGURE) || defined(BINUTILS_CONFIGURE) +CONFIGURE_ENV+= ${b}="${${b}}" +. endif +. if ${BINUTILS_NO_MAKE_ENV:M${b}} == "" +MAKE_ENV+= ${b}="${${b}}" +. endif +. endfor +.endif + .if defined(USE_OPENLDAP) || defined(WANT_OPENLDAP_VER) .include "${PORTSDIR}/Mk/bsd.ldap.mk" .endif >Release-Note: >Audit-Trail: >Unformatted: