source: trunk/dports/_resources/port1.0/group/cxx11-1.0.tcl @ 135656

Last change on this file since 135656 was 135656, checked in by ionic@…, 4 years ago

cxx11-1.0: new PortGroup.

File size: 3.0 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3#
4# Copyright (c) 2015 The MacPorts Project
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are
9# met:
10#
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16# 3. Neither the name of The MacPorts Project nor the names of its
17#    contributors may be used to endorse or promote products derived from
18#    this software without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31#
32#
33# This PortGroup implements the "cxx11" option, which lets ports
34# specify that they require C++11 support.
35# We only support C++11 with libc++.
36#
37# Ideally the cxx11 option should be integrated into MacPorts base
38# instead of being a PortGroup.
39
40PortGroup compiler_blacklist_versions 1.0
41
42# Compilers supporting C++11 are GCC >= 4.6 and clang >= 3.3.
43# As we only support libc++, clang is implicitly required.
44# Blacklist all GCC compilers to not accidentally pull in libstdc++.
45# We do not know what "cc" is, so blacklist it as well.
46compiler.blacklist-append   {*gcc*} {clang < 500} macports-clang-2.* \
47                            {macports-clang-3.[0-2]} cc
48
49pre-configure {
50    if {${configure.cxx_stdlib} eq "libstdc++"} {
51        ui_error "${subport} does not support your selected MacPorts C++ runtime. libc++ must be selected and C++-based ports built against it."
52
53        if {${os.major} < 13} {
54            ui_error "Please follow the instructions on https://trac.macports.org/wiki/LibcxxOnOlderSystems."
55            ui_error "After adding the required options to macports.conf, essentially reinstall all ports like you would when switching OS X versions."
56            ui_error "Follow step 3 on https://trac.macports.org/wiki/Migration in order to do this."
57        }
58
59        return -code error "libstdc++ unsupported."
60    }
61}
Note: See TracBrowser for help on using the repository browser.