Commit:    cbf35f91a099d5b3efddcbd047838ed601035623
Author:    Anatol Belski <[email protected]>         Mon, 16 Sep 2013 12:51:10 +0200
Parents:   5e9d6016834e7cad14af3768a2de66fc7ec3e54c
Branches:  master

Link:       
http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=cbf35f91a099d5b3efddcbd047838ed601035623

Log:
implemented possibility for mor specific ext config

Changed paths:
  M  client/data/config/pecl/exts.ini
  M  client/include/PeclExt.php


Diff:
diff --git a/client/data/config/pecl/exts.ini b/client/data/config/pecl/exts.ini
index d4a795d..d156bbb 100644
--- a/client/data/config/pecl/exts.ini
+++ b/client/data/config/pecl/exts.ini
@@ -1,3 +1,33 @@
+; Possible section names are
+; someext
+; someext-5.5
+; someext-nts
+; someext-vc11
+; someext-x64
+; someext-5.5-nts
+; someext-5.5-vc11
+; someext-5.5-x64
+; someext-nts-vc11
+; someext-nts-x64
+; someext-vc11-x64
+; someext-5.5-nts-vc11
+; someext-5.5-nts-x64
+; someext-5.5-vc11-x64
+; someext-nts-vc11-x64
+; someext-5.5-nts-vc11-x64
+; The last one in this list is the full name with PHP version, branch, ts/nts,
+; tompiler and arch. You can ommit any of those but preserver the order. If
+; more than just the extension name is used, the section will be used only
+; for that specific combination.
+;
+; Possibe keys
+; real_name= - override the extension name from the package
+; type=      - use --enable-someext or --with-someext
+; libs[]=    - library dependencies array
+; exts[]=    - extension dependencies array
+; opts[]=    - additional configure options dependency array
+;
+
 [ssh2]
 type=enable
 libs[]=
@@ -227,10 +257,17 @@ libs[]=pdflib
 exts[]=
 opts[]=
 
-[oci8]
+[oci8-x86]
+type=with
+libs[]=
+exts[]=
+opts[]=--with-oci8=C:\pecl-dep-libs\oracle\x86\instantclient_10_2\sdk,shared
+opts[]=--with-oci8-11g=C:\pecl-dep-libs\oracle\x86\instantclient_11_2\sdk,shared
+
+[oci8-x64]
 type=with
 libs[]=
 exts[]=
-opts[]=--with-oci8=C:\pecl-dep-libs\oracle\instantclient_10_2\sdk,shared
-opts[]=--with-oci8-11g=C:\pecl-dep-libs\oracle\instantclient_11_2\sdk,shared
+opts[]=--with-oci8=C:\pecl-dep-libs\oracle\x64\instantclient_10_2\sdk,shared
+opts[]=--with-oci8-11g=C:\pecl-dep-libs\oracle\x64\instantclient_11_2\sdk,shared
 
diff --git a/client/include/PeclExt.php b/client/include/PeclExt.php
index ed761a4..013e5d3 100644
--- a/client/include/PeclExt.php
+++ b/client/include/PeclExt.php
@@ -320,6 +320,48 @@ class PeclExt
                return $ret;
        }
 
+       protected function complexPkgNameMatch($cnf_name) {
+               $full_set = array(
+                       $this->build->branch->config->getBranch(),
+                       ($this->build->thread_safe ? 'ts' : 'nts'),
+                       $this->build->compiler,
+                       $this->build->architecture,
+               );
+
+if (!function_exists('rmtools\combinations')) {
+               function combinations($arr, $level, &$result, $that, 
$curr=array()) {
+                       for($i = 0; $i < count($arr); $i++) {
+                               $new = array_merge($curr, array($arr[$i]));
+                               if($level == 1) {
+                                       /* preserve order */
+                                       sort($new);
+                                       /* no repititions */
+                                       $new = array_unique($new);
+                                       $name = $that->getName() . '-' . 
implode('-', $new);
+                                       if (!in_array($name, $result)) {
+                                               $result[] = $name;
+                                       }
+                               } else {
+                                       combinations($arr, $level - 1, $result, 
$that, $new);
+                               }
+                       }
+               }
+}
+
+               $names = array();
+               for ($i = 0; $i<count($full_set); $i++) {
+                       combinations($full_set, $i+1, $names, $this);
+               }
+
+               foreach ($names as $name) {
+                       if ($name === $cnf_name) {
+                               return true;
+                       }
+               }
+
+               return false;
+       }
+
        public function getPackageConfig()
        {
                $config = NULL;
@@ -327,9 +369,20 @@ class PeclExt
                $known_path = __DIR__ . '/../data/config/pecl/exts.ini';
                $exts = parse_ini_file($known_path, true, INI_SCANNER_RAW);
 
+               /* Check for like myext-5.3-ts-vc9-x86 */
                foreach ($exts as $name => $conf) {
-                       if ($name === $this->name) {
+                       if ($this->complexPkgNameMatch($name)) {
                                $config = $conf;
+                               break;
+                       }
+               }
+
+               if (!$config) {
+                       foreach ($exts as $name => $conf) {
+                               if ($name === $this->name) {
+                                       $config = $conf;
+                                       break;
+                               }
                        }
                }


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to