diff options
author | Stig Bakken <ssb@php.net> | 2002-05-28 01:01:43 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2002-05-28 01:01:43 +0000 |
commit | ecf93ec1fdb351e533b1e193822622782318794e (patch) | |
tree | 4fc1788f19607e43085ac4151d0d69a8f6e453e2 | |
parent | 599cede43e801b90c3325adee19b80cfeb81f3ae (diff) | |
download | php-git-ecf93ec1fdb351e533b1e193822622782318794e.tar.gz |
* update 0.11 release notes
* move build logic into PEAR_Builder
-rw-r--r-- | pear/PEAR/Builder.php | 106 | ||||
-rw-r--r-- | pear/PEAR/Command/Build.php | 48 | ||||
-rw-r--r-- | pear/package-PEAR.xml | 5 |
3 files changed, 120 insertions, 39 deletions
diff --git a/pear/PEAR/Builder.php b/pear/PEAR/Builder.php new file mode 100644 index 0000000000..8cf44b5f6d --- /dev/null +++ b/pear/PEAR/Builder.php @@ -0,0 +1,106 @@ +<?php +// +// +----------------------------------------------------------------------+ +// | PHP Version 4 | +// +----------------------------------------------------------------------+ +// | Copyright (c) 1997-2002 The PHP Group | +// +----------------------------------------------------------------------+ +// | This source file is subject to version 2.02 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is | +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | license@php.net so we can mail you a copy immediately. | +// +----------------------------------------------------------------------+ +// | Authors: Stig Sæther Bakken <ssb@fast.no> | +// +----------------------------------------------------------------------+ +// +// $Id$ + +require_once 'PEAR/Common.php'; + +/** + * Class to handle building (compiling) extensions. + * + * @author Stig Sæther Bakken <ssb@fast.no> + */ +class PEAR_Builder extends PEAR_Common +{ + // {{{ properties + + // }}} + + // {{{ constructor + + /** + * PEAR_Builder constructor. + * + * @param object $ui user interface object (instance of PEAR_Frontend_*) + * + * @access public + */ + function PEAR_Builder(&$ui) + { + $this->PEAR_Common(); + $this->setFrontendObject($ui); + } + + function build($descfile, $callback = null) + { + if (PEAR::isError($info = $this->infoFromDescriptionFile($descfile))) { + return $info; + } + $configure_command = "./configure"; + if (isset($info['configure_options'])) { + foreach ($info['configure_options'] as $o) { + $r = $this->ui->userDialog($o['prompt'], 'text', @$o['default']); + if (substr($o['name'], 0, 5) == 'with-' && + ($r == 'yes' || $r == 'autodetect')) { + $configure_command .= " --$o[name]"; + } else { + $configure_command .= " --$o[name]=$r"; + } + } + } + if (isset($_ENV['MAKE'])) { + $make_command = $_ENV['MAKE']; + } else { + $make_command = 'make'; + } + $to_run = array( + "phpize", + $configure_command, + $make_command, + ); + foreach ($to_run as $cmd) { + $err = $this->_runCommand($cmd, $callback); + if (PEAR::isError($err)) { + return $err; + } + if (!$err) { + break; + } + } + return true; + + } + + // }}} + + + function _runCommand($command, $callback = null) + { + $pp = @popen($command, "r"); + if (!$pp) { + return $this->raiseError("failed to run `$command'"); + } + while ($line = fgets($pp, 1024)) { + call_user_func($callback, 'output', $line); + } + pclose($pp); + return true; + } +} + +?> diff --git a/pear/PEAR/Command/Build.php b/pear/PEAR/Command/Build.php index 6a661eb9f4..ee03d09201 100644 --- a/pear/PEAR/Command/Build.php +++ b/pear/PEAR/Command/Build.php @@ -21,6 +21,7 @@ // $Id$ require_once "PEAR/Command/Common.php"; +require_once "PEAR/Builder.php"; /** * PEAR commands for building extensions. @@ -54,49 +55,20 @@ Builds one or more extensions contained in a package.' if (sizeof($params) < 1) { $params[0] = 'package.xml'; } - $obj = &new PEAR_Common(); - if (PEAR::isError($info = $obj->infoFromAny($params[0]))) { - return $info; - } - $configure_command = "./configure"; - if (isset($info['configure_options'])) { - foreach ($info['configure_options'] as $o) { - $r = $this->ui->userDialog($o['prompt'], 'text', @$o['default']); - if ($r == 'yes' && substr($o['name'], 0, 5) == 'with-') { - $configure_command .= " --$o[name]"; - } else { - $configure_command .= " --$o[name]=$r"; - } - } - } - if (isset($_ENV['MAKE'])) { - $make_command = $_ENV['MAKE']; - } else { - $make_command = 'make'; - } - $to_run = array( - "phpize", - $configure_command, - $make_command, - ); - foreach ($to_run as $cmd) { - if (PEAR::isError($err = $this->_runCommand($cmd))) { - return $err; - } + $builder = &new PEAR_Builder($this->ui); + $err = $builder->build($params[0], array(&$this, 'buildCallback')); + if (PEAR::isError($err)) { + return $err; } return true; } - function _runCommand($command) + function buildCallback($what, $data) { - $pp = @popen($command, "r"); - if (!$pp) { - return $this->raiseError("failed to run `$command'"); - } - while ($line = fgets($pp, 1024)) { - $this->ui->displayLine(rtrim($line)); + switch ($what) { + case 'output': + $this->ui->displayLine(rtrim($data)); + break; } - pclose($pp); - } } diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml index a049d6895b..ae5a41ca55 100644 --- a/pear/package-PEAR.xml +++ b/pear/package-PEAR.xml @@ -35,11 +35,13 @@ <state>beta</state> <date>YYYY-MM-DD</date> <notes> -* fixed broken "help" command +* fix: "help" command was broken * new command: "info" * new command: "config-help" * un-indent multi-line data from xml description files * new command: "build" +* fix: config-set did not work with "set" parameters +* disable magic_quotes_runtime </notes> <filelist> <file role="data" name="package.dtd"/> @@ -65,6 +67,7 @@ <file role="php" name="CLI.php"/> <file role="php" name="Gtk.php"/> </dir> + <file role="php" name="Builder.php"/> <file role="php" name="Installer.php"/> <file role="php" name="Packager.php"/> <file role="php" name="Registry.php"/> |