Subversion Repositories Applications.gtt

Rev

Rev 94 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 jpm 1
<?php
2
/**
3
 * PEAR_Command_Auth (build command)
4
 *
5
 * PHP versions 4 and 5
6
 *
7
 * @category   pear
8
 * @package    PEAR
9
 * @author     Stig Bakken <ssb@php.net>
10
 * @author     Tomas V.V.Cox <cox@idecnet.com>
11
 * @author     Greg Beaver <cellog@php.net>
187 mathias 12
 * @copyright  1997-2009 The Authors
13
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
94 jpm 14
 * @link       http://pear.php.net/package/PEAR
15
 * @since      File available since Release 0.1
16
 */
17
 
18
/**
19
 * base class
20
 */
21
require_once 'PEAR/Command/Common.php';
22
 
23
/**
24
 * PEAR commands for building extensions.
25
 *
26
 * @category   pear
27
 * @package    PEAR
28
 * @author     Stig Bakken <ssb@php.net>
29
 * @author     Tomas V.V.Cox <cox@idecnet.com>
30
 * @author     Greg Beaver <cellog@php.net>
187 mathias 31
 * @copyright  1997-2009 The Authors
32
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
33
 * @version    Release: 1.10.1
94 jpm 34
 * @link       http://pear.php.net/package/PEAR
35
 * @since      Class available since Release 0.1
36
 */
37
class PEAR_Command_Build extends PEAR_Command_Common
38
{
39
    var $commands = array(
40
        'build' => array(
41
            'summary' => 'Build an Extension From C Source',
42
            'function' => 'doBuild',
43
            'shortcut' => 'b',
44
            'options' => array(),
45
            'doc' => '[package.xml]
46
Builds one or more extensions contained in a package.'
47
            ),
48
        );
49
 
50
    /**
51
     * PEAR_Command_Build constructor.
52
     *
53
     * @access public
54
     */
187 mathias 55
    function __construct(&$ui, &$config)
94 jpm 56
    {
187 mathias 57
        parent::__construct($ui, $config);
94 jpm 58
    }
59
 
60
    function doBuild($command, $options, $params)
61
    {
62
        require_once 'PEAR/Builder.php';
63
        if (sizeof($params) < 1) {
64
            $params[0] = 'package.xml';
65
        }
187 mathias 66
 
67
        $builder = new PEAR_Builder($this->ui);
94 jpm 68
        $this->debug = $this->config->get('verbose');
69
        $err = $builder->build($params[0], array(&$this, 'buildCallback'));
70
        if (PEAR::isError($err)) {
71
            return $err;
72
        }
187 mathias 73
 
94 jpm 74
        return true;
75
    }
76
 
77
    function buildCallback($what, $data)
78
    {
79
        if (($what == 'cmdoutput' && $this->debug > 1) ||
80
            ($what == 'output' && $this->debug > 0)) {
81
            $this->ui->outputData(rtrim($data), 'build');
82
        }
83
    }
84
}