mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-21 00:25:50 +00:00
New USES=compiler
Supported arguments are: - c++11-lang: the port needs a c++11 aware compiler what ever standard library it uses, implies features - c++11-lib: the port needs a c++11 standard library, implies features - c11: the ports needs a c11 aware compiler implies features - features: this will create a COMPILER_FEATURES variable which contains the list of features ${CC} do support, implies env. - env: the COMPILER_TYPE will be set to either gcc or clang. By default the uses will try to use clang33 from ports when nothing in base is relevant except if the user explicitly defines FAVORITE_COMPILER=gcc in his make.conf Please note that testing tinderbox prior to version: 4.0.1_1 is not able to properly figure out the dependencies implied by this USES.
This commit is contained in:
parent
02a34ce656
commit
91bfd4296d
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=329823
18
CHANGES
18
CHANGES
@ -10,6 +10,24 @@ in the release notes and/or placed into UPDATING.
|
||||
|
||||
All ports committers are allowed to commit to this file.
|
||||
|
||||
20131008:
|
||||
AUTHOR: bapt@FreeBSD.org
|
||||
|
||||
New "compiler" USES to be able to select the compiler based on the
|
||||
features it provides.
|
||||
Supported arguments are:
|
||||
- c++11-lang: the port needs a c++11 aware compiler what ever standard
|
||||
library it uses, implies features
|
||||
- c++11-lib: the port needs a c++11 standard library, implies features
|
||||
- c11: the ports needs a c11 aware compiler implies features
|
||||
- features: this will create a COMPILER_FEATURES variable which contains
|
||||
the list of features ${CC} do support, implies env.
|
||||
- env: the COMPILER_TYPE will be set to either gcc or clang.
|
||||
|
||||
By default the uses will try to use clang33 from ports when nothing in
|
||||
base is relevant except if the user explicitly defines
|
||||
FAVORITE_COMPILER=gcc in his make.conf
|
||||
|
||||
20131008:
|
||||
AUTHOR: makc@FreeBSD.org
|
||||
|
||||
|
116
Mk/Uses/compiler.mk
Normal file
116
Mk/Uses/compiler.mk
Normal file
@ -0,0 +1,116 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
# Allows to feature determine the compiler used
|
||||
#
|
||||
# MAINTAINER: portmgr@FreeBSD.org
|
||||
#
|
||||
# Feature: compiler
|
||||
# Usage: USES=compiler or USES=compiler:ARGS
|
||||
# Valid ARGS: env (default, implicit) c++11-lib c++11-lang c11 features
|
||||
#
|
||||
# c++11-lang: The port need a compiler understanding C++11
|
||||
# c++11-lib: The port need a compiler understanding C++11 and with a C++11 ready standard library
|
||||
# c11: The port need a compiler understanding c11
|
||||
# features: The port will determine the features supported by the default compiler
|
||||
#
|
||||
# Variable to test after <bsd.port.pre.mk>
|
||||
#
|
||||
# COMPILER_TYPE: can be gcc or clang
|
||||
# COMPILER_VERSION: 2 first digit of the version: 33 for clang 3.3.*, 46 for gcc 4.6.*
|
||||
#
|
||||
# COMPILER_FEATURES: the list of features supported by the compiler include the standard C++ library.
|
||||
|
||||
.if !defined(_INCLUDE_USES_COMPILER_MK)
|
||||
_INCLUDE_USES_COMPILER_MK= yes
|
||||
|
||||
.if !defined(compiler_ARGS)
|
||||
compiler_ARGS= env
|
||||
.endif
|
||||
|
||||
VALID_ARGS= c++11-lib c++11-lang c11 features env
|
||||
|
||||
.if ${compiler_ARGS} == c++11-lib
|
||||
_COMPILER_ARGS+= features c++11-lib
|
||||
.elif ${compiler_ARGS} == c++11-lang
|
||||
_COMPILER_ARGS+= features c++11-lang
|
||||
.elif ${compiler_ARGS} == c11
|
||||
_COMPILER_ARGS+= features c11
|
||||
.elif ${compiler_ARGS} == features
|
||||
_COMPILER_ARGS+= features
|
||||
.elif ${compiler_ARGS} == env
|
||||
_COMPILER_ARGS+= env
|
||||
.else
|
||||
IGNORE= Invalid argument "${compiler_ARGS}", valid arguments are: ${VALID_ARGS}
|
||||
_COMPILER_ARGS= #
|
||||
.endif
|
||||
|
||||
.if ${_COMPILER_ARGS:Mc++11*} || ${_COMPILER_ARGS:Mc11}
|
||||
_COMPILER_ARGS+= features
|
||||
.endif
|
||||
|
||||
_CCVERSION!= ${CC} --version
|
||||
COMPILER_VERSION= ${_CCVERSION:M[0-9].[0-9]*:C/([0-9]).([0-9]).*/\1\2/g}
|
||||
.if ${_CCVERSION:Mclang}
|
||||
COMPILER_TYPE= clang
|
||||
.elif ${_CCVERSION:Mgcc*} || ${_CCVERSION:M\(GCC\)}
|
||||
COMPILER_TYPE= gcc
|
||||
.endif
|
||||
|
||||
.if ${_COMPILER_ARGS:Mfeatures}
|
||||
_CXXINTERNAL!= ${CXX} -\#\#\# /dev/null 2>&1
|
||||
.if ${_CXXINTERNAL:M\"-lc++\"}
|
||||
COMPILER_FEATURES= libc++
|
||||
.else
|
||||
COMPILER_FEATURES= libstdc++
|
||||
.endif
|
||||
|
||||
CSTD= c89 c99 c11 gnu89 gnu99 gnu11
|
||||
CXXSTD= c++98 c++11 gnu++98 gnu++11
|
||||
|
||||
.for std in ${CSTD} ${CXXSTD}
|
||||
_LANG=c
|
||||
.if ${CXXSTD:M${std}}
|
||||
_LANG=c++
|
||||
.endif
|
||||
OUTPUT_${std}!= echo | ${CC} -std=${std} -c -x ${_LANG} /dev/null -o /dev/null 2>&1; echo
|
||||
.if !${OUTPUT_${std}:M*error*}
|
||||
COMPILER_FEATURES+= ${std}
|
||||
.endif
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
.if ${_COMPILER_ARGS:Mc++11-lib}
|
||||
.if !${COMPILER_FEATURES:Mc++11-lang}
|
||||
USE_GCC= yes
|
||||
.elif ${COMPILER_TYPE} == clang && ${COMPILER_FEATURES:Mc++11-lib}
|
||||
USE_GCC= yes
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${_COMPILER_ARGS:Mc++11-lang}
|
||||
.if !${COMPILER_FEATURES:Mc++11}
|
||||
.if defined(FAVORITE_COMPILER) && ${FAVORITE_COMPILER} == gcc
|
||||
USE_GCC= yes
|
||||
.elif (${COMPILER_TYPE} == clang && ${COMPILER_VERSION} < 33) || ${COMPILER_TYPE} == gcc
|
||||
BUILD_DEPENDS+= ${LOCALBASE}/bin/clang33:${PORTSDIR}/lang/clang33
|
||||
CPP= ${LOCALBASE}/bin/clang-cpp33
|
||||
CC= ${LOCALBASE}/bin/clang33
|
||||
CXX= ${LOCALBASE}/bin/clang++33
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${_COMPILER_ARGS:Mc11}
|
||||
.if !${COMPILER_FEATURES:Mc11}
|
||||
.if defined(FAVORITE_COMPILER) && ${FAVORITE_COMPILER} == gcc
|
||||
USE_GCC= yes
|
||||
.elif (${COMPILER_TYPE} == clang && ${COMPILER_VERSION} < 33) || ${COMPILER_TYPE} == gcc
|
||||
BUILD_DEPENDS+= ${LOCALBASE}/bin/clang33:${PORTSDIR}/lang/clang33
|
||||
CPP= ${LOCALBASE}/bin/clang-cpp33
|
||||
CC= ${LOCALBASE}/bin/clang33
|
||||
CXX= ${LOCALBASE}/bin/clang++33
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.endif
|
10
UPDATING
10
UPDATING
@ -5,6 +5,16 @@ they are unavoidable.
|
||||
You should get into the habit of checking this file for changes each time
|
||||
you update your ports collection, before attempting any port upgrades.
|
||||
|
||||
20131008:
|
||||
AFFECT: all users
|
||||
AUTHOR: bapt@FreeBSD.org
|
||||
|
||||
A new USES has been added: compiler.mk, this uses allows porters to
|
||||
select a compiler for a given port based on the features the port needs
|
||||
By default this will always try to find clang > 3.3.
|
||||
If the user prefers using gcc then the following macro should be added
|
||||
to user's make.conf: FAVORITE_COMPILER=gcc
|
||||
|
||||
20131004:
|
||||
AFFECTS: users of net-mgmt/nrpe2
|
||||
AUTHOR: ohauer@FreeBSD.org
|
||||
|
Loading…
Reference in New Issue
Block a user