3 #####################################################################
5 # Check system dependences between php-pear modules #
7 # Paweł Gołaszewski <blues@pld-linux.org> #
8 # Michał Moskal <malekith@pld-linux.org> #
9 # Elan Ruusamäe <glen@pld-linux.org> #
10 #####################################################################
13 * Produce old style pear(Path/To/File.php) deps
15 function peardeps($files) {
16 // all files must begin with $RPM_BUILD_ROOT%{php_pear_dir}
17 $prefix = RPM_BUILD_ROOT. PHP_PEAR_DIR . DIRECTORY_SEPARATOR;
18 $length = strlen($prefix);
19 foreach ($files as $f) {
20 if (substr($f, 0, $length) != $prefix) {
23 $f = substr($f, $length);
29 * Produce dependencies for extensions using PEAR PHP_CompatInfo package.
31 function extdeps($files) {
32 require_once 'PHP/CompatInfo.php';
34 $info = new PHP_CompatInfo('null');
35 $res = $info->parseData($files);
37 if (version_compare($res['version'], '5.0.0', 'ge')) {
39 // produce dependencies only for php5
41 // session has always been compiled in
42 // date, spl are internal for php
43 $staticmods = array('session', 'date', 'spl');
46 // produce dependencies where php4/php5 both are ok
48 // session has always been compiled in
49 $staticmods = array('session');
51 echo "php-common >= ", $epoch, ":", $res['version'], "\n";
54 foreach ($res['extensions'] as $ext) {
55 if (in_array($ext, $staticmods)) {
60 echo "php(", $ext, ")\n";
62 echo "php-", $ext, "\n";
67 define('RPM_BUILD_ROOT', getenv('RPM_BUILD_ROOT'));
68 define('PHP_PEAR_DIR', '/usr/share/pear');
71 $files = array_splice($argv, 1);
73 $files = split(PHP_EOL, trim(file_get_contents('php://stdin')));