Changeset 89609


Ignore:
Timestamp:
Feb 3, 2012, 11:25:15 PM (8 years ago)
Author:
pixilla@…
Message:

_resources/port1.0/group:

  • Use command_exec in favor system.
File:
1 edited

Legend:

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

    r89391 r89609  
    4343#
    4444
     45# Args placed before the php or pear commands.
     46options php5pear.env
     47default php5pear.env    {
     48    "TZ=UTC \
     49    HOME=${php5pear.installer} \
     50    PHP_PEAR_INSTALL_DIR=${php5pear.installer}/pear \
     51    PHP_PEAR_BIN_DIR=${php5pear.installer}/bin \
     52    PHP_PEAR_PHP_BIN=${php5pear.cmd-php} \
     53    PHP_PEAR_CFG_DIR=${php5pear.installer}/pear/cfg \
     54    PHP_PEAR_DOC_DIR=${php5pear.installer}/pear/docs \
     55    PHP_PEAR_DATA_DIR=${php5pear.installer}/pear/data \
     56    PHP_PEAR_WWW_DIR=${php5pear.installer}/pear/www \
     57    PHP_PEAR_TEST_DIR=${php5pear.installer}/pear/tests \
     58    PHP_PEAR_SYSCONF_DIR=${php5pear.installer}"
     59}
     60
     61# Args placed after php or pear commands.
     62options php5pear.configure.pre_args
     63default php5pear.configure.pre_args   {
     64    "-c ${php5pear.installer}/pear.conf \
     65    -C ${php5pear.installer}/pear.conf"
     66}
     67
     68# Where we instruct pear to install our package.
     69options php5pear.destroot
     70default php5pear.destroot       {${worksrcpath}/packagingroot}
     71
     72# Where the pear installer is installed for each port.
     73options php5pear.installer
     74default php5pear.installer      {${worksrcpath}/installer}
     75
     76# Where we expand our source files.
     77options php5pear.sourceroot
     78default php5pear.sourceroot     {${worksrcpath}/packagesource}
     79
     80# The base paths for our pear.conf.
     81options php5pear.instpath
     82default php5pear.instpath       {${prefix}/lib/php}
     83options php5pear.pearpath
     84default php5pear.pearpath       {${php5pear.instpath}/pear}
     85
     86# The pear command we will use.
     87options php5pear.cmd-pear
     88default php5pear.cmd-pear       {${php5pear.installer}/bin/pear}
     89
     90# The phar file that contains our pear installer.
     91options php5pear.cmd-phar
     92default php5pear.cmd-phar       {${prefix}/lib/php/pear/install-pear-nozlib.phar}
     93
     94# The php binary we will use.
     95options php5pear.cmd-php
     96default php5pear.cmd-php        {${prefix}/bin/php}
     97
     98# The pear channel for our package.
     99options php5pear.channel
     100
     101# The name of the package xml file inside the pear package archive.
     102options php5pear.packagexml
     103default php5pear.packagexml     {[lindex [exec tar -tzf ${php5pear.packagefile} | grep package.*\.xml] 0]}
     104
     105# Package name.
    45106options php5pear.package
    46 options php5pear.channel
    47 options php5pear.cmd-pre
    48 options php5pear.cmd-pear
    49 options php5pear.cmd-phar
    50 options php5pear.cmd-php
    51 options php5pear.cmd-post
    52 options php5pear.cmd
    53 options php5pear.destroot
    54 options php5pear.sourceroot
    55 options php5pear.instpath
    56 options php5pear.pearpath
    57 options php5pear.installer
    58 options php5pear.packagexml
    59 
    60 proc php5pear.setup {php5pear.package version {php5pear.channel "pear.php.net"} {php5pear.packagexml "package.xml"}} {
    61     global worksrcpath distname extract.suffix master_sites prefix destroot distpath
    62     global php5pear.cmd-pre php5pear.cmd-pear php5pear.cmd-phar php5pear.cmd-php php5pear.cmd-post
    63     global php5pear.cmd php5pear.instpath php5pear.pearpath
    64     global php5pear.installer name php5pear.sourceroot
     107
     108# Package file.
     109options php5pear.packagefile
     110default php5pear.packagefile    {"${distpath}/[lindex $distfiles 0]"}
     111
     112proc php5pear.setup {package_name package_version {package_channel "pear.php.net"}} {
     113    global name extract.suffix version
     114    global php5pear.env php5pear.cmd-pear php5pear.destroot php5pear.sourceroot
     115    global php5pear.channel php5pear.package php5pear.packagexml
    65116   
    66117    # The pear name for the package.
    67     php5pear.package    ${php5pear.package}
     118    php5pear.package        ${package_name}
    68119    # The pear channel for the package.
    69     php5pear.channel    ${php5pear.channel}
    70     # The name of the package's xml file used by pear to build the package.
    71     # Note: so far the two known names are package.xml and package2.xml.
    72     php5pear.packagexml ${php5pear.packagexml}
    73    
    74     name                pear-${php5pear.package}
    75     version             ${version}
    76     categories          php
    77     distname            ${php5pear.package}-${version}
    78     extract.suffix      .tgz
    79     homepage            http://${php5pear.channel}/package/${php5pear.package}
    80     master_sites        http://${php5pear.channel}/get
    81     livecheck.type      regex
    82     livecheck.url       http://${php5pear.channel}/package/${php5pear.package}/download
    83     livecheck.regex     "http://download.${php5pear.channel}/package/${php5pear.package}-((?!\.tgz).*)${extract.suffix}"
    84    
    85     dist_subdir         pear
    86     supported_archs     noarch
    87     use_parallel_build  yes
    88     depends_lib         path:bin/phpize:php5 port:php5-pear
     120    php5pear.channel        ${package_channel}
     121   
     122    name                    pear-${php5pear.package}
     123    version                 ${package_version}
     124    categories              php
     125    distname                ${php5pear.package}-${version}
     126    extract.suffix          .tgz
     127    homepage                http://${php5pear.channel}/package/${php5pear.package}
     128    master_sites            http://${php5pear.channel}/get
     129    dist_subdir             pear
     130    supported_archs         noarch
     131    use_parallel_build      yes
     132    depends_lib             path:bin/phpize:php5 port:php5-pear
    89133   
    90134    # List of ports that pear-PEAR depends on.
     135    # Add some pear-PEAR deps to make programmatic creation of pear Portfiles easier.
    91136    if {
    92137        ${name} != "pear-Archive_Tar" &&
     
    96141        ${name} != "pear-PEAR"
    97142    } {
    98         depends_lib-append    port:pear-PEAR
    99     }
    100    
    101     # Where the pear installer is installed for each port.
    102     php5pear.installer  ${worksrcpath}/installer
    103     # The base paths for our pear.conf.
    104     php5pear.instpath   ${prefix}/lib/php
    105     php5pear.pearpath   ${php5pear.instpath}/pear
    106     # Where we expand our source files.
    107     php5pear.sourceroot ${worksrcpath}/packagesource   
    108     # Where we instruct pear to install our package.
    109     php5pear.destroot   ${worksrcpath}/packagingroot   
    110    
    111     # The pear command we will use.
    112     php5pear.cmd-pear   ${php5pear.installer}/bin/pear
    113     # The phar file that contains our pear installer.
    114     php5pear.cmd-phar   ${prefix}/lib/php/pear/install-pear-nozlib.phar
    115     # The php binary we will use.
    116     php5pear.cmd-php    ${prefix}/bin/php
    117     # Args placed before the php or pear commands.
    118     php5pear.cmd-pre \
    119         cd ${php5pear.sourceroot} && \
    120         TZ=UTC \
    121         HOME=${php5pear.installer} \
    122         PHP_PEAR_INSTALL_DIR=${php5pear.installer}/pear \
    123         PHP_PEAR_BIN_DIR=${php5pear.installer}/bin \
    124         PHP_PEAR_PHP_BIN=${php5pear.cmd-php} \
    125         PHP_PEAR_CFG_DIR=${php5pear.installer}/pear/cfg \
    126         PHP_PEAR_DOC_DIR=${php5pear.installer}/pear/docs \
    127         PHP_PEAR_DATA_DIR=${php5pear.installer}/pear/data \
    128         PHP_PEAR_WWW_DIR=${php5pear.installer}/pear/www \
    129         PHP_PEAR_TEST_DIR=${php5pear.installer}/pear/tests \
    130         PHP_PEAR_SYSCONF_DIR=${php5pear.installer}
    131     # Args placed after php or pear commands.
    132     php5pear.cmd-post \
    133         -c ${php5pear.installer}/pear.conf \
    134         -C ${php5pear.installer}/pear.conf
    135    
    136     extract.mkdir       yes
    137     extract.post_args   "| tar --strip-components 1 -x -f - -C '${php5pear.sourceroot}'"
    138    
     143        depends_lib-append  port:pear-PEAR
     144    } elseif {
     145        ${name} == "pear-PEAR"
     146    } {
     147        depends_lib-append  port:pear-Archive_Tar \
     148                            port:pear-Console_Getopt \
     149                            port:pear-Structures_Graph \
     150                            port:pear-XML_Util
     151                           
     152    }
     153   
     154    extract.post_args-append   -C '${php5pear.sourceroot}' --strip-components 1
     155
    139156    pre-extract {
    140         xinstall -d ${php5pear.sourceroot}
     157        xinstall -d "${php5pear.sourceroot}"
    141158    }
    142159   
    143160    post-extract {
    144         # Get the name of our package xml file.
    145         php5pear.packagexml [lindex [exec tar -tzf ${distpath}/${distname}${extract.suffix} | grep package.*\.xml] 0]
    146161        # The "--strip-components 1" causes the loss of our package file so we will extract it now.
    147         system "tar -z -x -v -f '${distpath}/${distname}${extract.suffix}' -C '${php5pear.sourceroot}' ${php5pear.packagexml}"
    148         # Install the pear command using the phar file.
    149         system "${php5pear.cmd-pre} ${php5pear.cmd-php} ${php5pear.cmd-phar}"
     162        extract.post_args-delete    --strip-components 1
     163        extract.post_args-append    ${php5pear.packagexml}
     164        command_exec                extract
    150165    }
    151166   
     
    156171    }
    157172   
     173    configure.env           ${php5pear.env}
     174    configure.dir           ${php5pear.sourceroot}
    158175    configure {
     176        # Install the pear command using the phar file.
     177        configure.cmd           ${php5pear.cmd-php}
     178        configure.pre_args      ${php5pear.cmd-phar}
     179        command_exec configure
     180        configure.cmd           ${php5pear.cmd-pear}
     181        configure.pre_args      -c ${php5pear.installer}/pear.conf \
     182                                -C ${php5pear.installer}/pear.conf
    159183        # Set up pear's conf file.
    160184        # The order appears to be important; we get errors if we set php_dir before adding channels
    161185        # and the directory is not writable.
    162186        xinstall -d "${php5pear.installer}/pear/php"
    163         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set auto_discover 1"
     187        set pear_config [list]
     188        lappend pear_config         "config-set auto_discover 1"
    164189        if { "${php5pear.channel}" != "pear.php.net" } {
    165             system "curl -s http://${php5pear.channel}/channel.xml -o ${worksrcpath}/channel.xml"
    166             system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} channel-add ${worksrcpath}/channel.xml"
    167             system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set default_channel ${php5pear.channel}"
     190            lappend pear_config         "channel-discover ${php5pear.channel}"
     191            lappend pear_config         "config-set default_channel ${php5pear.channel}"
    168192        }
    169193        # Change the install directories to the final destinations
    170         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set php_dir ${php5pear.pearpath}"
    171         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set bin_dir ${php5pear.pearpath}/bin"
    172         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set doc_dir ${php5pear.pearpath}/docs"
    173         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set data_dir ${php5pear.pearpath}/data"
    174         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set www_dir ${php5pear.pearpath}/www"
    175         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set test_dir ${php5pear.pearpath}/tests"
    176         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-show"
     194        lappend pear_config         "config-set php_dir ${php5pear.pearpath}"
     195        lappend pear_config         "config-set bin_dir ${php5pear.pearpath}/bin"
     196        lappend pear_config         "config-set cfg_dir ${php5pear.pearpath}/cfg"
     197        lappend pear_config         "config-set doc_dir ${php5pear.pearpath}/docs"
     198        lappend pear_config         "config-set data_dir ${php5pear.pearpath}/data"
     199        lappend pear_config         "config-set www_dir ${php5pear.pearpath}/www"
     200        lappend pear_config         "config-set test_dir ${php5pear.pearpath}/tests"
     201        lappend pear_config         "config-show"
     202        foreach pear_args $pear_config {
     203            configure.args          "${pear_args}"
     204            command_exec configure
     205        }
    177206    }
    178207   
    179208    build {
    180         # Get the name of our package xml file.
    181         php5pear.packagexml [lindex [exec tar -tzf ${distpath}/${distname}${extract.suffix} | grep package.*\.xml] 0]
    182         # Install our package into our pear's packagingroot.
    183         system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} install -n -f -P '${php5pear.destroot}' ${php5pear.packagexml}"
    184     }
    185    
     209        build.env           ${php5pear.env}
     210        build.dir           ${php5pear.sourceroot}
     211        build.cmd           ${php5pear.cmd-pear}
     212        build.target        install
     213        build.args          "-n -f -P '${php5pear.destroot}' ${php5pear.packagexml}"
     214        command_exec build
     215    }
     216
    186217    destroot {
    187218        copy ${php5pear.destroot}${php5pear.instpath} ${destroot}${prefix}/lib
     
    189220        fs-traverse -ignoreErrors item "${destroot}${php5pear.instpath}" {
    190221            if {[string first . [file tail ${item}] 0] == 0} {
    191                 # Using system rm because I could not find a way to delete dot files with [file delete].
    192                 system "rm -R ${item}"
     222                if {[file tail ${item}] != "." && [file tail ${item}] != ".."} {
     223                    puts "Removing dot file ${item}"
     224                    delete ${item}
     225                }
    193226            }
    194227        }
     
    202235        }
    203236    }
     237
     238    livecheck.type          regex
     239    livecheck.url           http://${php5pear.channel}/package/${php5pear.package}/download
     240    livecheck.regex         http://download.${php5pear.channel}/package/
     241    livecheck.regex-append  "${php5pear.package}-((?!\\${extract.suffix}).*)\\${extract.suffix}"
    204242}
Note: See TracChangeset for help on using the changeset viewer.