<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/6207c409f4c81e8620f8d178ae99297e5d826062">https://github.com/macports/macports-ports/commit/6207c409f4c81e8620f8d178ae99297e5d826062</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 6207c409f4c81e8620f8d178ae99297e5d826062
</span>Author: Fred Wright <fw@fwright.net>
AuthorDate: Mon Feb 19 19:39:18 2024 -0800
<span style='display:block; white-space:pre;color:#404040;'> legacy-support: Fix universal build on 11.x
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> On macOS 11, optool is used to construct the LegacySupportSystem
</span><span style='display:block; white-space:pre;color:#404040;'> library, but that doesn't work on arm64. Prior to this fix, the
</span><span style='display:block; white-space:pre;color:#404040;'> decision to use it was based on build_arch, which is problematic for
</span><span style='display:block; white-space:pre;color:#404040;'> universal builds in two ways:
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> 1) Universal builds on x86_64 didn't work at all, due to attempting to
</span><span style='display:block; white-space:pre;color:#404040;'> apply optool to the arm64 slice.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> 2) Universal builds on arm64 failed to apply optool to the x86_64
</span><span style='display:block; white-space:pre;color:#404040;'> slice.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This reworks the logic to base the optool dependency on whether any
</span><span style='display:block; white-space:pre;color:#404040;'> non-arm64 slice will be built, and to base the decision to use it
</span><span style='display:block; white-space:pre;color:#404040;'> on the architecture of each individual slice. It does not fix the
</span><span style='display:block; white-space:pre;color:#404040;'> problem where LegacySupportSystem is missing on arm64 -universal,
</span><span style='display:block; white-space:pre;color:#404040;'> and lacks the arm64 slice on +universal.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> In principle, this should get a revbump due to the change in the
</span><span style='display:block; white-space:pre;color:#404040;'> installed content in the arm64 +universal case. But since
</span><span style='display:block; white-space:pre;color:#404040;'> legacy-support isn't even applicable to 11.x, that doesn't seem worth
</span><span style='display:block; white-space:pre;color:#404040;'> the unnecessary churn.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> TESTED:
</span><span style='display:block; white-space:pre;color:#404040;'> Now builds successfully on 11.x x86_64 and arm64.
</span><span style='display:block; white-space:pre;color:#404040;'> Tested on 10.4-10.5 ppc, 10.4-10.6 i386, 10.4-12.x x86_64, 11.x-14.x
</span><span style='display:block; white-space:pre;color:#404040;'> arm64.
</span>---
devel/legacy-support/Portfile | 47 +++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 13 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/legacy-support/Portfile b/devel/legacy-support/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 56f02606bdf..18ee63116e1 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/devel/legacy-support/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/legacy-support/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -111,20 +111,41 @@ proc tiger_copy {from to} {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# The legacy-support build cannot create the LegacySupportSystem library directly
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# on newer systems as the reexport link option to /usr/lib/libSystem.B.dylib
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# does not work, due to the file system library cache added in macOS11.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-# Fallback to using optool here. Optool also currently not working on arm.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-if { ${build_arch} ne "arm64" && ${os.major} > ${max_darwin_reexport} && ${os.major} <= ${max_darwin_optool} } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- depends_build-append port:optool
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# The legacy-support build cannot create the LegacySupportSystem library
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# directly on newer systems as the reexport link option to
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# /usr/lib/libSystem.B.dylib does not work, due to the file system
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# library cache added in macOS11.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Fall back to using optool here. Optool does not currently work on arm64.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# This means that LegacySupportSystem will be missing on arm64, and that
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# universal builds of LegacySupportSystem will lack the arm64 slice
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# (which will produce a warning).
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if { ${os.major} > ${max_darwin_reexport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && ${os.major} <= ${max_darwin_optool} } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # First determine whether any non-arm64 slice will be built
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set optool_needed no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach arch ${muniversal.architectures} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { ${arch} ne "arm64"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set optool_needed yes
</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;'>+ # If any non-arm64, add optool dependency
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { ${optool_needed} } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_build-append port:optool
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_skip_archcheck-append optool
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # After destroot, apply optool to any non-arm64 slice
</span> post-destroot {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set legSupp ${prefix}/lib/libMacportsLegacySupport.dylib
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set legSystem ${prefix}/lib/libMacportsLegacySystem.B.dylib
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![file exists ${destroot}${legSystem}]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- copy ${destroot}${legSupp} ${destroot}${legSystem}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system "${prefix}/bin/optool install -c reexport -p /usr/lib/libSystem.B.dylib -t ${destroot}${legSystem}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "${destroot}${legSystem} already exists."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { ${muniversal.build_arch} ne "arm64" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set legSupp ${prefix}/lib/libMacportsLegacySupport.dylib
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set legSystem ${prefix}/lib/libMacportsLegacySystem.B.dylib
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${destroot}${legSystem}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ copy ${destroot}${legSupp} ${destroot}${legSystem}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system "${prefix}/bin/optool install -c reexport -p /usr/lib/libSystem.B.dylib -t ${destroot}${legSystem}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "${destroot}${legSystem} already exists."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
}
}
</pre><pre style='margin:0'>
</pre>