cvs: pear /CodeGen_PECL/PECL ExtensionParser.php /CodeGen_PECL/PECL/Dependency With.php
| From: | Hartmut Holzgraefe | Date: | Mon, 21 Aug 2006 14:08:48 +0000 |
| Subject: | cvs: pear /CodeGen_PECL/PECL ExtensionParser.php /CodeGen_PECL/PECL/Dependency With.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-41787@lists.php.net to get a copy of this message | ||
hholzgra Mon Aug 21 14:08:48 2006 UTC
Modified files:
/pear/CodeGen_PECL/PECL/Dependency With.php
/pear/CodeGen_PECL/PECL ExtensionParser.php
Log:
added pkg-config version checks
http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/Dependency/With.php?r1=1.10&r2=1.11&diff_format=u
Index: pear/CodeGen_PECL/PECL/Dependency/With.php
diff -u pear/CodeGen_PECL/PECL/Dependency/With.php:1.10
pear/CodeGen_PECL/PECL/Dependency/With.php:1.11
--- pear/CodeGen_PECL/PECL/Dependency/With.php:1.10 Mon Aug 14 17:09:03 2006
+++ pear/CodeGen_PECL/PECL/Dependency/With.php Mon Aug 21 14:08:47 2006
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: With.php,v 1.10 2006/08/14 17:09:03 hholzgra Exp $
+ * @version CVS: $Id: With.php,v 1.11 2006/08/21 14:08:47 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen
*/
@@ -103,6 +103,13 @@
protected $mode = "default";
/**
+ * required version
+ *
+ * @var string
+ */
+ protected $version = "";
+
+ /**
* name getter
*
* @param string
@@ -222,6 +229,16 @@
}
/**
+ * version setter
+ *
+ * @param string
+ */
+ function setVersion($version)
+ {
+ $this->version = $version;
+ }
+
+ /**
* add library dependency
*
* @param object
@@ -315,14 +332,36 @@
switch ($this->mode) {
case "pkg-config":
- // TODO support --with-pkgconfig
- // TODO check "--exists" first
- // TODO add version checks
- $code.= " if test -z \"\$PKG_CONFIG\"; then\n";
- $code.= " AC_PATH_PROG(PKG_CONFIG, pkg-config, no)\n";
- $code.= " fi\n";
- $code.= " PHP_EVAL_INCLINE(
\$PKG_CONFIG --cflags-only-I
$withName)\n";
- $code.= " PHP_EVAL_LIBLINE(\$PKG_CONFIG --libs $withName,
{$extUpname}_SHARED_LIBADD)\n\n";
+ $code.= "
+ if test -z \"\$PKG_CONFIG\"
+ then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ fi
+ if test \"$PKG_CONFIG\" = \"no\"
+ then
+ AC_MSG_ERROR([required utility 'pkg-config' not found])
+ fi
+
+ if ! \$PKG_CONFIG --exists $withName
+ then
+ AC_MSG_ERROR(['$withName' not known to pkg-config])
+ fi
+";
+
+ if ($this->version) {
+ $code .= "
+ if ! \$PKG_CONFIG --atleast-version {$this->version} $withName
+ then
+ PKG_VERSION=\$PKG_CONFIG --modversion $withName
+ AC_MSG_ERROR(['$withName'\ is version \$PKG_VERSION, {$this->version} required])
+ fi
+";
+ }
+
+ $code .= "
+ PHP_EVAL_INCLINE(\$PKG_CONFIG --cflags-only-I $withName)
+ PHP_EVAL_LIBLINE(\$PKG_CONFIG --libs $withName, {$extUpname}_SHARED_LIBADD)
+";
break;
default:
http://cvs.php.net/viewvc.cgi/pear/CodeGen_PECL/PECL/ExtensionParser.php?r1=1.49&r2=1.50&diff_format=u
Index: pear/CodeGen_PECL/PECL/ExtensionParser.php
diff -u pear/CodeGen_PECL/PECL/ExtensionParser.php:1.49
pear/CodeGen_PECL/PECL/ExtensionParser.php:1.50
--- pear/CodeGen_PECL/PECL/ExtensionParser.php:1.49 Fri Aug 18 14:13:03 2006
+++ pear/CodeGen_PECL/PECL/ExtensionParser.php Mon Aug 21 14:08:48 2006
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: ExtensionParser.php,v 1.49 2006/08/18 14:13:03 hholzgra Exp $
+ * @version CVS: $Id: ExtensionParser.php,v 1.50 2006/08/21 14:08:48 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen
*/
@@ -654,6 +654,10 @@
}
}
+ if (isset($attr["version"])) {
+ $with->setVersion($attr["version"]);
+ }
+
$this->pushHelper($with);
return true;