pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Add support to USE_LANGUAGES for C++ standards from...
details: https://anonhg.NetBSD.org/pkgsrc/rev/7ac2aef81b6d
branches: trunk
changeset: 362028:7ac2aef81b6d
user: jperkin <jperkin%pkgsrc.org@localhost>
date: Wed May 03 08:34:23 2017 +0000
description:
Add support to USE_LANGUAGES for C++ standards from c++0x to gnu++14.
This allows packages to specify the version of the standard that they
require, and the infrastructure then distils that down in a similar way
to GCC_REQD to the newest standard, avoiding clashes with different -std
requirements based on CXXFLAGS.
Broad concensus on tech-pkg and tested in bulk builds.
diffstat:
mk/compiler.mk | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diffs (45 lines):
diff -r 6b0a8e43d42d -r 7ac2aef81b6d mk/compiler.mk
--- a/mk/compiler.mk Wed May 03 08:24:57 2017 +0000
+++ b/mk/compiler.mk Wed May 03 08:34:23 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.83 2016/11/10 20:59:43 joerg Exp $
+# $NetBSD: compiler.mk,v 1.84 2017/05/03 08:34:23 jperkin Exp $
#
# This Makefile fragment implements handling for supported C/C++/Fortran
# compilers.
@@ -42,8 +42,9 @@
# USE_LANGUAGES
# Lists the languages used in the source code of the package,
# and is used to determine the correct compilers to install.
-# Valid values are: c, c99, c++, fortran, fortran77, java, objc,
-# obj-c++, and ada. The default is "c".
+# Valid values are: c, c99, c++, c++0x, gnu++0x, c++11, gnu++11,
+# c++14, gnu++14, fortran, fortran77, java, objc, obj-c++, and
+# ada. The default is "c".
#
# The following variables are defined, and available for testing in
# package Makefiles:
@@ -157,6 +158,23 @@
. endif
.endfor
+# Pass the compiler flag based on the most recent version of the C++ standard
+# required. We currently assume that each standard is a superset of all that
+# come after it.
+#
+# If and when the flags differ between compilers we can push this down into
+# the respective mk/compiler/*.mk files.
+#
+_CXX_VERSION_REQD=
+.for _version_ in gnu++14 c++14 gnu++11 c++11 gnu++0x c++0x
+. if empty(_CXX_VERSION_REQD) && !empty(USE_LANGUAGES:M${_version_})
+USE_LANGUAGES+= c++
+_CXX_VERSION_REQD= ${_version_}
+_WRAP_EXTRA_ARGS.CXX+= -std=${_CXX_VERSION_REQD}
+CWRAPPERS_PREPEND.cxx+= -std=${_CXX_VERSION_REQD}
+. endif
+.endfor
+
.if defined(ABI) && !empty(ABI)
_WRAP_EXTRA_ARGS.CC+= ${_COMPILER_ABI_FLAG.${ABI}}
_WRAP_EXTRA_ARGS.CXX+= ${_COMPILER_ABI_FLAG.${ABI}}
Home |
Main Index |
Thread Index |
Old Index