Changeset 53860


Ignore:
Timestamp:
Jul 15, 2009, 11:22:46 PM (10 years ago)
Author:
jmr@…
Message:

Move conditionally adding the default universal variant and setting up the flags that depend on whether universal is set into a universal_setup proc. This avoids problems when the configure phase is skipped as well as making the flags available earlier (in variant bodies).

Location:
trunk/base/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r53740 r53860  
    11221122    $workername eval source Portfile
    11231123
    1124     # add the default universal variant, but only if
    1125     # it will work and another one isn't already present
    1126     if {[$workername eval default_universal_variant_allowed]} {
    1127         $workername eval add_default_universal_variant
    1128     }
     1124    # add the default universal variant if appropriate, and set up flags that
     1125    # are conditional on whether universal is set
     1126    $workername eval universal_setup
    11291127
    11301128    # evaluate the variants
  • trunk/base/src/port1.0/portconfigure.tcl

    r53494 r53860  
    140140
    141141proc portconfigure::configure_start {args} {
    142     global UI_PREFIX configure.compiler configure.optflags configure.archflags
    143     global configure.march configure.mtune configure.universal_cflags
    144     global configure.universal_cxxflags configure.universal_cppflags
    145     global configure.universal_ldflags configure.universal_args
     142    global UI_PREFIX configure.compiler
    146143   
    147144    ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
     
    168165    }
    169166    ui_debug "Using compiler '$name'"
    170    
    171     # add in extra CFLAGS etc
    172     if {[variant_exists universal] && [variant_isset universal]} {
    173         foreach flag {cflags objcflags fflags f90flags fcflags} {
    174             eval configure.${flag}-append ${configure.universal_cflags}
    175         }
    176         eval configure.cxxflags-append ${configure.universal_cxxflags}
    177         eval configure.cppflags-append ${configure.universal_cppflags}
    178         eval configure.ldflags-append ${configure.universal_ldflags}
    179         eval configure.pre_args-append ${configure.universal_args}
    180     } else {
    181         foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
    182             eval configure.${flag}-append ${configure.archflags}
    183             if {${configure.march} != {}} {
    184                 configure.${flag}-append "-march=${configure.march}"
    185             }
    186             if {${configure.mtune} != {}} {
    187                 configure.${flag}-append "-mtune=${configure.mtune}"
    188             }
    189         }
    190         eval configure.ldflags-append ${configure.archflags}
    191     }
    192167}
    193168
  • trunk/base/src/port1.0/portutil.tcl

    r53707 r53860  
    18551855}
    18561856
    1857 proc default_universal_variant_allowed {args} {
    1858 
     1857# add the default universal variant if appropriate, and set up flags that are
     1858# conditional on whether universal is set
     1859proc universal_setup {args} {
     1860    global configure.archflags
     1861    global configure.march configure.mtune configure.universal_cflags
     1862    global configure.universal_cxxflags configure.universal_cppflags
     1863    global configure.universal_ldflags configure.universal_args
     1864   
    18591865    if {[variant_exists universal]} {
    18601866        ui_debug "universal variant already exists, so not adding the default one"
    1861         return no
    18621867    } elseif {[exists universal_variant] && ![option universal_variant]} {
    18631868        ui_debug "'universal_variant no' specified, so not adding the default universal variant"
    1864         return no
    18651869    } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
    18661870        ui_debug "using xmkmf, so not adding the default universal variant"
    1867         return no
    18681871    } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.project]} {
    18691872        # Allow +universal if port uses xcode portgroup.
    18701873        ui_debug "not using configure, so not adding the default universal variant"
    1871         return no
    18721874    } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
    18731875        ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
    1874         return no
    18751876    } else {
    18761877        ui_debug "adding the default universal variant"
    1877         return yes
    1878     }
    1879 }
    1880 
    1881 proc add_default_universal_variant {args} {
    1882     # Declare default universal variant (all the magic happens in portconfigure now)
    1883     variant universal {}
     1878        variant universal {}
     1879    }
     1880
     1881    # add in extra CFLAGS etc
     1882    if {[variant_exists universal] && [variant_isset universal]} {
     1883        foreach flag {cflags objcflags fflags f90flags fcflags} {
     1884            eval configure.${flag}-append ${configure.universal_cflags}
     1885        }
     1886        eval configure.cxxflags-append ${configure.universal_cxxflags}
     1887        eval configure.cppflags-append ${configure.universal_cppflags}
     1888        eval configure.ldflags-append ${configure.universal_ldflags}
     1889        eval configure.pre_args-append ${configure.universal_args}
     1890    } else {
     1891        foreach flag {cflags cxxflags objcflags fflags f90flags fcflags} {
     1892            eval configure.${flag}-append ${configure.archflags}
     1893            if {${configure.march} != {}} {
     1894                configure.${flag}-append "-march=${configure.march}"
     1895            }
     1896            if {${configure.mtune} != {}} {
     1897                configure.${flag}-append "-mtune=${configure.mtune}"
     1898            }
     1899        }
     1900        eval configure.ldflags-append ${configure.archflags}
     1901    }
    18841902}
    18851903
Note: See TracChangeset for help on using the changeset viewer.