2016-03-18 18:51:01 +01:00
|
|
|
#!/bin/sh
|
2014-11-11 21:17:28 +01:00
|
|
|
set -e
|
|
|
|
|
2016-12-13 00:16:09 +01:00
|
|
|
# prefer user supplied CFLAGS, but default to our PHP_CFLAGS
|
|
|
|
: ${CFLAGS:=$PHP_CFLAGS}
|
|
|
|
: ${CPPFLAGS:=$PHP_CPPFLAGS}
|
|
|
|
: ${LDFLAGS:=$PHP_LDFLAGS}
|
|
|
|
export CFLAGS CPPFLAGS LDFLAGS
|
|
|
|
|
2016-08-09 23:28:11 +02:00
|
|
|
srcExists=
|
|
|
|
if [ -d /usr/src/php ]; then
|
|
|
|
srcExists=1
|
|
|
|
fi
|
|
|
|
docker-php-source extract
|
|
|
|
if [ -z "$srcExists" ]; then
|
|
|
|
touch /usr/src/php/.docker-delete-me
|
|
|
|
fi
|
|
|
|
|
2016-12-06 20:50:56 +01:00
|
|
|
cd /usr/src/php/ext
|
|
|
|
|
2017-09-20 00:43:41 +02:00
|
|
|
usage() {
|
|
|
|
echo "usage: $0 ext-name [configure flags]"
|
|
|
|
echo " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
|
|
|
echo
|
|
|
|
echo 'Possible values for ext-name:'
|
|
|
|
find . \
|
2016-08-09 23:28:11 +02:00
|
|
|
-mindepth 2 \
|
|
|
|
-maxdepth 2 \
|
|
|
|
-type f \
|
|
|
|
-name 'config.m4' \
|
|
|
|
| xargs -n1 dirname \
|
|
|
|
| xargs -n1 basename \
|
|
|
|
| sort \
|
|
|
|
| xargs
|
2017-09-20 00:43:41 +02:00
|
|
|
echo
|
|
|
|
echo 'Some of the above modules are already compiled into PHP; please check'
|
2017-09-20 02:03:52 +02:00
|
|
|
echo 'the output of "php -i" to see which modules are already loaded.'
|
2017-09-20 00:43:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ext="$1"
|
|
|
|
if [ -z "$ext" ] || [ ! -d "$ext" ]; then
|
|
|
|
usage >&2
|
2014-11-11 21:17:28 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
|
2016-06-06 20:01:36 +02:00
|
|
|
pm='unknown'
|
|
|
|
if [ -e /lib/apk/db/installed ]; then
|
|
|
|
pm='apk'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$pm" = 'apk' ]; then
|
|
|
|
if \
|
|
|
|
[ -n "$PHPIZE_DEPS" ] \
|
|
|
|
&& ! apk info --installed .phpize-deps > /dev/null \
|
|
|
|
&& ! apk info --installed .phpize-deps-configure > /dev/null \
|
|
|
|
; then
|
|
|
|
apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-05-10 20:14:13 +02:00
|
|
|
if command -v dpkg-architecture > /dev/null; then
|
|
|
|
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"
|
|
|
|
set -- --build="$gnuArch" "$@"
|
|
|
|
fi
|
|
|
|
|
2016-12-06 20:50:56 +01:00
|
|
|
cd "$ext"
|
2014-11-11 21:17:28 +01:00
|
|
|
phpize
|
|
|
|
./configure "$@"
|