[MacPorts] #60403: lpcnetfreedv: incorrect optimization when building universal

MacPorts noreply at macports.org
Mon Apr 27 06:02:47 UTC 2020


#60403: lpcnetfreedv: incorrect optimization when building universal
------------------------+--------------------------
 Reporter:  ryandesign  |      Owner:  ra1nb0w
     Type:  defect      |     Status:  assigned
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:  2.6.2
 Keywords:              |       Port:  lpcnetfreedv
------------------------+--------------------------
 The lpcnetfreedv portfile contains this block:

 {{{
 pre-configure {
     # enable optimization on all Intel hardwares
     if {${build_arch} eq "i386"} {
         configure.args-append \
             -DCMAKE_C_FLAGS="-mssse3 -msse4.1"
     } elseif {${build_arch} eq "x86_64"} {
         configure.args-append \
             -DAVX=ON
     }
 }
 }}}

 This will not be correct when building with the universal variant, because
 you will be basing the optimization choice on the arch of the build
 machine rather than choosing it correctly for each arch that you're
 building. If you need to use different flags for each arch, as appears to
 be the case here, you'll want to investigate the muniversal portgroup.

 As an aside, you don't really ever want to do `configure.args-append
 -DCMAKE_C_FLAGS=...`. Instead, you'll want to do `configure.cflags-append
 ...` and let the cmake portgroup handle how that gets communicated to
 cmake.

 Also, if you're going to check whether a variable equals one value, and if
 not then check if it equals another value, etc., the proper construct is
 not a chain of `if` statements but rather a
 [https://www.tcl.tk/man/tcl8.5/TclCmd/switch.htm switch] statement.

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


More information about the macports-tickets mailing list