<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/08e24f673f346e5274de9908f26e4ce62a5ff009">https://github.com/macports/macports-ports/commit/08e24f673f346e5274de9908f26e4ce62a5ff009</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 08e24f673f346e5274de9908f26e4ce62a5ff009
</span>Author: Chris Jones <jonesc@macports.org>
AuthorDate: Sun May 2 09:30:57 2021 +0100
<span style='display:block; white-space:pre;color:#404040;'> python PG: Support building with ccache
</span>---
_resources/port1.0/group/python-1.0.tcl | 99 ++++++++++++++++++++++++++-------
1 file changed, 80 insertions(+), 19 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/_resources/port1.0/group/python-1.0.tcl b/_resources/port1.0/group/python-1.0.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 1f40c668f73..5d42be494c2 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/_resources/port1.0/group/python-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/_resources/port1.0/group/python-1.0.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -20,6 +20,7 @@
</span> categories python
use_configure no
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # we want the default universal variant added despite not using configure
universal_variant yes
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -56,9 +57,9 @@ default distname {${python.rootname}-${version}}
</span> options python.versions python.version python.default_version
option_proc python.versions python_set_versions
default python.default_version {[python_get_default_version]}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-default python.version {[python_get_version]}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+default python.version {[python_get_version]}
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# see #34562
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# see https://trac.macports.org/ticket/34562
</span> options python.consistent_destroot
default python.consistent_destroot yes
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -84,15 +85,83 @@ proc python_get_default_version {} {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-proc python_get_compiler_command { var } {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- global configure.${var} configure.ccache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc python_get_compiler_tags {} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return {cc objc cxx objcxx fc f77 f90}
</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;'>+proc python_set_env_compilers { phase } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach tag [python_get_compiler_tags] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global configure.${tag}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[set configure.${tag}] ne ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${phase}.env-append [string toupper $tag]=[python_get_compiler_command ${tag}]
</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;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc python_compilerwrap_dir { } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global workpath
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ${workpath}/compilerwrap/bin
</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;'>+# Configure support for ccache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc python_configure_ccache { } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global prefix
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[option configure.ccache] && [file exists ${prefix}/bin/ccache]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Set some cmake env vars incase build uses cmake
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach tag [python_get_compiler_tags] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ switch ${tag} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fc {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ctag Fortran
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ f77 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ctag Fortran
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ f90 {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ctag Fortran
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ default {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ctag [string toupper $tag]
</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;'>+ foreach phase {configure build destroot} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${phase}.env-append CMAKE_${ctag}_COMPILER_LAUNCHER=${prefix}/bin/ccache
</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;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+port::register_callback python_configure_ccache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc python_create_compiler_wrap { tag } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global prefix configure.${tag}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp [set configure.${tag}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { ${comp} ne "" && [file exists ${prefix}/bin/ccache] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set wrapdir [python_compilerwrap_dir]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { ![file exists ${wrapdir}] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 755 -d ${wrapdir}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set fname ${wrapdir}/[file tail ${comp}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if { [file exists ${fname}] } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Recreate in case underlying compiler has changed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete ${fname}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "Creating compiler wrapper ${fname}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set f [ open ${fname} w 0755 ]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${f} "#!/bin/bash"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts ${f} "exec ${prefix}/bin/ccache ${comp} \"\$\{\@\}\""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ${fname}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ${comp}
</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;'>+proc python_get_compiler_command { tag } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ global configure.${tag} configure.ccache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp [set configure.${tag}]
</span> if { [option configure.ccache] } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Supporting ccache is WIP for now as some build systems have issues with it ...
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #return "ccache [set configure.${var}]"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [set configure.${var}]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return [set configure.${var}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set comp [ python_create_compiler_wrap ${tag} ]
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "For compiler tag=${tag} using ${comp}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return ${comp}
</span> }
proc python_set_versions {option action args} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -183,11 +252,7 @@ proc python_set_versions {option action args} {
</span> build.env-append OBJCFLAGS=$pyobjcflags
}
if {${python.set_compiler}} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach var {cc objc cxx fc f77 f90} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[set configure.${var}] ne ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- build.env-append [string toupper $var]=[python_get_compiler_command ${var}]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ python_set_env_compilers build
</span> }
}
pre-destroot {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -234,11 +299,7 @@ proc python_set_versions {option action args} {
</span> destroot.env-append OBJCFLAGS=$pyobjcflags
}
if {${python.set_compiler} && ${python.consistent_destroot}} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach var {cc objc cxx fc f77 f90} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[set configure.${var}] ne ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- destroot.env-append [string toupper $var]=[python_get_compiler_command ${var}]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ python_set_env_compilers destroot
</span> }
}
post-destroot {
</pre><pre style='margin:0'>
</pre>