testing the value of ${CXX} in ports Makefile
Don Lewis
truckman at FreeBSD.org
Sun Feb 1 22:38:02 UTC 2015
On 31 Jan, Jan Beich wrote:
> Don Lewis <truckman at FreeBSD.org> writes:
>
>> PORTNAME= junk
>> PORTVERSION= 0.0.0
>> CATEGORIES= devel
>> DISTFILES=
>>
>> MAINTAINER= truckman at 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 at 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
More information about the freebsd-ports
mailing list