Ignore:
Timestamp:
Aug 15, 2011, 7:52:45 PM (8 years ago)
Author:
jmr@…
Message:

perl5 portgroup: set perl5.default_branch based on the version of ${prefix}/bin/perl if available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/_resources/port1.0/group/perl5-1.0.tcl

    r82551 r82558  
    4040# perl5.default_branch: the branch used when you request p5-foo
    4141options perl5.default_branch perl5.branches
    42 default perl5.default_branch 5.12
    4342default perl5.branches {"5.8 5.10 5.12 5.14"}
    4443
     
    7271# perl5 group setup procedure
    7372proc perl5.setup {module vers {cpandir ""}} {
    74     global perl5.branches perl5.bin perl5.lib perl5.module perl5.moduleversion perl5.cpandir
    75     global prefix subport name
     73    global perl5.branches perl5.default_branch perl5.bin perl5.lib \
     74           perl5.module perl5.moduleversion perl5.cpandir \
     75           prefix subport name
    7676
    7777    # define perl5.module
    7878    set perl5.module ${module}
    7979    set perl5.moduleversion $vers
     80
     81    # check if a default version was set, otherwise use whatever
     82    # ${prefix}/bin/perl was chosen, and if none, fall back to 5.12
     83    if {![info exists perl5.default_branch]} {
     84        if {[catch {set val [lindex [split [exec ${prefix}/bin/perl -V:version] {'}] 1]}]} {
     85            perl5.default_branch 5.12
     86        } else {
     87            perl5.default_branch [join [lrange [split $val .] 0 1] .]
     88        }
     89    }
    8090
    8191    # define perl5.cpandir
Note: See TracChangeset for help on using the changeset viewer.