Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jan 2015 22:33:54 -0800
From:      "Chris H" <bsd-lists@bsdforge.com>
To:        ports@FreeBSD.org, Don Lewis <truckman@FreeBSD.org>
Subject:   Re: testing the value of ${CXX} in ports Makefile
Message-ID:  <d92dec8ec505439ebc766c2bf557a31e@ultimatedns.net>
In-Reply-To: <201501300345.t0U3jHwb008745@gw.catspoiler.org>
References:  <201501300345.t0U3jHwb008745@gw.catspoiler.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Jan 2015 19:43:38 -0800 (PST) Don Lewis <truckman@FreeBSD.org> 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 <bsd.port.pre.mk>
> 
> post-patch:
>     echo CXX=${CXX}
> .if ${CXX} == g++49
>     echo detected g++49
> .else
>     echo did not detect g++49
> .endif
> 
> .include <bsd.port.post.mk>
> 
> 
> 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.
I'm not attempting to come off as any sot of expert. But it
seems like you're going the long way around. Couldn't you
just as easily REQUIRE, or perhaps even better; simply reverse
the logic;

if ${CXX} != g++49
@VOMIT
endif

It'd be shorter, and still assures the results you require,
no? Just a thought.

--Chris
> 
> 
> 
> _______________________________________________
> 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"





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d92dec8ec505439ebc766c2bf557a31e>