5 * Check system dependences between php-pear modules.
6 * Based on Perl version rpm-php-provides.
8 * Paweł Gołaszewski <blues@pld-linux.org>
9 * Michał Moskal <malekith@pld-linux.org>
10 * Elan Ruusamäe <glen@pld-linux.org>
14 * Produce old style pear(Path/To/File.php) deps
16 function peardeps($files) {
17 // all files must begin with $RPM_BUILD_ROOT%{php_pear_dir}
18 $prefix = RPM_BUILD_ROOT. PHP_PEAR_DIR . DIRECTORY_SEPARATOR;
19 $length = strlen($prefix);
20 foreach ($files as $f) {
21 if (substr($f, 0, $length) != $prefix) {
24 $f = substr($f, $length);
30 * Produce dependencies for extensions using PEAR PHP_CompatInfo package.
32 function extdeps($files) {
33 require_once 'PHP/CompatInfo.php';
35 $info = new PHP_CompatInfo('null');
36 $res = $info->parseData($files);
38 if (version_compare($res['version'], '5.0.0', 'ge')) {
40 // produce dependencies only for php5
42 // session has always been compiled in
43 // date, spl are internal for php
44 $staticmods = array('session', 'date', 'spl');
47 // produce dependencies where php4/php5 both are ok
49 // session has always been compiled in
50 $staticmods = array('session');
52 echo "php-common >= ", $epoch, ":", $res['version'], "\n";
55 foreach ($res['extensions'] as $ext) {
56 if (in_array($ext, $staticmods)) {
61 echo "php(", $ext, ")\n";
63 echo "php-", $ext, "\n";
68 define('RPM_BUILD_ROOT', getenv('RPM_BUILD_ROOT'));
69 define('PHP_PEAR_DIR', '/usr/share/pear');
72 $files = array_splice($argv, 1);
74 $files = split(PHP_EOL, trim(file_get_contents('php://stdin')));