From owner-freebsd-ports@FreeBSD.ORG Sun Feb 1 22:44:41 2015 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8075495F for ; Sun, 1 Feb 2015 22:44:41 +0000 (UTC) Received: from gw.catspoiler.org (cl-1657.chi-02.us.sixxs.net [IPv6:2001:4978:f:678::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04439EF7 for ; Sun, 1 Feb 2015 22:44:40 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id t11MiTkw032345; Sun, 1 Feb 2015 14:44:36 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201502012244.t11MiTkw032345@gw.catspoiler.org> Date: Sun, 1 Feb 2015 14:44:29 -0800 (PST) From: Don Lewis Subject: Re: testing the value of ${CXX} in ports Makefile To: FreeBSD@shaneware.biz In-Reply-To: <54CC8935.5020906@ShaneWare.Biz> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: ports@FreeBSD.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Feb 2015 22:44:41 -0000 On 31 Jan, Shane Ambler wrote: > On 31/01/2015 10:55, Don Lewis wrote: >> On 31 Jan, Shane Ambler wrote: >>> On 30/01/2015 14:13, Don Lewis wrote: > >> post-patch: >> @echo CXX=${CXX} >> @echo GCC_DEFAULT=${GCC_DEFAULT} >> .if ${CHOSEN_COMPILER_TYPE} == gcc and ${COMPILER_VERSION} == 49 >> @echo g++49 was detected >> .else >> @echo g++49 was not detected >> .endif >> >> # make patch >> make: "/usr/ports/editors/junk/Makefile" line 17: Malformed conditional (${CHOSEN_COMPILER_TYPE} == gcc and ${COMPILER_VERSION} == 49) >> make: Fatal errors encountered -- cannot continue > > yeah my bad - don't know why I typed `and` instead of `&&` > >>> You may also want to consider patching with - >>> >>> #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 9) >>> // 4.9 specific changes >>> #endif >> >> That would work if I was patching C or C++ code, but I'm actually patching >> a file that is used to set the the -O value for CFLAGS. The build stuff >> in the port is pretty strange and uses different optimization levels for >> for different parts of the build and one of choices that it makes >> triggers a code generation bug in gcc 4.9. > > What is the build system used? > > Can the build files do something like > > COMPVERS=`${CXX} --version | grep -e gcc -e 4.9` > if [ ! -z $COMPVERS ] > ${CXX} -O2 > else > ${CXX} -Os > fi As near as I can figure out, it's a mixture of gmake and dmake kicked off by a perl wrapper and both flavors have to be patched. It just seems easier to use four lines of shell code to change two instances of -Os than to try to figure out how to get two different flavors of make to do what I want (and verify that it actually works). I could maybe use the time I save on creating a gcc bug report and getting the compiler fixed.