Ticket #52118: Portfile.diff

File Portfile.diff, 3.9 KB (added by jmroot (Joshua Root), 8 years ago)
  • Portfile

     
    263263        depends_build-append port:cctools
    264264    }
    265265
     266    set all_llvm_variants {llvm38 llvm39 llvmdev}
     267    if {${os.major} < 10} {
     268        lappend all_llvm_variants llvm33
     269    }
     270    if {${os.major} < 11} {
     271        lappend all_llvm_variants llvm34
     272    }
     273    array set llvm_variant_version {llvm33 3.3 llvm34 3.4 llvm38 3.8 llvm39 3.9 llvmdev devel}
     274    set llvm_version {}
     275
     276    foreach variantname $all_llvm_variants {
     277        set this_llvm_version $llvm_variant_version($variantname)
     278        variant $variantname conflicts [ldelete $all_llvm_variants $variantname] description "Use llvm-${this_llvm_version} for libLTO" "
     279            set llvm_version        $this_llvm_version
     280            depends_lib-append      port:llvm-${this_llvm_version}
     281        "
     282    }
     283
     284    proc some_llvm_variant_set {} {
     285        global all_llvm_variants
     286        foreach variantname $all_llvm_variants {
     287            if {[variant_isset $variantname]} {
     288                return yes
     289            }
     290        }
     291        return no
     292    }
     293
    266294    # We don't set llvmXX as the default variant on Tiger because it would introduce a
    267295    # dependency cycle as llvm requires apple-gcc42 and ld64 to build correctly.  Users
    268296    # wanting LTO support in ld64 on Tiger can install the +llvm variant after llvm
    269297    # has been installed.
    270298
    271     if {![variant_isset llvm33] && ![variant_isset llvm34] && ![variant_isset llvm38] && ![variant_isset llvm39] && ![variant_isset llvmdev]} {
     299    if {![some_llvm_variant_set]} {
    272300        if {${os.major} >= 13} {
    273301            default_variants +llvm38
    274302        } elseif {${os.major} >= 10} {
     
    278306            default_variants +llvm33
    279307        }
    280308
    281         if {![variant_isset llvm33] && ![variant_isset llvm34] && ![variant_isset llvm38] && ![variant_isset llvm39] && ![variant_isset llvmdev] && ${os.major} >= 9} {
     309        if {![some_llvm_variant_set] && ${os.major} >= 9} {
    282310            ui_error "Your platform cannot be configured without LTO support in ld64.  Please enable one of the llvmXX variants, and try again."
    283311            return -code error "Your platform cannot be configured without LTO support in ld64.  Please enable one of the llvmXX variants, and try again."
    284312        }
    285313    }
    286314
    287     set llvm_version {}
    288     variant llvm33 conflicts llvm34 llvm38 llvm39 llvmdev description {Use llvm-3.3 for libLTO} {
    289         set llvm_version        3.3
    290         depends_lib-append      port:llvm-${llvm_version}
    291 
    292         if {${os.major} >= 10} {
    293             ui_error "The +llvm33 variant is not supported on Snow Leopard and later."
    294             error "Invalid variant selected"
    295         }
    296     }
    297 
    298     variant llvm34 conflicts llvm33 llvm38 llvm39 llvmdev description {Use llvm-3.4 for libLTO} {
    299         set llvm_version        3.4
    300         depends_lib-append      port:llvm-${llvm_version}
    301 
    302         if {${os.major} >= 11} {
    303             ui_error "The +llvm34 variant is not supported on Lion and later."
    304             error "Invalid variant selected"
    305         }
    306     }
    307 
    308     variant llvm38 conflicts llvm33 llvm34 llvm39 llvmdev description {Use llvm-3.8 for libLTO} {
    309         set llvm_version        3.8
    310         depends_lib-append      port:llvm-${llvm_version}
    311     }
    312 
    313     variant llvm39 conflicts llvm33 llvm34 llvm38 llvmdev description {Use llvm-3.9 for libLTO} {
    314         set llvm_version        3.9
    315         depends_lib-append      port:llvm-${llvm_version}
    316     }
    317 
    318     variant llvmdev conflicts llvm33 llvm34 llvm38 llvm39 description {Use llvm-devel for libLTO} {
    319         set llvm_version        devel
    320         depends_lib-append      port:llvm-${llvm_version}
    321     }
    322 
    323315    if {${os.major} < 10} {
    324316        # Leopard and earlier didn't have libunwind.h in the SDK
    325317        depends_build-append    path:include/libunwind.h:libunwind-headers