Skip to content

Commit

Permalink
PHP: use php-config instead of explicitly setting include paths. (pro…
Browse files Browse the repository at this point in the history
  • Loading branch information
haberman authored May 28, 2020
1 parent 2d654e8 commit 1688ea8
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 20 deletions.
5 changes: 0 additions & 5 deletions php/tests/compatibility_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ function use_php() {
VERSION=$1

OLD_PATH=$PATH
OLD_CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH
OLD_C_INCLUDE_PATH=$C_INCLUDE_PATH

export PATH=/usr/local/php-${VERSION}/bin:$OLD_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$OLD_CPLUS_INCLUDE_PATH
export C_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$OLD_C_INCLUDE_PATH
}

function generate_proto() {
Expand Down
4 changes: 1 addition & 3 deletions php/tests/compile_extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
VERSION=$2

export PATH=/usr/local/php-$VERSION/bin:$PATH
export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH

pushd ../ext/google/protobuf
make clean || true
set -e
# Add following in configure for debug: --enable-debug CFLAGS='-g -O0'
phpize && ./configure CFLAGS='-g -O0 -Wall' && make
phpize && ./configure --with-php-config=`which php-config` CFLAGS='-g -O0 -Wall' && make
popd
2 changes: 0 additions & 2 deletions php/tests/gdb_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
VERSION=$1

export PATH=/usr/local/php-$VERSION/bin:$PATH
export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH

php -i | grep "Configuration"

Expand Down
2 changes: 0 additions & 2 deletions php/tests/multirequest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ VERSION=7.4
PORT=12345

export PATH=/usr/local/php-$VERSION/bin:$PATH
export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH
/bin/bash ./compile_extension.sh $VERSION

nohup php -d protobuf.keep_descriptor_pool_after_request=1 -dextension=../ext/google/protobuf/modules/protobuf.so -S localhost:$PORT multirequest.php 2>&1 &
Expand Down
2 changes: 0 additions & 2 deletions php/tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
VERSION=$1

export PATH=/usr/local/php-$VERSION/bin:$PATH
export C_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-$VERSION/include/php/main:/usr/local/php-$VERSION/include/php:$CPLUS_INCLUDE_PATH

# Compile c extension
/bin/bash ./compile_extension.sh $VERSION
Expand Down
6 changes: 0 additions & 6 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -492,24 +492,18 @@ generate_php_test_proto() {
use_php() {
VERSION=$1
export PATH=/usr/local/php-${VERSION}/bin:$PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$CPLUS_INCLUDE_PATH
export C_INCLUDE_PATH=/usr/local/php-${VERSION}/include/php/main:/usr/local/php-${VERSION}/include/php/:$C_INCLUDE_PATH
generate_php_test_proto
}

use_php_zts() {
VERSION=$1
export PATH=/usr/local/php-${VERSION}-zts/bin:$PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}-zts/include/php/main:/usr/local/php-${VERSION}-zts/include/php/:$CPLUS_INCLUDE_PATH
export C_INCLUDE_PATH=/usr/local/php-${VERSION}-zts/include/php/main:/usr/local/php-${VERSION}-zts/include/php/:$C_INCLUDE_PATH
generate_php_test_proto
}

use_php_bc() {
VERSION=$1
export PATH=/usr/local/php-${VERSION}-bc/bin:$PATH
export CPLUS_INCLUDE_PATH=/usr/local/php-${VERSION}-bc/include/php/main:/usr/local/php-${VERSION}-bc/include/php/:$CPLUS_INCLUDE_PATH
export C_INCLUDE_PATH=/usr/local/php-${VERSION}-bc/include/php/main:/usr/local/php-${VERSION}-bc/include/php/:$C_INCLUDE_PATH
generate_php_test_proto
}

Expand Down

0 comments on commit 1688ea8

Please sign in to comment.