From owner-freebsd-ports@FreeBSD.ORG Fri Jan 30 05:27:44 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 3DAAC539 for ; Fri, 30 Jan 2015 05:27:44 +0000 (UTC) Received: from mail.wilcox-tech.com (mail.foxkit.us [192.99.209.192]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.wilcox-tech.com", Issuer "mail.wilcox-tech.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ECE1519A for ; Fri, 30 Jan 2015 05:27:43 +0000 (UTC) Received: (qmail 3300 invoked from network); 30 Jan 2015 05:28:56 -0000 Received: from ip68-13-243-137.ok.ok.cox.net (HELO ?192.168.1.253?) (emyers@wilcox-tech.com@68.13.243.137) by mail.foxkit.us with ESMTPA; 30 Jan 2015 05:28:56 -0000 Message-ID: <54CB164D.60908@interlinked.me> Date: Thu, 29 Jan 2015 23:27:41 -0600 From: Elizabeth Myers User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: ports@freebsd.org Subject: Re: testing the value of ${CXX} in ports Makefile References: <201501300345.t0U3jHwb008745@gw.catspoiler.org> In-Reply-To: <201501300345.t0U3jHwb008745@gw.catspoiler.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Fri, 30 Jan 2015 05:27:44 -0000 On 01/29/15 21:43, Don Lewis wrote: > I need to test the value of ${CXX} in the Makefile for a port and am > getting unexpected results. Here is a simplified version of the > Makefile: > > PORTNAME= junk > PORTVERSION= 0.0.0 > CATEGORIES= devel > DISTFILES= > > MAINTAINER= truckman@FreeBSD.org > COMMENT= junk > > USE_GCC= 4.9+ > > .include > > post-patch: > echo CXX=${CXX} > .if ${CXX} == g++49 > echo detected g++49 > .else > echo did not detect g++49 > .endif > > .include > > > If I run "make patch", this is what I get: > > # make patch > ===> junk-0.0.0 depends on file: /usr/local/sbin/pkg - found > ===> Fetching all distfiles required by junk-0.0.0 for building > ===> Extracting for junk-0.0.0 > ===> Patching for junk-0.0.0 > echo CXX=g++49 > CXX=g++49 > echo did not detect g++49 > did not detect g++49 > > > If I run "make -dA patch" and look at the debug output, I observe > bsd.gcc.mk getting processed after the .if is evaluated. When the .if > is processed, the value of ${CXX} is still c++. It sort of looks like > bsd.gcc.mk isn't getting included until bsd.port.post.mk and we are > relying on lazy expansion to get the correct value of ${CXX} for the > actions. > > It sort of looks like I'll have to do something like: > > post-patch: > [ ${CXX} = g++49 ] && echo detected g++49 > > but that just seems goofy. > > > > _______________________________________________ > freebsd-ports@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org" Why do you need to detect it? Shouldn't USE_GCC ensure it's there? In any case, browsing through the ports tree, you could try .if !empty(CXX:M*g++49*) -- Cheers, Elizabeth Myers