You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.4 KiB

2 years ago
  1. #!/bin/sh
  2. set -e
  3. # prefer user supplied CFLAGS, but default to our PHP_CFLAGS
  4. : ${CFLAGS:=$PHP_CFLAGS}
  5. : ${CPPFLAGS:=$PHP_CPPFLAGS}
  6. : ${LDFLAGS:=$PHP_LDFLAGS}
  7. export CFLAGS CPPFLAGS LDFLAGS
  8. srcExists=
  9. if [ -d /usr/src/php ]; then
  10. srcExists=1
  11. fi
  12. docker-php-source extract
  13. if [ -z "$srcExists" ]; then
  14. touch /usr/src/php/.docker-delete-me
  15. fi
  16. cd /usr/src/php/ext
  17. usage() {
  18. echo "usage: $0 ext-name [configure flags]"
  19. echo " ie: $0 gd --with-jpeg-dir=/usr/local/something"
  20. echo
  21. echo 'Possible values for ext-name:'
  22. find . \
  23. -mindepth 2 \
  24. -maxdepth 2 \
  25. -type f \
  26. -name 'config.m4' \
  27. | xargs -n1 dirname \
  28. | xargs -n1 basename \
  29. | sort \
  30. | xargs
  31. echo
  32. echo 'Some of the above modules are already compiled into PHP; please check'
  33. echo 'the output of "php -i" to see which modules are already loaded.'
  34. }
  35. ext="$1"
  36. if [ -z "$ext" ] || [ ! -d "$ext" ]; then
  37. usage >&2
  38. exit 1
  39. fi
  40. shift
  41. pm='unknown'
  42. if [ -e /lib/apk/db/installed ]; then
  43. pm='apk'
  44. fi
  45. if [ "$pm" = 'apk' ]; then
  46. if \
  47. [ -n "$PHPIZE_DEPS" ] \
  48. && ! apk info --installed .phpize-deps > /dev/null \
  49. && ! apk info --installed .phpize-deps-configure > /dev/null \
  50. ; then
  51. apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS
  52. fi
  53. fi
  54. if command -v dpkg-architecture > /dev/null; then
  55. gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"
  56. set -- --build="$gnuArch" "$@"
  57. fi
  58. cd "$ext"
  59. phpize
  60. ./configure --enable-option-checking=fatal "$@"