Permalink
Browse files

Add support for pecl to pass configure params to the compiler. pecl i…

…nstall --with-option=test memcached for example will work

git-svn-id: http://svn.php.net/repository/pear/pear-core/pear/pear-core/trunk@306246 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 92fae78 commit 52019185f649783f47c3bb5e68d4390ecc7454d2 dufuz committed Dec 12, 2010
Showing with 75 additions and 26 deletions.
  1. +7 −1 PEAR/Builder.php
  2. +7 −3 PEAR/Installer.php
  3. +29 −20 package2.xml
  4. +32 −2 scripts/pearcmd.php
View
@@ -240,7 +240,7 @@ function _harvestInstDir($dest_prefix, $dirname, &$built_files)
*
* @see PEAR_Builder::_runCommand
*/
- function build($descfile, $callback = null)
+ function build($descfile, $callback = null, $options = array())
{
if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php(.+)?$/',
$this->config->get('php_bin'), $matches)) {
@@ -326,6 +326,12 @@ function build($descfile, $callback = null)
}
// }}} end of interactive part
+ if (!$configure_options && !empty($options)) {
+ foreach ($options as $op) {
+ $configure_command .= ' ' . $op;
+ }
+ }
+
// FIXME make configurable
if(!$user=getenv('USER')){
$user='defaultuser';
View
@@ -1403,8 +1403,12 @@ function install($pkgfile, $options = array())
// compile and install source files
if ($this->source_files > 0 && empty($options['nobuild'])) {
+ if (!isset($options['__compile_configureoptions'])) {
+ $options['__compile_configureoptions'] = array();
+ }
+
if (PEAR::isError($err =
- $this->_compileSourceFiles($savechannel, $pkg))) {
+ $this->_compileSourceFiles($savechannel, $pkg, $options['__compile_configureoptions']))) {
return $err;
}
}
@@ -1497,13 +1501,13 @@ function install($pkgfile, $options = array())
* @param string
* @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
*/
- function _compileSourceFiles($savechannel, &$filelist)
+ function _compileSourceFiles($savechannel, &$filelist, $configure_options = array())
{
require_once 'PEAR/Builder.php';
$this->log(1, "$this->source_files source files, building");
$bob = &new PEAR_Builder($this->ui);
$bob->debug = $this->debug;
- $built = $bob->build($filelist, array(&$this, '_buildCallback'));
+ $built = $bob->build($filelist, array(&$this, '_buildCallback'), $configure_options);
if (PEAR::isError($built)) {
$this->rollbackFileTransaction();
$this->configSet('default_channel', $savechannel);
View
@@ -87,27 +87,25 @@ http://pear.php.net/dtd/package-2.0.xsd">
</helper>
<date>2010-05-26</date>
<version>
- <release>1.9.1</release>
- <api>1.9.1</api>
+ <release>1.9.2</release>
+ <api>1.9.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
- * svntag improvements, tag package files passed into the command and better directory checks [dufuz]
- * rely on Structures_Graph minimum version instead of recommended version [saltybeagle]
- * Fix Bug #12613: running go-pear.phar from C:\ fails [dufuz]
- * Fix Bug #14841: Installing pear into directory with space fails [dufuz]
- * Fix Bug #16644: pear.bat returns syntax error when parenthesis are in install path. [dufuz] [patch by bwaters (Bryan Waters)]
- * Fix Bug #16767: Use of Depreciated HTML Attributes in the Exception class [dufuz] [patch by fuhrysteve (Stephen J. Fuhry)]
- * Fix Bug #16864: "pear list-upgrades -i" issues E_WARNINGS [dufuz] [patch by rquadling (Richard Quadling)]
- * Fix Bug #17220: command `pear help` outputs to stderr instead of stdout [dufuz]
- * Fix Bug #17234: channel-discover adds port to HTTP Host header [dufuz]
- * Fix Bug #17292: Code Coverage in PEAR_RunTest does not work with namespaces [sebastian]
- * Fix Bug #17359: loadExtension() fails over missing dl() when used in multithread env [dufuz]
- * Fix Bug #17378: pear info $package fails if directory with that name exists [dufuz]
+ * Fixed Bug #17463: Regression: On Windows, svntag [patch by doconnor]
+ * Fixed Bug #17641: pecl-list doesn't sort packages by name [dufuz]
+ * Fixed Bug #17781: invalid argument warning on foreach due to an empty optional dependencie [dufuz]
+ * Fixed Bug #17801: PEAR run-tests wrongly detects php-cgi [patch by David Jean Louis (izi)]
+ * Fixed Bug #17839: pear svntag does not tag package.xml file [dufuz]
+ * Fixed Bug #17986: PEAR Installer cannot handle files moved between packages [dufuz]
+ * Fixed Bug #17997: Strange output if directories are not writeable [dufuz]
+ * Fixed Bug #18001: PEAR/RunTest coverage fails [dufuz]
+
+ * Implemented Request #16648: Use TMPDIR for builds instead of /var/tmp [dufuz]
</notes>
<contents>
<dir name="/">
@@ -468,13 +466,13 @@ http://pear.php.net/dtd/package-2.0.xsd">
<name>Structures_Graph</name>
<channel>pear.php.net</channel>
<min>1.0.2</min>
- <recommended>1.0.3</recommended>
+ <recommended>1.0.4</recommended>
</package>
<package>
<name>Console_Getopt</name>
<channel>pear.php.net</channel>
- <min>1.2</min>
- <recommended>1.2.3</recommended>
+ <min>1.3.0</min>
+ <recommended>1.3.0</recommended>
</package>
<package>
<name>XML_Util</name>
@@ -861,7 +859,7 @@ Alpha1 Release Notes:
</notes>
</release>
<release>
- <date>2009-10-10</date>
+ <date>2010-05-26</date>
<version>
<release>1.9.1</release>
<api>1.9.1</api>
@@ -872,8 +870,19 @@ Alpha1 Release Notes:
</stability>
<license uri="http://opensource.org/licenses/bsd-license.php">New BSD License</license>
<notes>
- * svntag improvements, tag package files passed into the command and better directory checks [dufuz]
+ * svntag improvements, tag package files passed into the command and better directory checks [dufuz]
+ * rely on Structures_Graph minimum version instead of recommended version [saltybeagle]
+ * Fix Bug #12613: running go-pear.phar from C:\ fails [dufuz]
+ * Fix Bug #14841: Installing pear into directory with space fails [dufuz]
+ * Fix Bug #16644: pear.bat returns syntax error when parenthesis are in install path. [dufuz] [patch by bwaters (Bryan Waters)]
+ * Fix Bug #16767: Use of Depreciated HTML Attributes in the Exception class [dufuz] [patch by fuhrysteve (Stephen J. Fuhry)]
+ * Fix Bug #16864: "pear list-upgrades -i" issues E_WARNINGS [dufuz] [patch by rquadling (Richard Quadling)]
+ * Fix Bug #17220: command `pear help` outputs to stderr instead of stdout [dufuz]
+ * Fix Bug #17234: channel-discover adds port to HTTP Host header [dufuz]
+ * Fix Bug #17292: Code Coverage in PEAR_RunTest does not work with namespaces [sebastian]
+ * Fix Bug #17359: loadExtension() fails over missing dl() when used in multithread env [dufuz]
+ * Fix Bug #17378: pear info $package fails if directory with that name exists [dufuz]
</notes>
</release>
</changelog>
-</package>
+</package>
View
@@ -21,7 +21,9 @@
// this is defined in peclcmd.php as 'pecl'
define('PEAR_RUNTYPE', 'pear');
}
+
define('PEAR_IGNORE_BACKTRACE', 1);
+
/**
* @nodep Gtk
*/
@@ -32,6 +34,7 @@
// this is a raw, uninstalled pear, either a cvs checkout, or php distro
$raw = true;
}
+
@ini_set('allow_url_fopen', true);
if (!ini_get('safe_mode')) {
@set_time_limit(0);
@@ -67,6 +70,7 @@
unset($argv[1]);
$argv = array_values($argv);
}
+
$progname = PEAR_RUNTYPE;
array_shift($argv);
$options = Console_Getopt::getopt2($argv, "c:C:d:D:Gh?sSqu:vV");
@@ -274,14 +278,40 @@
$short_args = $long_args = null;
PEAR_Command::getGetoptArgs($command, $short_args, $long_args);
array_shift($options[1]);
- $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args);
+
+ $skip_unknown = $progname === 'pecl' ? true : false;
+ $tmp = Console_Getopt::getopt2($options[1], $short_args, $long_args, $skip_unknown);
if (PEAR::isError($tmp)) {
break;
}
- list($tmpopt, $params) = $tmp;
$opts = array();
+ // Gather any extra params which may be passed on to compile
+ if ($skip_unknown === true) {
+ $o = $options[1];
+ foreach (str_split($short_args) as $sa) {
+ $pos = array_search('-' . $sa, $o);
+ if ($pos !== false) {
+ unset($o[$pos]);
+ }
+ }
+
+ foreach ($long_args as $la) {
+ $pos = array_search('--' . $la, $o);
+ if ($pos !== false) {
+ unset($o[$pos]);
+ }
+ }
+
+ reset($o);
+ array_pop($o);
+ if (!empty($o)) {
+ $opts['__compile_configureoptions'] = $o;
+ }
+ }
+
+ list($tmpopt, $params) = $tmp;
foreach ($tmpopt as $foo => $tmp2) {
list($opt, $value) = $tmp2;
if ($value === null) {

0 comments on commit 5201918

Please sign in to comment.