<pre style='margin:0'>
Chris Jones (cjones051073) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/f76ca803ce749b68f83aebe6cd4abf6b0c0a87bd">https://github.com/macports/macports-ports/commit/f76ca803ce749b68f83aebe6cd4abf6b0c0a87bd</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new f76ca803ce7 {lib}gcc-devel: Enable -stdlib option to support libc++ runtime
</span>f76ca803ce7 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit f76ca803ce749b68f83aebe6cd4abf6b0c0a87bd
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Thu Jan 6 16:13:17 2022 +0000
<span style='display:block; white-space:pre;color:#404040;'> {lib}gcc-devel: Enable -stdlib option to support libc++ runtime
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Upstream have commited to their development branch support for
</span><span style='display:block; white-space:pre;color:#404040;'> using the (LLVM) libc++ runtime via the '-stdlib=libc++' compiler flag.
</span><span style='display:block; white-space:pre;color:#404040;'> Support for this new flag is disabled by default, so this commit enables
</span><span style='display:block; white-space:pre;color:#404040;'> this flag in the {lib}gcc-devel builds.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> To enable the option the path to the libc++ includes needs to be given
</span><span style='display:block; white-space:pre;color:#404040;'> when building GCC. The build does this based on the path to the SDKROOT
</span><span style='display:block; white-space:pre;color:#404040;'> the build is configured to use. If the user of the port also has the same
</span><span style='display:block; white-space:pre;color:#404040;'> SDK installed then they simply need to use the new option to enable
</span><span style='display:block; white-space:pre;color:#404040;'> building against libc++
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> > g++-mp-devel -isystem -stdlib=libc++ ./test.cpp
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> However, it is possible that this is not the case (e.g. if the port build
</span><span style='display:block; white-space:pre;color:#404040;'> used the Xcode SDK and the port user only has the CLT installed) in which
</span><span style='display:block; white-space:pre;color:#404040;'> case the required path can be passed via -isystem
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> > g++-mp-devel -isystem `xcrun --show-sdk-path`/usr/include/c++/v1 -stdlib=libc++ ./test.cpp
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This is very much an experimental new feature, so use with care, but appears
</span><span style='display:block; white-space:pre;color:#404040;'> to work fine in some basic checks. It also should open the path to allow using
</span><span style='display:block; white-space:pre;color:#404040;'> the next GCC release, 12, as a fallback c++ compiler within MacPorts, as it
</span><span style='display:block; white-space:pre;color:#404040;'> solves the issue preventing this, namely mixing the libc++ and libstdc++ runtimes.
</span>---
lang/gcc-devel/Portfile | 49 ++++++++++++++++++++++++++++++++-----------------
1 file changed, 32 insertions(+), 17 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/gcc-devel/Portfile b/lang/gcc-devel/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 58e8ae9afa1..43840ad532e 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/gcc-devel/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/gcc-devel/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -34,24 +34,19 @@ if {${os.arch} eq "arm"} {
</span>
# Version must follow same scheme as with GCC snapshots below <version>-<commit-date>
version 12-20220101
<span style='display:block; white-space:pre;background:#ffe0e0;'>- revision 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- subport libgcc-devel { revision 0 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ revision 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ subport libgcc-devel { revision 1 }
</span>
checksums rmd160 4d99969933d18d83d83230a9d457063f63ab9fc6 \
sha256 5af0924e0bf246c4e1bcbee5a313634a345589c38c6c65490e3144b8aa91b8ed \
size 129376822
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Intermittent parallel build failures have been reported only on arm64 so far.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # fatal error: libgcc_tm.h: No such file or directory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # https://github.com/iains/gcc-darwin-arm64/issues/61
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # use_parallel_build no
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> } else {
# Use regular GCC releases and snapshsots
version 12-20220102
<span style='display:block; white-space:pre;background:#ffe0e0;'>- revision 0
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- subport libgcc-devel { revision 0 }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ revision 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ subport libgcc-devel { revision 1 }
</span>
checksums rmd160 029c235ab8a852d2b0e1c014ad0d442b37d9a39a \
sha256 d2c7e42ab6cb96e40e99a5995d713e093cf20bf7da980f48f6db8c541ed78fa4 \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -112,6 +107,12 @@ if {${subport} eq ${name}} {
</span> lappend gcc_configure_langs jit
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc get_clean_sysroot {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global configure.sdkroot
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # if the sdkroot is one of the current, rapidly changing SDKS, use the generic one
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return [regsub {MacOSX1[1-9]\.[0-9]+\.sdk} ${configure.sdkroot} {MacOSX.sdk}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> configure.dir ${workpath}/build
configure.cmd ${worksrcpath}/configure
configure.args --enable-languages=[join ${gcc_configure_langs} ","] \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -140,11 +141,12 @@ configure.args --enable-languages=[join ${gcc_configure_langs} ","] \
</span> --with-bugurl=https://trac.macports.org/newticket \
--enable-host-shared
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# see https://lists.macports.org/pipermail/macports-dev/2017-August/036209.html
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# --disable-tls does not limit functionality
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# it only determines how std::call_once works
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-configure.args-append \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- --disable-tls
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if { ${os.major} < 15 } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # see https://lists.macports.org/pipermail/macports-dev/2017-August/036209.html
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # --disable-tls does not limit functionality
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # it only determines how std::call_once works
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --disable-tls
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span>
# Disable ccache
configure.ccache no
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -193,11 +195,24 @@ pre-configure {
</span> #
# https://trac.macports.org/ticket/53726
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # if the sdkroot is one of the current, rapidly changing SDKS, use the generic one
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- configure.args-append --with-sysroot="[regsub {MacOSX1[1-9]\.[0-9]+\.sdk} ${configure.sdkroot} {MacOSX.sdk}]"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-sysroot="[get_clean_sysroot]"
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Enables support for specifying the c++ runtime via `-stdlib=` in a similar
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # way to clang. For more details see the later comments in
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg257385.html
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.args-append --with-gxx-libcxx-include-dir="[get_clean_sysroot]/usr/include/c++/v1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Note : The above 'bakes' the libc++ include directory for the build SDK into
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # gcc, which is then used as the default search location when `-stdlib=libc++`
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # is given. As it is possible that this path is not the same as the SDK/CLT the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # user of GCC wishes to use, it is probably better to not rely on this and specify
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # the required path using `-isystem /path/to/SDK/usr/include/c++/v1` at build time.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # This can be done dynamically with xcrun e.g.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # > g++-mp-devel -isystem `xcrun --show-sdk-path`/usr/include/c++/v1 -stdlib=libc++ ./test.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # It would be nice if GCC internalled used the $SDKROOT environment variable, to do
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # this automatically, as it does for other parts of the SDK, but this is currently at least
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # not the case.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> }
# https://trac.macports.org/ticket/29067
</pre><pre style='margin:0'>
</pre>