svn: /pear/pear-core/trunk/ PEAR/Builder.php PEAR/Installer.php package2.xml scripts/pearcmd.php

[email protected] (Helgi Þormar Þorbjörnsson) Sun, 12 Dec 2010 01:46:42 +0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <[email protected]>
dufuz                                    Sun, 12 Dec 2010 01:46:42 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306246

Log:
Add support for pecl to pass configure params to the compiler. pecl install --with-option=test memcached  for example will work

Changed paths:
    U   pear/pear-core/trunk/PEAR/Builder.php
    U   pear/pear-core/trunk/PEAR/Installer.php
    U   pear/pear-core/trunk/package2.xml
    U   pear/pear-core/trunk/scripts/pearcmd.php
svn-diffs-306246.txt (text/x-diff, 9.2 KB)
Modified: pear/pear-core/trunk/PEAR/Builder.php
===================================================================
--- pear/pear-core/trunk/PEAR/Builder.php	2010-12-12 01:40:31 UTC (rev 306245)
+++ pear/pear-core/trunk/PEAR/Builder.php	2010-12-12 01:46:42 UTC (rev 306246)
@@ -240,7 +240,7 @@
      *
      * @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 @@
         }
         // }}} 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';

Modified: pear/pear-core/trunk/PEAR/Installer.php
===================================================================
--- pear/pear-core/trunk/PEAR/Installer.php	2010-12-12 01:40:31 UTC (rev 306245)
+++ pear/pear-core/trunk/PEAR/Installer.php	2010-12-12 01:46:42 UTC (rev 306246)
@@ -1403,8 +1403,12 @@

         // 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 @@
      * @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);

Modified: pear/pear-core/trunk/package2.xml
===================================================================
--- pear/pear-core/trunk/package2.xml	2010-12-12 01:40:31 UTC (rev 306245)
+++ pear/pear-core/trunk/package2.xml	2010-12-12 01:46:42 UTC (rev 306246)
@@ -87,8 +87,8 @@
  </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>
@@ -96,18 +96,16 @@
  </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 @@
     <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 @@
  </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 @@
  </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>
\ No newline at end of file

Modified: pear/pear-core/trunk/scripts/pearcmd.php
===================================================================
--- pear/pear-core/trunk/scripts/pearcmd.php	2010-12-12 01:40:31 UTC (rev 306245)
+++ pear/pear-core/trunk/scripts/pearcmd.php	2010-12-12 01:46:42 UTC (rev 306246)
@@ -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;
     }

+    $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;
-    $opts = array();
     foreach ($tmpopt as $foo => $tmp2) {
         list($opt, $value) = $tmp2;
         if ($value === null) {