[MacPorts] #56280: cxx11 1.1 portgroup unexpected restriction on portfile ability to override configure.optflags

MacPorts noreply at macports.org
Thu Apr 12 18:10:03 UTC 2018


#56280: cxx11 1.1 portgroup unexpected restriction on portfile ability to override
configure.optflags
------------------------+--------------------
 Reporter:  ryandesign  |      Owner:  (none)
     Type:  defect      |     Status:  new
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:
 Keywords:              |       Port:
------------------------+--------------------
 Portfile authors expect to be able to override `configure.optflags` in
 their ports, such as:

 {{{
 configure.optflags -O3
 }}}

 `configure.optflags` is part of the default values of other options like
 `configure.cflags`, `configure.cxxflags`, `configure.objcflags`, and
 `configure.objcxxflags`. MacPorts evaluates options lazily, so any other
 options referenced within the default values of `configure.cflags`,
 `configure.cxxflags`, `configure.objcflags`, and `configure.objcxxflags`
 aren't evaluated until the first time they're used.

 An unexpected problem occurs if the port includes the cxx11 1.1 portgroup,
 because on OS X 10.8 and earlier when using libstdc++, the portgroup
 accesses `configure.cxxflags` and `configure.objcxxflags`. This causes the
 lazy evaluation to occur at that moment, and the value of
 `configure.optflags` at that moment is what ends up in those options. It
 is customary to include portgroups at the top of a portfile, and it is
 customary to set configure-phase options near the middle or bottom of the
 portfile, after fetch-, extract- and patch-phase options, and after the
 options that define the port name, version, descriptions, distfiles,
 checksums, and so forth. If a portfile author follows these customs, the
 cxx11 1.1 portgroup would have been included before the value of
 `configure.optflags` was changed, and the result is that the new
 optimization flags only take effect for non-C++ code since the C++ flag
 variables have already been evaluated by the portgroup.

 Maybe the portgroup can be changed so that this problem does not occur.

 Until then, a workaround the portfile author can use is to change
 `configure.optflags` before including the cxx11 1.1 portgroup.

-- 
Ticket URL: <https://trac.macports.org/ticket/56280>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list