2010-03-10 15:03:40 +03:00
|
|
|
<?php
|
2012-05-11 19:57:55 +04:00
|
|
|
/**
|
|
|
|
* PEAR_Command_Auth (build command)
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* @category pear
|
|
|
|
* @package PEAR
|
|
|
|
* @author Stig Bakken <ssb@php.net>
|
|
|
|
* @author Tomas V.V.Cox <cox@idecnet.com>
|
|
|
|
* @author Greg Beaver <cellog@php.net>
|
|
|
|
* @copyright 1997-2009 The Authors
|
|
|
|
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
|
|
|
* @version CVS: $Id: Build.php 313023 2011-07-06 19:17:11Z dufuz $
|
|
|
|
* @link http://pear.php.net/package/PEAR
|
|
|
|
* @since File available since Release 0.1
|
|
|
|
*/
|
2010-03-10 15:03:40 +03:00
|
|
|
|
2012-05-11 19:57:55 +04:00
|
|
|
/**
|
|
|
|
* base class
|
|
|
|
*/
|
|
|
|
require_once 'PEAR/Command/Common.php';
|
2010-03-10 15:03:40 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* PEAR commands for building extensions.
|
|
|
|
*
|
2012-05-11 19:57:55 +04:00
|
|
|
* @category pear
|
|
|
|
* @package PEAR
|
|
|
|
* @author Stig Bakken <ssb@php.net>
|
|
|
|
* @author Tomas V.V.Cox <cox@idecnet.com>
|
|
|
|
* @author Greg Beaver <cellog@php.net>
|
|
|
|
* @copyright 1997-2009 The Authors
|
|
|
|
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
|
|
|
* @version Release: 1.9.4
|
|
|
|
* @link http://pear.php.net/package/PEAR
|
|
|
|
* @since Class available since Release 0.1
|
2010-03-10 15:03:40 +03:00
|
|
|
*/
|
|
|
|
class PEAR_Command_Build extends PEAR_Command_Common
|
|
|
|
{
|
|
|
|
var $commands = array(
|
|
|
|
'build' => array(
|
|
|
|
'summary' => 'Build an Extension From C Source',
|
|
|
|
'function' => 'doBuild',
|
|
|
|
'shortcut' => 'b',
|
|
|
|
'options' => array(),
|
|
|
|
'doc' => '[package.xml]
|
|
|
|
Builds one or more extensions contained in a package.'
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PEAR_Command_Build constructor.
|
|
|
|
*
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
function PEAR_Command_Build(&$ui, &$config)
|
|
|
|
{
|
|
|
|
parent::PEAR_Command_Common($ui, $config);
|
|
|
|
}
|
|
|
|
|
|
|
|
function doBuild($command, $options, $params)
|
|
|
|
{
|
2012-05-11 19:57:55 +04:00
|
|
|
require_once 'PEAR/Builder.php';
|
2010-03-10 15:03:40 +03:00
|
|
|
if (sizeof($params) < 1) {
|
|
|
|
$params[0] = 'package.xml';
|
|
|
|
}
|
2012-05-11 19:57:55 +04:00
|
|
|
|
2010-03-10 15:03:40 +03:00
|
|
|
$builder = &new PEAR_Builder($this->ui);
|
|
|
|
$this->debug = $this->config->get('verbose');
|
|
|
|
$err = $builder->build($params[0], array(&$this, 'buildCallback'));
|
|
|
|
if (PEAR::isError($err)) {
|
|
|
|
return $err;
|
|
|
|
}
|
2012-05-11 19:57:55 +04:00
|
|
|
|
2010-03-10 15:03:40 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildCallback($what, $data)
|
|
|
|
{
|
|
|
|
if (($what == 'cmdoutput' && $this->debug > 1) ||
|
|
|
|
($what == 'output' && $this->debug > 0)) {
|
|
|
|
$this->ui->outputData(rtrim($data), 'build');
|
|
|
|
}
|
|
|
|
}
|
2012-05-11 19:57:55 +04:00
|
|
|
}
|