]> git.pld-linux.org Git - packages/php.git/blob - dep-tests.sh
up to 7.4.0alpha3
[packages/php.git] / dep-tests.sh
1 #!/bin/sh
2 # inter-dependencies checker.
3
4 with_mysqlnd=mysqlnd
5
6 dep_spl="pcre simplexml"
7 dep_session="spl $dep_spl"
8 dep_filter='pcre'
9 dep_eaccelerator='session'
10 dep_mysqlnd='hash'
11 dep_mysql="$dep_mysqlnd $with_mysqlnd"
12 dep_mysqli="$dep_spl spl $dep_mysqlnd $with_mysqlnd"
13 dep_pdo="$dep_spl spl"
14 dep_pdo_sqlite="$dep_pdo pdo"
15 dep_pdo_pgsql="$dep_pdo pdo"
16 dep_pdo_oci="$dep_pdo pdo"
17 dep_pdo_odbc="$dep_pdo pdo"
18 dep_pdo_firebird="$dep_pdo pdo"
19 dep_pdo_dblib="$dep_pdo pdo"
20 dep_pdo_mysql="$dep_pdo pdo $dep_mysqlnd $with_mysqlnd"
21 dep_simplexml="$dep_spl spl"
22 dep_imap="pcre"
23 dep_phar="$dep_spl spl hash"
24 dep_sqlite="$dep_pdo pdo"
25 dep_fileinfo="pcre"
26 dep_wddx='xml'
27 dep_xmlreader='dom'
28 dep_xmlrpc='xml'
29 dep_xsl='dom'
30 dep_snmp="$dep_spl spl snmp"
31 dep_opcache='pcre'
32
33 php=${PHP:-$(php-config --php-binary)}
34 ext_dir=${EXTENSION_DIR:-$(php-config --extension-dir)}
35 conf_dir=${CONFIG_DIR:-$(php-config --sysconfdir)/conf.d $(php-config --sysconfdir)/cli.d}
36 tmpini=$(mktemp)
37
38 # poldek --sn ac-ready -u php-*
39 for ext in ${*:-$ext_dir/*.so}; do
40         [ -f $ext ] || continue
41         ext=${ext##*/}; ext=${ext%.so}
42
43         deps=$(eval echo \$dep_$ext)
44         # add ext itself, if already not in list (spl case)
45         [[ $deps = *\ $ext\ * ]] || deps="$deps $ext"
46
47         echo -n "$ext (deps: ${deps# })..."
48
49         # special: opcache is listed as "Zend Opcache"
50         [ "$ext" = "opcache" ] && ext="zend opcache"
51
52         grep -rlE '^(zend_)?extension=('$(echo "${deps# }" | tr ' ' '|')').so$' $conf_dir | LC_ALL=C sort | xargs cat > $tmpini
53         $php -n -d extension_dir=$ext_dir -c $tmpini -r "exit(extension_loaded('${ext}') ? 0 : 1);"
54         rc=$?
55         if [ $rc = 0 ]; then
56                 echo OK
57         else
58                 echo FAIL
59                 echo "Failed config was:"
60                 cat $tmpini
61         fi
62 done
63 rm -f $t
This page took 0.045555 seconds and 3 git commands to generate.