Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Feb 2015 14:37:51 -0800 (PST)
From:      Don Lewis <truckman@FreeBSD.org>
To:        jbeich@vfemail.net
Cc:        ports@FreeBSD.org
Subject:   Re: testing the value of ${CXX} in ports Makefile
Message-ID:  <201502012237.t11Mbpr6032332@gw.catspoiler.org>
In-Reply-To: <fvar-v91o-wny@vfemail.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 31 Jan, Jan Beich wrote:
> Don Lewis <truckman@FreeBSD.org> writes:
> 
>> 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
> 
> This idiom may lead to crashes. According to the wiki[1] mixing
> libstdc++ and libc++ is only supported when both are linked against
> libcxxrt. lang/gcc by default use libsupc++, so you'd have to add

Yeah, been there, done that.  I found this out firsthand on FreeBSD 10
when I pulled in a dependency that was compiled with clang.

>   USES=   compiler:gcc-c++11-lib
> 
> to force the port use devel/libc++.

At least for now I'm happy to stick with libstdc++.  The code currently
doesn't even compile with clang, hence USES_GCC=yes.

If I USES=           compiler:gcc-c++11-lib
> Also, the following wouldn't work
> 
>   .if ${CHOSEN_COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} == 49
> 
> because COMPILER_VERSION or COMPILER_FEATURES are evaluated against
> COMPILER_TYPE, not CHOSEN_COMPILER_TYPE.

Yup, that appears to be the case.

> [1] https://wiki.freebsd.org/NewC++Stack#Mixing_Libraries_using_Libc.2B-.2B-_and_Libstdc.2B-.2B-

USES=compiler:gcc-c++11-lib allows me to force GCC, but it looks like I
always get the default version from ports and USE_GCC is ignored.  CXX
is still not updated early enough.

PORTNAME=	junk
PORTVERSION=	0.0.0
CATEGORIES=	devel
DISTFILES=

MAINTAINER=	truckman@FreeBSD.org
COMMENT=	junk

USES=		compiler:gcc-c++11-lib

.include <bsd.port.pre.mk>

post-patch:
	@echo CXX=${CXX}
	@echo GCC_DEFAULT=${GCC_DEFAULT}
	@echo CHOSEN_COMPILER_TYPE=${CHOSEN_COMPILER_TYPE}
.if ${CXX} == g++48
	@echo g++48 was detected
.endif
.if ${CXX} == c++
	@echo .if thinks CXX is still clang
.endif

.include <bsd.port.post.mk>


# make patch
===>  Patching for junk-0.0.0
CXX=g++48
GCC_DEFAULT=4.8
CHOSEN_COMPILER_TYPE=gcc
.if thinks CXX is still clang




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