compile_extension.sh 673 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. set -e
  3. cd $(dirname $0)
  4. pushd ../ext/google/protobuf > /dev/null
  5. CONFIGURE_OPTIONS=("./configure" "--with-php-config=$(which php-config)")
  6. if [ "$1" != "--release" ]; then
  7. CONFIGURE_OPTIONS+=("CFLAGS=-g -O0 -Wall -DPBPHP_ENABLE_ASSERTS")
  8. fi
  9. FINGERPRINT="$(sha256sum $(which php)) ${CONFIGURE_OPTIONS[@]}"
  10. # If the PHP interpreter we are building against or the arguments
  11. # have changed, we must regenerated the Makefile.
  12. if [[ ! -f BUILD_STAMP ]] || [[ "$(cat BUILD_STAMP)" != "$FINGERPRINT" ]]; then
  13. phpize --clean
  14. rm -f configure.in configure.ac
  15. phpize
  16. "${CONFIGURE_OPTIONS[@]}"
  17. echo "$FINGERPRINT" > BUILD_STAMP
  18. fi
  19. make
  20. popd > /dev/null