<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/d112b92d1d7fb2eacc627a673ed8e422447028c1">https://github.com/macports/macports-ports/commit/d112b92d1d7fb2eacc627a673ed8e422447028c1</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit d112b92d1d7fb2eacc627a673ed8e422447028c1
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Fri Jun 11 11:14:06 2021 +0100

<span style='display:block; white-space:pre;color:#404040;'>    legacysupport PG: Add a flag to enable using macports-libcxx if required
</span>---
 _resources/port1.0/group/legacysupport-1.1.tcl | 76 +++++++++++++++++++-------
 1 file changed, 56 insertions(+), 20 deletions(-)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/legacysupport-1.1.tcl b/_resources/port1.0/group/legacysupport-1.1.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 1a15c967d36..55a7fc45781 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/_resources/port1.0/group/legacysupport-1.1.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/_resources/port1.0/group/legacysupport-1.1.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -10,14 +10,12 @@
</span> #
 #   legacysupport.newest_darwin_requires_legacy: newest Darwin version that requires legacy support
 #
<span style='display:block; white-space:pre;background:#ffe0e0;'>-#   legacysupport.header_search: preprocessor flag used to locate header directory
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#   legacysupport.library_name: linker flag used to add library
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-#
</span> #   legacysupport.use_static: allow static linking of legacysupport if preferred (e.g. for compilers)
 #
 #   legacysupport.redirect_bins: binary files that mix different versions of libstdc++
 #                                create a wrapper so that only MacPorts libstdc++ is used
<span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#   legacysupport.use_mp_libcxx: Use an update libcxx runtime from a recent macports clang build
</span> 
 namespace eval legacysupport {
 }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -28,18 +26,15 @@ set ls_max_darwin_support 16
