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