12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- require_once 'PEAR/Command/Common.php';
- 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(
- 'configureoptions' => array(
- 'shortopt' => 'D',
- 'arg' => 'OPTION1=VALUE[ OPTION2=VALUE]',
- 'doc' => 'space-delimited list of configure options',
- ),
- ),
- 'doc' => '[package.xml]
- Builds one or more extensions contained in a package.'
- ),
- );
-
- function __construct(&$ui, &$config)
- {
- parent::__construct($ui, $config);
- }
- function doBuild($command, $options, $params)
- {
- require_once 'PEAR/Builder.php';
- if (sizeof($params) < 1) {
- $params[0] = 'package.xml';
- }
- $configureoptions = empty($options['configureoptions']) ? '' : $options['configureoptions'];
- $builder = new PEAR_Builder($configureoptions, $this->ui);
- $this->debug = $this->config->get('verbose');
- $err = $builder->build($params[0], array(&$this, 'buildCallback'));
- if (PEAR::isError($err)) {
- return $err;
- }
- return true;
- }
- function buildCallback($what, $data)
- {
- if (($what == 'cmdoutput' && $this->debug > 1) ||
- ($what == 'output' && $this->debug > 0)) {
- $this->ui->outputData(rtrim($data), 'build');
- }
- }
- }
|