Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

docker-php-ext-install 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. set -e
  3. cd /usr/src/php/ext
  4. usage() {
  5. echo "usage: $0 [-jN] ext-name [ext-name ...]"
  6. echo " ie: $0 gd mysqli"
  7. echo " $0 pdo pdo_mysql"
  8. echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop"
  9. echo
  10. echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
  11. echo
  12. echo 'Possible values for ext-name:'
  13. echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
  14. }
  15. opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })"
  16. eval set -- "$opts"
  17. j=1
  18. while true; do
  19. flag="$1"
  20. shift
  21. case "$flag" in
  22. --help|-h|'-?') usage && exit 0 ;;
  23. --jobs|-j) j="$1" && shift ;;
  24. --) break ;;
  25. *)
  26. {
  27. echo "error: unknown flag: $flag"
  28. usage
  29. } >&2
  30. exit 1
  31. ;;
  32. esac
  33. done
  34. exts=
  35. for ext; do
  36. if [ -z "$ext" ]; then
  37. continue
  38. fi
  39. if [ ! -d "$ext" ]; then
  40. echo >&2 "error: $(pwd -P)/$ext does not exist"
  41. echo >&2
  42. usage >&2
  43. exit 1
  44. fi
  45. exts="$exts $ext"
  46. done
  47. if [ -z "$exts" ]; then
  48. usage >&2
  49. exit 1
  50. fi
  51. if [ -e /lib/apk/db/installed ] && [ -n "$PHPIZE_DEPS" ]; then
  52. apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS
  53. fi
  54. for ext in $exts; do
  55. (
  56. cd "$ext"
  57. [ -e Makefile ] || docker-php-ext-configure "$ext"
  58. make -j"$j"
  59. make -j"$j" install
  60. find modules \
  61. -maxdepth 1 \
  62. -name '*.so' \
  63. -exec basename '{}' ';' \
  64. | xargs -r docker-php-ext-enable
  65. make -j"$j" clean
  66. )
  67. done
  68. if [ -e /lib/apk/db/installed ] && [ -n "$PHPIZE_DEPS" ]; then
  69. apk del .phpize-deps
  70. fi