Changeset 87321


Ignore:
Timestamp:
Nov 17, 2011, 2:10:46 AM (8 years ago)
Author:
pixilla@…
Message:

_resources/port1.0/group/php5pear-1.0.tcl:

  • Add mode line.
  • Whitespace change to standard 4 spaces per tab.
File:
1 edited

Legend:

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

    r87316 r87321  
     1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    12# $Id$
    23#
     
    5859
    5960proc php5pear.setup {php5pear.package version {php5pear.channel "pear.php.net"} {php5pear.packagexml "package.xml"}} {
    60   global worksrcpath distname extract.suffix master_sites prefix destroot distpath
    61   global php5pear.cmd-pre php5pear.cmd-pear php5pear.cmd-phar php5pear.cmd-php php5pear.cmd-post
    62   global php5pear.cmd php5pear.instpath php5pear.pearpath
    63   global php5pear.installer name php5pear.sourceroot
    64 
    65   # The pear name for the package.
    66   php5pear.package    ${php5pear.package}
    67   # The pear channel for the package.
    68   php5pear.channel    ${php5pear.channel}
    69   # The name of the package's xml file used by pear to build the package.
    70   # Note: so far the two known names are package.xml and package2.xml.
    71   php5pear.packagexml ${php5pear.packagexml}
    72 
    73   name                pear-${php5pear.package}
    74   version             ${version}
    75   categories          php
    76   distname            ${php5pear.package}-${version}
    77   extract.suffix      .tgz
    78   homepage            http://${php5pear.channel}/package/${php5pear.package}
    79   master_sites        http://${php5pear.channel}/get
    80   livecheck.type      regex
    81   livecheck.url       http://${php5pear.channel}/package/${php5pear.package}/download
    82   livecheck.regex     "http://download.${php5pear.channel}/package/${php5pear.package}-((?!\.tgz).*)${extract.suffix}"
    83 
    84   dist_subdir         pear
    85   supported_archs     noarch
    86   use_parallel_build  yes
    87   depends_lib         path:bin/phpize:php5 port:php5-pear
    88  
    89   # List of ports that pear-PEAR depends on.
    90   if {
    91     ${name} != "pear-Archive_Tar" &&
    92     ${name} != "pear-Console_Getopt" &&
    93     ${name} != "pear-Structures_Graph" &&
    94     ${name} != "pear-XML_Util" &&
    95     ${name} != "pear-PEAR"
    96   } {
    97     depends_lib-append    port:pear-PEAR
    98   }
    99 
    100   # Where the pear installer is installed for each port.
    101   php5pear.installer  ${worksrcpath}/installer
    102   # The base paths for our pear.conf.
    103   php5pear.instpath   ${prefix}/lib/php
    104   php5pear.pearpath   ${php5pear.instpath}/pear
    105   # Where we expand our source files.
    106   php5pear.sourceroot ${worksrcpath}/packagesource   
    107   # Where we instruct pear to install our package.
    108   php5pear.destroot   ${worksrcpath}/packagingroot   
    109 
    110   # The pear command we will use.
    111   php5pear.cmd-pear   ${php5pear.installer}/bin/pear
    112   # The phar file that contains our pear installer.
    113   php5pear.cmd-phar   ${prefix}/lib/php/pear/install-pear-nozlib.phar
    114   # The php binary we will use.
    115   php5pear.cmd-php    ${prefix}/bin/php
    116   # Args placed before the php or pear commands.
    117   php5pear.cmd-pre    cd ${php5pear.sourceroot} && TZ=UTC \
    118                       PHP_PEAR_INSTALL_DIR=${php5pear.installer}/pear \
    119                       PHP_PEAR_BIN_DIR=${php5pear.installer}/bin \
    120                       PHP_PEAR_PHP_BIN=${php5pear.cmd-php} \
    121                       PHP_PEAR_CFG_DIR=${php5pear.installer}/pear/cfg \
    122                       PHP_PEAR_DOC_DIR=${php5pear.installer}/pear/docs \
    123                       PHP_PEAR_DATA_DIR=${php5pear.installer}/pear/data \
    124                       PHP_PEAR_WWW_DIR=${php5pear.installer}/pear/www \
    125                       PHP_PEAR_TEST_DIR=${php5pear.installer}/pear/tests \
    126                       PHP_PEAR_SYSCONF_DIR=${php5pear.installer}
    127   # Args placed after php or pear commands.
    128   php5pear.cmd-post   -c ${php5pear.installer}/pear.conf \
    129                       -C ${php5pear.installer}/pear.conf
    130  
    131   extract.mkdir       yes
    132   extract.post_args   "| tar --strip-components 1 -x -f - -C '${php5pear.sourceroot}'"
    133 
    134   pre-extract {
    135     xinstall -d ${php5pear.sourceroot}
    136   }
    137 
    138   post-extract {
    139     # Get the name of our package xml file.
    140     php5pear.packagexml [lindex [exec tar -tzf ${distpath}/${distname}${extract.suffix} | grep package.*\.xml] 0]
    141     # The "--strip-components 1" causes the loss of our package file so we will extract it now.
    142     system "tar -z -x -v -f '${distpath}/${distname}${extract.suffix}' - -C '${php5pear.sourceroot}' ${php5pear.packagexml}"
    143     # Install the pear command using the phar file.
    144     system "${php5pear.cmd-pre} ${php5pear.cmd-php} ${php5pear.cmd-phar}"
    145   }
    146 
    147   post-patch {
    148     # Some ports use a "." baseinstalldir which can cause issues creating pears packagingroot directory.
    149     reinplace "s|baseinstalldir=\"\.\"|baseinstalldir=\"/\"|g" \
    150       ${php5pear.sourceroot}/${php5pear.packagexml}
    151   }
    152 
    153   configure {
    154     # Set up pear's conf file.
    155     # The order appears to be important; we get errors if we set php_dir before adding channels
    156     # and the directory is not writable.
    157     xinstall -d "${php5pear.installer}/pear/php"
    158     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set auto_discover 1"
    159     if { "${php5pear.channel}" != "pear.php.net" } {
    160       system "curl -s http://${php5pear.channel}/channel.xml -o ${worksrcpath}/channel.xml"
    161       system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} channel-add ${worksrcpath}/channel.xml"
    162       system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set default_channel ${php5pear.channel}"
    163     }
    164     # Change the install directories to the final destinations
    165     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set php_dir ${php5pear.pearpath}"
    166     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set bin_dir ${php5pear.pearpath}/bin"
    167     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set doc_dir ${php5pear.pearpath}/docs"
    168     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set data_dir ${php5pear.pearpath}/data"
    169     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set www_dir ${php5pear.pearpath}/www"
    170     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set test_dir ${php5pear.pearpath}/tests"
    171     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-show"
    172   }
    173  
    174   build {
    175     # Get the name of our package xml file.
    176     php5pear.packagexml [lindex [exec tar -tzf ${distpath}/${distname}${extract.suffix} | grep package.*\.xml] 0]
    177     # Install our package into our pear's packagingroot.
    178     system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} install -n -f -P '${php5pear.destroot}' ${php5pear.packagexml}"
    179   }
    180  
    181   destroot {
    182     copy ${php5pear.destroot}${php5pear.instpath} ${destroot}${prefix}/lib
    183     # Remove all invisible "dot" files.
    184     fs-traverse -ignoreErrors item "${destroot}${php5pear.instpath}" {
    185       if {[string first . [file tail ${item}] 0] == 0} {
    186         # Using system rm because I could not find a way to delete dot files with [file delete].
    187         system "rm -R ${item}"
    188       }
    189     }
    190     if { [file exists "${destroot}${php5pear.pearpath}/generate_package_xml.php"] } {
    191       # Some pear packages contain package creation files so we remove them.
    192       delete "${destroot}${php5pear.pearpath}/generate_package_xml.php"
    193     }
    194     if { [file exists "${destroot}${php5pear.pearpath}/package.php"] } {
    195       # Some pear packages contain package creation files so we remove them.
    196       delete "${destroot}${php5pear.pearpath}/package.php"
    197     }
    198   }
    199  
     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
     65   
     66    # The pear name for the package.
     67    php5pear.package    ${php5pear.package}
     68    # 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
     89   
     90    # List of ports that pear-PEAR depends on.
     91    if {
     92        ${name} != "pear-Archive_Tar" &&
     93        ${name} != "pear-Console_Getopt" &&
     94        ${name} != "pear-Structures_Graph" &&
     95        ${name} != "pear-XML_Util" &&
     96        ${name} != "pear-PEAR"
     97    } {
     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        PHP_PEAR_INSTALL_DIR=${php5pear.installer}/pear \
     122        PHP_PEAR_BIN_DIR=${php5pear.installer}/bin \
     123        PHP_PEAR_PHP_BIN=${php5pear.cmd-php} \
     124        PHP_PEAR_CFG_DIR=${php5pear.installer}/pear/cfg \
     125        PHP_PEAR_DOC_DIR=${php5pear.installer}/pear/docs \
     126        PHP_PEAR_DATA_DIR=${php5pear.installer}/pear/data \
     127        PHP_PEAR_WWW_DIR=${php5pear.installer}/pear/www \
     128        PHP_PEAR_TEST_DIR=${php5pear.installer}/pear/tests \
     129        PHP_PEAR_SYSCONF_DIR=${php5pear.installer}
     130    # Args placed after php or pear commands.
     131    php5pear.cmd-post \
     132        -c ${php5pear.installer}/pear.conf \
     133        -C ${php5pear.installer}/pear.conf
     134   
     135    extract.mkdir       yes
     136    extract.post_args   "| tar --strip-components 1 -x -f - -C '${php5pear.sourceroot}'"
     137   
     138    pre-extract {
     139        xinstall -d ${php5pear.sourceroot}
     140    }
     141   
     142    post-extract {
     143        # Get the name of our package xml file.
     144        php5pear.packagexml [lindex [exec tar -tzf ${distpath}/${distname}${extract.suffix} | grep package.*\.xml] 0]
     145        # The "--strip-components 1" causes the loss of our package file so we will extract it now.
     146        system "tar -z -x -v -f '${distpath}/${distname}${extract.suffix}' - -C '${php5pear.sourceroot}' ${php5pear.packagexml}"
     147        # Install the pear command using the phar file.
     148        system "${php5pear.cmd-pre} ${php5pear.cmd-php} ${php5pear.cmd-phar}"
     149    }
     150   
     151    post-patch {
     152        # Some ports use a "." baseinstalldir which can cause issues creating pears packagingroot directory.
     153        reinplace "s|baseinstalldir=\"\.\"|baseinstalldir=\"/\"|g" \
     154          ${php5pear.sourceroot}/${php5pear.packagexml}
     155    }
     156   
     157    configure {
     158        # Set up pear's conf file.
     159        # The order appears to be important; we get errors if we set php_dir before adding channels
     160        # and the directory is not writable.
     161        xinstall -d "${php5pear.installer}/pear/php"
     162        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set auto_discover 1"
     163        if { "${php5pear.channel}" != "pear.php.net" } {
     164            system "curl -s http://${php5pear.channel}/channel.xml -o ${worksrcpath}/channel.xml"
     165            system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} channel-add ${worksrcpath}/channel.xml"
     166            system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set default_channel ${php5pear.channel}"
     167        }
     168        # Change the install directories to the final destinations
     169        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set php_dir ${php5pear.pearpath}"
     170        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set bin_dir ${php5pear.pearpath}/bin"
     171        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set doc_dir ${php5pear.pearpath}/docs"
     172        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set data_dir ${php5pear.pearpath}/data"
     173        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set www_dir ${php5pear.pearpath}/www"
     174        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-set test_dir ${php5pear.pearpath}/tests"
     175        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} config-show"
     176    }
     177   
     178    build {
     179        # Get the name of our package xml file.
     180        php5pear.packagexml [lindex [exec tar -tzf ${distpath}/${distname}${extract.suffix} | grep package.*\.xml] 0]
     181        # Install our package into our pear's packagingroot.
     182        system "${php5pear.cmd-pre} ${php5pear.cmd-pear} ${php5pear.cmd-post} install -n -f -P '${php5pear.destroot}' ${php5pear.packagexml}"
     183    }
     184   
     185    destroot {
     186        copy ${php5pear.destroot}${php5pear.instpath} ${destroot}${prefix}/lib
     187        # Remove all invisible "dot" files.
     188        fs-traverse -ignoreErrors item "${destroot}${php5pear.instpath}" {
     189            if {[string first . [file tail ${item}] 0] == 0} {
     190                # Using system rm because I could not find a way to delete dot files with [file delete].
     191                system "rm -R ${item}"
     192            }
     193        }
     194        if { [file exists "${destroot}${php5pear.pearpath}/generate_package_xml.php"] } {
     195            # Some pear packages contain package creation files so we remove them.
     196            delete "${destroot}${php5pear.pearpath}/generate_package_xml.php"
     197        }
     198        if { [file exists "${destroot}${php5pear.pearpath}/package.php"] } {
     199            # Some pear packages contain package creation files so we remove them.
     200            delete "${destroot}${php5pear.pearpath}/package.php"
     201        }
     202    }
    200203}
Note: See TracChangeset for help on using the changeset viewer.