2016-01-07 17:09:49 +01:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
2016-12-13 00:21:44 +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:32:13 +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:51:38 +01:00
|
|
|
cd /usr/src/php/ext
|
|
|
|
|
2017-09-20 00:49:04 +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:32:13 +02:00
|
|
|
-mindepth 2 \
|
|
|
|
-maxdepth 2 \
|
|
|
|
-type f \
|
|
|
|
-name 'config.m4' \
|
|
|
|
| xargs -n1 dirname \
|
|
|
|
| xargs -n1 basename \
|
|
|
|
| sort \
|
|
|
|
| xargs
|
2017-09-20 00:49:04 +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:49:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ext="$1"
|
|
|
|
if [ -z "$ext" ] || [ ! -d "$ext" ]; then
|
|
|
|
usage >&2
|
2016-01-07 17:09:49 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
|
2016-06-12 10:58:09 +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-01-07 17:09:49 +01:00
|
|
|
set -x
|
2016-12-06 20:51:38 +01:00
|
|
|
cd "$ext"
|
2016-01-07 17:09:49 +01:00
|
|
|
phpize
|
|
|
|
./configure "$@"
|