Updated PEAR and PEAR packages.
[timetracker.git] / WEB-INF / lib / pear / PEAR / Command / Build.php
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>
12  * @copyright  1997-2009 The Authors
13  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
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>
31  * @copyright  1997-2009 The Authors
32  * @license    http://opensource.org/licenses/bsd-license.php New BSD License
33  * @version    Release: 1.10.1
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      */
55     function __construct(&$ui, &$config)
56     {
57         parent::__construct($ui, $config);
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         }
66
67         $builder = new PEAR_Builder($this->ui);
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         }
73
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 }