</span> options legacysupport.newest_darwin_requires_legacy
 default legacysupport.newest_darwin_requires_legacy ${ls_max_darwin_support}
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-options legacysupport.header_search
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-default legacysupport.header_search     {-isystem${prefix}/include/LegacySupport}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-options legacysupport.library_name
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-default legacysupport.library_name      {[legacysupport::get_library_name]}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> options legacysupport.use_static
 default legacysupport.use_static        no
 
 options legacysupport.redirect_bins
 default legacysupport.redirect_bins     {}
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+options legacysupport.use_mp_libcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default legacysupport.use_mp_libcxx     no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> if {[info exists makefile.override]} {
     pre-configure {
         ui_error "The legacysupport PG must be included *before* the makefile PG"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -58,9 +53,9 @@ proc legacysupport::get_library_name {} {
</span> }
 
 proc legacysupport::get_cpp_flags {} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    global os.platform os.major
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    global os.platform os.major prefix
</span>     if {${os.platform} eq "darwin" && ${os.major} <= [option legacysupport.newest_darwin_requires_legacy]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        return [option legacysupport.header_search]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        return -isystem${prefix}/include/LegacySupport
</span>     } else {
         return ""
     }
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -120,6 +115,12 @@ proc legacysupport::set_phase_env_var { var } {
</span>     }
 }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+proc legacysupport::remove_phase_env_var { var } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    foreach phase { extract configure build destroot test } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        ${phase}.env-delete ${var}
</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> proc legacysupport::set_label_environment_vars { } {
     global os.platform os.major
     set env_name MACPORTS_LEGACY_SUPPORT_DISABLED
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -129,30 +130,58 @@ proc legacysupport::set_label_environment_vars { } {
</span>     legacysupport::set_phase_env_var ${env_name}=1
 }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+set ls_cache_incpath  [list]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set ls_cache_ldflags  [list]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set ls_cache_cppflags [list]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> proc legacysupport::add_legacysupport {} {
     global prefix os.platform os.major
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    global ls_cache_incpath ls_cache_ldflags ls_cache_cppflags
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if { ${os.platform} eq "darwin" && ${os.major} <= [option legacysupport.newest_darwin_requires_legacy] } {
</span> 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {${os.platform} eq "darwin" && ${os.major} <= [option legacysupport.newest_darwin_requires_legacy]} {
</span>         ui_debug "Adding legacy build support"
 
         # depend on the support library or devel version if installed
         legacysupport::add_once [legacysupport::get_depends_type] append [legacysupport::get_dependency]
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        # Add the library link flags
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        legacysupport::add_once configure.ldflags append [option legacysupport.library_name]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        legacysupport::set_phase_env_var MACPORTS_LEGACY_SUPPORT_LDFLAGS=[legacysupport::get_library_link_flags]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # First clean out any old settings
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        if { ${ls_cache_incpath} ne "" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            foreach f ${ls_cache_ldflags}  { configure.ldflags-delete ${f} }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            foreach f ${ls_cache_cppflags} { configure.cppflags-delete ${f} }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            foreach lang {C OBJC CPLUS OBJCPLUS} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                legacysupport::remove_phase_env_var ${lang}_INCLUDE_PATH=[string map {" " ":"} ${ls_cache_incpath}]
</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;'>+        # Add flags for legacy-support library
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set ls_cache_incpath  [list "${prefix}/include/LegacySupport"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set ls_cache_ldflags  [list "[legacysupport::get_library_link_flags]"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set ls_cache_cppflags [list "[legacysupport::get_cpp_flags]"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Flags for using MP libcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        if { [option legacysupport.use_mp_libcxx] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            legacysupport::add_once depends_lib append port:macports-libcxx
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            append ls_cache_incpath  " ${prefix}/include/libcxx"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            append ls_cache_ldflags  " -L${prefix}/lib/libcxx"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            append ls_cache_cppflags " -isystem${prefix}/include/libcxx"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        }
</span> 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Add the flags
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        foreach f ${ls_cache_ldflags} { legacysupport::add_once configure.ldflags append ${f} }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        legacysupport::set_phase_env_var MACPORTS_LEGACY_SUPPORT_LDFLAGS=${ls_cache_ldflags}
</span>         if {![option compiler.limit_flags]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            legacysupport::add_once configure.cppflags prepend [option legacysupport.header_search]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-            legacysupport::set_phase_env_var MACPORTS_LEGACY_SUPPORT_CPPFLAGS=[option legacysupport.header_search]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            foreach f ${ls_cache_cppflags} { legacysupport::add_once configure.cppflags prepend ${f} }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            legacysupport::set_phase_env_var MACPORTS_LEGACY_SUPPORT_CPPFLAGS=${ls_cache_cppflags}
</span>         }
 
         # do not use compiler.cpath since it behaves like -I, while ${lang}_INCLUDE_PATH behaves like -isystem
         # since legacy-support uses GNU language extensions, this prevents warnings when `-pedantic` is
         # used and error when `-pedantic-errors` is used. see, e.g., llvm-devel
         foreach lang {C OBJC CPLUS OBJCPLUS} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            legacysupport::set_phase_env_var ${lang}_INCLUDE_PATH=${prefix}/include/LegacySupport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            legacysupport::set_phase_env_var ${lang}_INCLUDE_PATH=[string map {" " ":"} ${ls_cache_incpath}]
</span>         }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>     }
 
     # Sets some indicator env vars to see if support is ENABLED or DISABLED.
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -165,16 +194,23 @@ proc legacysupport::add_legacysupport {} {
</span>             legacysupport::add_once ${phase}.env append DYLD_LIBRARY_PATH=${prefix}/lib/libgcc
         }
     }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# Call first as soon as PG is included
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+legacysupport::add_legacysupport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# and again as callback after port is parsed
</span> port::register_callback legacysupport::add_legacysupport
 
 proc legacysupport::legacysupport_proc {option action args} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {$action ne  "set"} return
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {$action ne "set"} return
</span>     legacysupport::add_legacysupport
 }
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# Reconfigure if any options are explicitly set
</span> option_proc legacysupport.newest_darwin_requires_legacy legacysupport::legacysupport_proc
<span style='display:block; white-space:pre;background:#e0ffe0;'>+option_proc legacysupport.legacysupport.use_mp_libcxx   legacysupport::legacysupport_proc
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+option_proc legacysupport.legacysupport.use_static      legacysupport::legacysupport_proc
</span> 
 # see https://trac.macports.org/ticket/59832
 post-destroot {
</pre><pre style='margin:0'>

</pre>