Ticket #12170: universal-noconfigure.diff

File universal-noconfigure.diff, 6.3 KB (added by jmroot (Joshua Root), 13 years ago)

proposed fix

  • src/port1.0/portutil.tcl

     
    16511651    return $result
    16521652}
    16531653
     1654proc default_universal_variant_allowed {args} {
     1655   
     1656    if {[variant_exists universal]} {
     1657        ui_debug "universal variant already exists, so not adding the default one"
     1658        return no
     1659    } elseif {[exists universal_variant] && ![option universal_variant]} {
     1660        ui_debug "'universal_variant no' specified, so not adding the default universal variant"
     1661        return no
     1662    } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
     1663        ui_debug "using xmkmf, so not adding the default universal variant"
     1664        return no
     1665    } elseif {[exists use_configure] && ![option use_configure]} {
     1666        ui_debug "not using configure, so not adding the default universal variant"
     1667        return no
     1668    } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
     1669        ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
     1670        return no
     1671    } else {
     1672        ui_debug "adding the default universal variant"
     1673        return yes
     1674    }
     1675}
     1676
     1677proc add_default_universal_variant {args} {
     1678    # Declare default universal variant, on >10.3
     1679    variant universal description {Build for multiple architectures} {
     1680        if {![file exists ${configure.universal_sysroot}]} {
     1681            return -code error "Universal SDK is not installed (are we running on 10.3? did you forget to install it?) and building with +universal will very likely fail"
     1682        }
     1683        eval configure.args-append ${configure.universal_args}
     1684        eval configure.cflags-append ${configure.universal_cflags}
     1685        eval configure.cppflags-append ${configure.universal_cppflags}
     1686        eval configure.cxxflags-append ${configure.universal_cxxflags}
     1687        eval configure.ldflags-append ${configure.universal_ldflags}
     1688    }
     1689}
     1690
    16541691# Target class definition.
    16551692
    16561693# constructor for target object
  • src/port1.0/portmain.tcl

     
    4444options prefix name version revision epoch categories maintainers
    4545options long_description description homepage
    4646options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
     47options universal_variant os.universal_supported
    4748
    4849# Export options via PortInfo
    4950options_export name version revision epoch categories maintainers platforms description long_description homepage
     
    9697default os.arch {$os_arch}
    9798# Remove trailing "Endian"
    9899default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
     100default os.universal_supported no
    99101
    100102set macosx_version {}
    101103if {$os_platform == "darwin"} {
     
    105107
    106108default macosx_deployment_target {$macosx_version}
    107109
     110default universal_variant yes
     111
    108112# Select implicit variants
    109113if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
    110114if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
    111115if {[info exists os.platform] && (${os.platform} == "darwin") && ![file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(puredarwin)]} { variant_set puredarwin }
    112116if {[info exists os.platform] && (${os.platform} == "darwin") && [file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(macosx)]} { variant_set macosx }
    113117if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
    114     # Declare default universal variant, on >10.3
    115     variant universal description {Build for multiple architectures} {
    116         if {[tbool use_xmkmf] || ![tbool use_configure]} {
    117             return -code error "Default universal variant only works with ports based on configure"
    118         }
    119         eval configure.args-append ${configure.universal_args}
    120         if {![file exists ${configure.universal_sysroot}]} {
    121             return -code error "Universal SDK is not installed (are we running on 10.3? did you forget to install it?) and building with +universal will very likely fail"
    122         }
    123         eval configure.cflags-append ${configure.universal_cflags}
    124         eval configure.cppflags-append ${configure.universal_cppflags}
    125         eval configure.cxxflags-append ${configure.universal_cxxflags}
    126         eval configure.ldflags-append ${configure.universal_ldflags}
    127     }
     118    # the universal variant itself is now created in
     119    # add_default_universal_variant, which is called from mportopen
     120    option os.universal_supported yes
     121
    128122    if {[info exists variations(universal)] && $variations(universal) == "+"} {
    129123        # cannot go into the variant, due to the amount of ports overriding it
    130124        global configure.universal_target
     
    132126            eval macosx_deployment_target ${configure.universal_target}
    133127        }
    134128    }
    135 
    136     # This is not a standard option, because we need to take an action when it's
    137     # set, in order to alter the PortInfo structure in time.
    138     proc universal_variant {state} {
    139         if {${state} == "no"} {
    140             variant_undef universal
    141         }
    142     }
    143 } else {
    144     proc universal_variant {state} {
    145         if {${state} != "no"} {
    146             ui_error "+universal is only available on +macosx"
    147         }
    148     }
    149129}
    150130
    151131proc main {args} {
  • src/macports1.0/macports.tcl

     
    946946    macports::worker_init $workername $portpath [macports::getportbuildpath $portpath] $options $variations
    947947
    948948    $workername eval source Portfile
     949   
     950    # add the default universal variant, but only if
     951    # it will work and another one isn't already present
     952    if {[$workername eval default_universal_variant_allowed]} {
     953        $workername eval add_default_universal_variant
     954    }
    949955
    950956    # evaluate the variants
    951957    if {[$workername eval eval_variants variations] != 0} {