<pre style='margin:0'>
MarcusCalhoun-Lopez pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/a83b4a2e662f9885d6335ca6b7315c0007bfe111">https://github.com/macports/macports-ports/commit/a83b4a2e662f9885d6335ca6b7315c0007bfe111</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit a83b4a2e662f9885d6335ca6b7315c0007bfe111
</span>Author: Marcus Calhoun-Lopez <mcalhoun@macports.org>
AuthorDate: Fri Feb 3 05:51:44 2017 -0700
<span style='display:block; white-space:pre;color:#404040;'> llvm-3.9: allow clang to use MacPorts libstdc++
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> See https://trac.macports.org/ticket/53194
</span>---
lang/llvm-3.9/Portfile | 16 +++
lang/llvm-3.9/files/9001-macports-libstdcxx.diff | 125 +++++++++++++++++++++++
2 files changed, 141 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-3.9/Portfile b/lang/llvm-3.9/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index c0871d7..a5ce981 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/lang/llvm-3.9/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-3.9/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -431,6 +431,22 @@ if {${subport} eq "llvm-${llvm_version}"} {
</span> }
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant libstdcxx description {-stdlib=macports-libstdc++ searches for MacPorts libstdc++} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append port:gcc6
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append 9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-patch {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@@MACPORTS_GCC_INCLUDE_DIR@@|${prefix}/include/gcc6/c++|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@@MACPORTS_HOST_NAME@@|${build_arch}-apple-darwin${os.major}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace "s|@@MACPORTS_libstdc++@@|${prefix}/lib/libgcc/libstdc++.6.dylib|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${worksrcpath}/tools/clang/lib/Driver/ToolChains.cpp
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #default_variants +libstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> post-patch {
reinplace "s|@@PREFIX@@|${prefix}|" \
${worksrcpath}/tools/clang/lib/Driver/Tools.cpp
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/lang/llvm-3.9/files/9001-macports-libstdcxx.diff b/lang/llvm-3.9/files/9001-macports-libstdcxx.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..9651ec2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/lang/llvm-3.9/files/9001-macports-libstdcxx.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,125 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/include/clang/Lex/HeaderSearchOptions.h 2015-11-17 23:54:13.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/include/clang/Lex/HeaderSearchOptions.h 2017-01-04 17:50:27.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -158,6 +158,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /// Use libc++ instead of the default libstdc++.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ unsigned UseLibcxx : 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /// Use MacPorts libstdc++ instead of default system libstdc++.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ unsigned UseMacPortsLibstdcxx : 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /// Whether header search information should be output as for -v.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ unsigned Verbose : 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/CompilerInvocation.cpp 2016-07-13 15:32:15.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/CompilerInvocation.cpp 2017-01-04 17:52:18.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -1355,8 +1355,10 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Opts.UseMacPortsLibstdcxx = (strcmp(A->getValue(), "macports-libstdc++") == 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Frontend/InitHeaderSearch.cpp 2016-05-16 10:22:25.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Frontend/InitHeaderSearch.cpp 2017-01-04 18:04:43.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -109,7 +109,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(LLVM_ON_WIN32)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- return llvm::sys::path::is_absolute(Path);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return llvm::sys::path::is_absolute(Path) && Path.find("@@MACPORTS_GCC_INCLUDE_DIR@@")!=0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -362,20 +362,31 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case llvm::Triple::ppc:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case llvm::Triple::ppc64:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "@@MACPORTS_HOST_NAME@@", "", "ppc64",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "powerpc-apple-darwin10", "", "ppc64",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "powerpc-apple-darwin8", "", "ppc64",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case llvm::Triple::x86:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case llvm::Triple::x86_64:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (HSOpts.UseMacPortsLibstdcxx) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ AddGnuCPlusPlusIncludePaths("@@MACPORTS_GCC_INCLUDE_DIR@@",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ "@@MACPORTS_HOST_NAME@@", "i386", "", triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "i686-apple-darwin10", "", "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "i686-apple-darwin8", "", "x86_64", triple);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case llvm::Triple::arm:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/include/clang/Driver/ToolChain.h 2016-06-16 03:36:09.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/include/clang/Driver/ToolChain.h 2017-01-04 18:08:42.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -51,7 +51,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ enum CXXStdlibType {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ CST_Libcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- CST_Libstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ CST_Libstdcxx,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ CST_MacPortsLibstdcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ enum RuntimeLibType {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChains.cpp 2016-11-23 14:25:50.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChains.cpp 2017-01-04 20:52:25.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -773,6 +773,13 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ // Otherwise, let the linker search.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (getVFS().exists("@@MACPORTS_libstdc++@@")) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ CmdArgs.push_back("@@MACPORTS_libstdc++@@");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -3015,6 +3022,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ StringRef Value = A->getValue();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (Value == "macports-libstdc++" )
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (Value != "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- orig/tools/clang/lib/Driver/ToolChain.cpp 2016-07-15 16:13:27.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ new/tools/clang/lib/Driver/ToolChain.cpp 2017-01-05 08:14:23.000000000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -545,6 +545,8 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Type = ToolChain::CST_Libcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else if (Name == "libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Type = ToolChain::CST_Libstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ else if (Name == "macports-libstdc++")
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ Type = ToolChain::CST_MacPortsLibstdcxx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return false;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -640,6 +642,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case ToolChain::CST_Libstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ case ToolChain::CST_MacPortsLibstdcxx:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ CmdArgs.push_back("-lstdc++");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ break;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span></pre><pre style='margin:0'>
</pre>