[125264] trunk/dports/_resources/port1.0/group/perl5-1.0.tcl

pixilla at macports.org pixilla at macports.org
Thu Sep 11 15:12:06 PDT 2014


Revision: 125264
          https://trac.macports.org/changeset/125264
Author:   pixilla at macports.org
Date:     2014-09-11 15:12:06 -0700 (Thu, 11 Sep 2014)
Log Message:
-----------
_resources/port1.0/group:
- Move perl5.setup subport creation to new perl5.create_subport proc.
- Add perl5.create_variants proc for creating perl variants.
- See ticket #43193

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/perl5-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/perl5-1.0.tcl
===================================================================
--- trunk/dports/_resources/port1.0/group/perl5-1.0.tcl	2014-09-11 21:32:11 UTC (rev 125263)
+++ trunk/dports/_resources/port1.0/group/perl5-1.0.tcl	2014-09-11 22:12:06 UTC (rev 125264)
@@ -65,6 +65,62 @@
     return $val
 }
 
+# Create perl subports
+proc perl5.create_subports {branches rootname} {
+    foreach v ${branches} {
+        subport p${v}-${rootname} {
+            depends_lib port:perl${v}
+            perl5.major ${v}
+        }
+    }
+}
+
+# Set perl variant options and defaults
+options perl5.default_variant perl5.variant perl5.set_default_variant perl5.conflict_variants
+default perl5.default_variant [string map {. _} perl${perl5.default_branch}]
+default perl5.variant {[string map {. _} perl${perl5.major}]}
+default perl5.set_default_variant {true}
+default perl5.conflict_variants {true}
+# Get variant names from branches
+proc perl5.get_variant_names {branches} {
+    set ret {}
+    foreach branch ${branches} {
+        lappend ret "perl[string map {. _} ${branch}]"
+    }
+    return $ret
+}
+# Create perl variants
+proc perl5.create_variants {branches} {
+    global perl5.major perl5.default_variant perl5.variant perl5.set_default_variant perl5.conflict_variants
+    set variants [perl5.get_variant_names ${branches}]
+    foreach branch ${branches} {
+        set index [lsearch ${branches} ${branch}]
+        set variant [lindex ${variants} ${index}]
+# Add conflicts
+        set conflicts {}
+        if {${perl5.conflict_variants}} {
+            set conflicts "conflicts {[lreplace ${variants} ${index} ${index}]}"
+        }
+        eval "variant ${variant} ${conflicts} description Use MacPorts perl${branch} {}"
+        if {[variant_isset ${variant}]} {
+            perl5.variant ${variant}
+        }
+    }
+# Set default perl variant
+    if {${perl5.default_variant} eq ${perl5.variant} && ${perl5.set_default_variant}} {
+        default_variants-append +${perl5.variant}
+    }
+# Set perl version and deps
+    foreach branch ${branches} {
+        set index [lsearch ${branches} ${branch}]
+        set variant [lindex ${variants} ${index}]
+        if {[variant_isset ${variant}]} {
+            perl5.major ${branch}
+            depends_lib port:perl${branch}
+        }
+    }
+}
+
 # Set some variables.
 options perl5.version perl5.major perl5.arch perl5.lib perl5.bindir perl5.archlib perl5.bin
 default perl5.version {[perl5.extract_config version]}
@@ -124,14 +180,8 @@
 
     if {[string match p5-* $name]} {
         set rootname        [string range $name 3 end]
+        perl5.create_subports ${perl5.branches} ${rootname}
 
-        foreach v ${perl5.branches} {
-            subport p${v}-${rootname} {
-                depends_lib port:perl${v}
-                perl5.major ${v}
-            }
-        }
-
         if {$subport eq $name} {
             perl5.major
             distfiles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140911/589b89f4/attachment.html>


More information about the macports-changes mailing list