[152084] trunk/dports/devel/ld64/Portfile

jmr at macports.org jmr at macports.org
Sun Aug 28 20:02:15 PDT 2016


Revision: 152084
          https://trac.macports.org/changeset/152084
Author:   jmr at macports.org
Date:     2016-08-28 20:02:15 -0700 (Sun, 28 Aug 2016)
Log Message:
-----------
ld64: generate llvm variants with correct conflicts (#52118, maintainer approved)

Modified Paths:
--------------
    trunk/dports/devel/ld64/Portfile

Modified: trunk/dports/devel/ld64/Portfile
===================================================================
--- trunk/dports/devel/ld64/Portfile	2016-08-29 02:51:40 UTC (rev 152083)
+++ trunk/dports/devel/ld64/Portfile	2016-08-29 03:02:15 UTC (rev 152084)
@@ -263,12 +263,40 @@
         depends_build-append port:cctools
     }
 
+    set all_llvm_variants {llvm38 llvm39 llvmdev}
+    if {${os.major} < 10} {
+        lappend all_llvm_variants llvm33
+    }
+    if {${os.major} < 11} {
+        lappend all_llvm_variants llvm34
+    }
+    array set llvm_variant_version {llvm33 3.3 llvm34 3.4 llvm38 3.8 llvm39 3.9 llvmdev devel}
+    set llvm_version {}
+
+    foreach variantname $all_llvm_variants {
+        set this_llvm_version $llvm_variant_version($variantname)
+        variant $variantname conflicts {*}[ldelete $all_llvm_variants $variantname] description "Use llvm-${this_llvm_version} for libLTO" "
+            set llvm_version        $this_llvm_version
+            depends_lib-append      port:llvm-${this_llvm_version}
+        "
+    }
+
+    proc some_llvm_variant_set {} {
+        global all_llvm_variants
+        foreach variantname $all_llvm_variants {
+            if {[variant_isset $variantname]} {
+                return yes
+            }
+        }
+        return no
+    }
+
     # We don't set llvmXX as the default variant on Tiger because it would introduce a
     # dependency cycle as llvm requires apple-gcc42 and ld64 to build correctly.  Users
     # wanting LTO support in ld64 on Tiger can install the +llvm variant after llvm
     # has been installed.
 
-    if {![variant_isset llvm33] && ![variant_isset llvm34] && ![variant_isset llvm38] && ![variant_isset llvm39] && ![variant_isset llvmdev]} {
+    if {![some_llvm_variant_set]} {
         if {${os.major} >= 13} {
             default_variants +llvm38
         } elseif {${os.major} >= 10} {
@@ -278,43 +306,12 @@
             default_variants +llvm33
         }
 
-        if {![variant_isset llvm33] && ![variant_isset llvm34] && ![variant_isset llvm38] && ![variant_isset llvm39] && ![variant_isset llvmdev] && ${os.major} >= 9} {
+        if {![some_llvm_variant_set] && ${os.major} >= 9} {
             ui_error "Your platform cannot be configured without LTO support in ld64.  Please enable one of the llvmXX variants, and try again."
             return -code error "Your platform cannot be configured without LTO support in ld64.  Please enable one of the llvmXX variants, and try again."
         }
     }
 
-    set llvm_version {}
-
-    if {${os.platform} eq "darwin" && ${os.major} < 10} {
-        variant llvm33 conflicts llvm34 llvm38 llvm39 llvmdev description {Use llvm-3.3 for libLTO} {
-            set llvm_version        3.3
-            depends_lib-append      port:llvm-${llvm_version}
-        }
-    }
-
-    if {${os.platform} eq "darwin" && ${os.major} < 11} {
-        variant llvm34 conflicts llvm33 llvm38 llvm39 llvmdev description {Use llvm-3.4 for libLTO} {
-            set llvm_version        3.4
-            depends_lib-append      port:llvm-${llvm_version}
-        }
-    }
-
-    variant llvm38 conflicts llvm39 llvmdev description {Use llvm-3.8 for libLTO} {
-        set llvm_version        3.8
-        depends_lib-append      port:llvm-${llvm_version}
-    }
-
-    variant llvm39 conflicts llvm38 llvmdev description {Use llvm-3.9 for libLTO} {
-        set llvm_version        3.9
-        depends_lib-append      port:llvm-${llvm_version}
-    }
-
-    variant llvmdev conflicts llvm38 llvm39 description {Use llvm-devel for libLTO} {
-        set llvm_version        devel
-        depends_lib-append      port:llvm-${llvm_version}
-    }
-
     if {${os.major} < 10} {
         # Leopard and earlier didn't have libunwind.h in the SDK
         depends_build-append    path:include/libunwind.h:libunwind-headers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160828/11ec11aa/attachment.html>


More information about the macports-changes mailing list