Skip to content

Commit

Permalink
python pg: don't force use of compiler_wrapper
Browse files Browse the repository at this point in the history
Support is kept; the minority of ports that actually need
compiler_wrapper just need to include it explicitly.
  • Loading branch information
jmroot committed Jun 21, 2022
1 parent 19265f0 commit 5ef529c
Showing 1 changed file with 28 additions and 15 deletions.
43 changes: 28 additions & 15 deletions _resources/port1.0/group/python-1.0.tcl
Expand Up @@ -24,8 +24,6 @@
#
# Note: setting these options requires name to be set beforehand

PortGroup compiler_wrapper 1.0

categories python

use_configure no
Expand Down Expand Up @@ -94,17 +92,6 @@ proc python_get_default_version {} {
}
}

proc python_set_env_compilers {phase} {
if {[option supported_archs] eq "noarch"} {
return
}
foreach tag [option compwrap.compilers_to_wrap] {
if {[option configure.${tag}] ne ""} {
${phase}.env-append [string toupper $tag]=[compwrap::wrap_compiler ${tag}]
}
}
}

proc python_set_versions {option action args} {
if {$action ne "set"} {
return
Expand Down Expand Up @@ -193,7 +180,20 @@ proc python_set_versions {option action args} {
build.env-append OBJCFLAGS=$pyobjcflags
}
if {${python.set_compiler}} {
python_set_env_compilers build
# compiler_wrapper portgroup support
if {[exists compwrap.compilers_to_wrap]} {
foreach var [option compwrap.compilers_to_wrap] {
if {[set configure.${var}] ne ""} {
build.env-append [string toupper $var]=[compwrap::wrap_compiler ${var}]
}
}
} else {
foreach var [list cc objc cxx fc f77 f90] {
if {[set configure.${var}] ne ""} {
build.env-append [string toupper $var]=[set configure.${var}]
}
}
}
}
}
pre-destroot {
Expand Down Expand Up @@ -240,7 +240,20 @@ proc python_set_versions {option action args} {
destroot.env-append OBJCFLAGS=$pyobjcflags
}
if {${python.set_compiler} && ${python.consistent_destroot}} {
python_set_env_compilers destroot
# compiler_wrapper portgroup support
if {[exists compwrap.compilers_to_wrap]} {
foreach var [option compwrap.compilers_to_wrap] {
if {[set configure.${var}] ne ""} {
destroot.env-append [string toupper $var]=[compwrap::wrap_compiler ${var}]
}
}
} else {
foreach var [list cc objc cxx fc f77 f90] {
if {[set configure.${var}] ne ""} {
destroot.env-append [string toupper $var]=[set configure.${var}]
}
}
}
}
}
post-destroot {
Expand Down

2 comments on commit 5ef529c

@mascguy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmroot / @cjones051073: With this change, how does one definitively know whether a Python port needs compiler wrapper support?

In the case of py-grpcio-tools, it's immediately obvious: Since that subport sets compwrap.add_compiler_flags no, the portfile won't parse without the addition. (Per commit: 5649375)

But what about for other cases...?

@ryandesign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.