Skip to content

Config tweaks #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ php.ini
!.github/
!tests/utils/*.php
!.travis.yml
!.travis.scripts/*
!.travis.scripts/


!scripts
Expand Down
26 changes: 26 additions & 0 deletions .travis.scripts/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
# https://github.com/eddyxu/cpp-coveralls#linux
pip install --user cpp-coveralls
fi

if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
brew update
brew upgrade

brew tap homebrew/homebrew-php
brew install "${PHP_VERSION}"

# http://brewformulas.org/Lcov
brew install lcov

# https://github.com/eddyxu/cpp-coveralls#os-x
brew install pyenv
eval "$(pyenv init -)"
pyenv install 2.7.6
pyenv global 2.7.6
pyenv rehash
pip install cpp-coveralls
pyenv rehash
fi
18 changes: 18 additions & 0 deletions .travis.scripts/before_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

CONFIGURE_OPTS="--enable-developer-flags --enable-coverage"

if [ -n "${SSL_VERSION}" ]; then
CONFIGURE_OPTS="${CONFIGURE_OPTS} --with-mongodb-ssl=${SSL_VERSION}"
fi

phpize
./configure ${CONFIGURE_OPTS}
make all -j4
make install

# Add the extension to php.ini
echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

# Predefine the test server
echo '{"STANDALONE": "mongodb:\/\/127.0.0.1:27017"}' > /tmp/PHONGO-SERVERS.json
42 changes: 0 additions & 42 deletions .travis.scripts/compile.sh

This file was deleted.

9 changes: 7 additions & 2 deletions .travis.scripts/debug-core.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh

PHP=/home/travis/.phpenv/versions/`php -r 'echo PHP_VERSION;'`/bin/php
echo "backtrace full" | gdb $PHP $1
if [ "${TRAVIS_OS_NAME}" != "osx" ]; then
# https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html
echo "Cannot debug core files on macOS: ${1}"
exit 1
fi

PHP_BINARY=`which php`
gdb -batch -ex "bt full" -ex "quit" "${PHP_BINARY}" "${1}"
15 changes: 15 additions & 0 deletions .travis.scripts/debug-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

EXP=`echo $1 | sed 's/.diff$/.exp/'`
OUT=`echo $1 | sed 's/.diff$/.out/'`
SEP="--------------------------------------------------------------------------------"

echo $EXP
echo $SEP
cat $EXP; echo
echo $SEP; echo

echo $OUT
echo $SEP
cat $OUT; echo
echo $SEP; echo
19 changes: 0 additions & 19 deletions .travis.scripts/debug-script.sh

This file was deleted.

52 changes: 33 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
language: php
php:
- 7.2
- 7.1
- 7.0
- 5.6
- 5.5

addons:
apt:
packages:
- gdb
- lcov

matrix:
include:
- os: linux
dist: trusty
sudo: false
php: 5.5
- os: linux
dist: trusty
sudo: false
php: 5.6
- os: linux
dist: trusty
sudo: false
php: 7.0
- os: linux
dist: trusty
sudo: false
php: 7.1
- os: linux
dist: trusty
sudo: false
php: 7.2

services:
- mongodb
Expand All @@ -13,24 +36,15 @@ env:
global:
- TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff"
- REPORT_EXIT_STATUS=1
- MONGODB_ORCHESTRATION="http://localhost:8889"
- MONGODB_ORCHESTRATION_REPO="git+git://github.com/mongodb/mongo-orchestration@master"
- MONGODB_ORCHESTRATION_PRESETS_ROOT=`pwd`
- secure: "Dofd9NvXIKEat1PMiia3RQgNsJLaKtzZRf9rM4MsqFaBQPbJmVWPANJkayJPcK+l8pLxHyzzH7WqxML+SlBhBTHdJB++1woXxoVwm+sDdwSye6e+eXc3/zRUxb7zyItBZcvVp2tIJpx5kXJb+CoUQakbfWEQQFk4xrOF0R56+8Y="
- secure: "pfGVPucvgcgcefhtzAVeejlpOtn4TnAqJSTM8mJkBl36KdU9P7hMuD3czQ4drWgzZ373/VT5UVhLu/HNsdbW0YBTeqPKJ4YNjqVVLytI8xT7y2Lw9l+I7o93j98TMgAoo8nVRmp/E4D6yutbKK1eddrcmf899R1iJbw8v8d1Ht8="

before_install:
- sudo pip install --upgrade cpp-coveralls
- sudo pip install ${MONGODB_ORCHESTRATION_REPO}
- sudo apt-get update
- sudo apt-get install gdb valgrind
- sudo apt-get install cdbs debhelper build-essential python-lxml
- .travis.scripts/before_install.sh
- php -r 'if ( ! ($f = php_ini_loaded_file())) { $f = PHP_CONFIG_FILE_PATH . "/php.ini"; } file_put_contents($f, "variables_order=EGPCS\n", FILE_APPEND); $a = file($f, FILE_IGNORE_NEW_LINES); var_dump($a[count($a)-1]);'

before_script:
- ulimit -a
- ulimit -c unlimited || true
- "./.travis.scripts/compile.sh"
- .travis.scripts/before_script.sh

script:
- make test
Expand All @@ -39,5 +53,5 @@ after_success:
- make coveralls

after_failure:
- find . -name \*core\* -exec ./.travis.scripts/debug-core.sh {} \;
- find . -name \*diff -exec ./.travis.scripts/debug-script.sh {} \;
- find . -name 'core*' -exec .travis.scripts/debug-core.sh {} \;
- find . -name '*.diff' -exec .travis.scripts/debug-diff.sh {} \;
59 changes: 22 additions & 37 deletions config.m4
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
dnl config.m4 for extension mongodb
PHP_ARG_ENABLE(mongodb, whether to enable mongodb support,
[ --enable-mongodb Enable mongodb support])
PHP_ARG_WITH(openssl-dir, OpenSSL dir for mongodb,
[ --with-openssl-dir[=DIR] openssl install prefix], yes, no)
PHP_ARG_WITH(system-ciphers, whether to use system default cipher list instead of hardcoded value,
[ --with-system-ciphers OPENSSL: Use system default cipher list instead of hardcoded value], no, no)
PHP_ARG_ENABLE([mongodb],
[whether to enable MongoDB support],
[AC_HELP_STRING([--enable-mongodb],
[Enable MongoDB support])])

dnl borrowed from libmongoc configure.ac
dnl AS_VAR_COPY is available in AC 2.64 and on, but we only require 2.60.
Expand Down Expand Up @@ -92,8 +90,12 @@ if test "$PHP_MONGODB" != "no"; then
AC_MSG_ERROR([not supported. Need a PHP version >= 5.5.0 (found $PHP_MONGODB_FOUND_VERSION)])
fi

PHP_ARG_ENABLE(developer-flags, whether to enable developer build flags,
[ --enable-developer-flags Enable developer flags],, no)
PHP_ARG_ENABLE([developer-flags],
[whether to enable developer build flags],
[AC_HELP_STRING([--enable-developer-flags],
[MongoDB: Enable developer flags])],
[],
[no])

if test "$PHP_DEVELOPER_FLAGS" = "yes"; then
dnl Warn about functions which might be candidates for format attributes
Expand Down Expand Up @@ -144,8 +146,12 @@ if test "$PHP_MONGODB" != "no"; then
fi


PHP_ARG_ENABLE(coverage, whether to enable code coverage,
[ --enable-coverage Enable developer code coverage information],, no)
PHP_ARG_ENABLE([coverage],
[whether to enable code coverage],
[AC_HELP_STRING([--enable-coverage],
[MongoDB: Enable developer code coverage information])],
[],
[no])

if test "$PHP_COVERAGE" = "yes"; then
PHP_CHECK_GCC_ARG(-fprofile-arcs, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -fprofile-arcs")
Expand Down Expand Up @@ -221,9 +227,9 @@ if test "$PHP_MONGODB" != "no"; then
"

PHP_ARG_WITH(libbson, whether to use system libbson,
[ --with-libbson Use system libbson], no, no)
[ --with-libbson MongoDB: Use system libbson], no, no)
PHP_ARG_WITH(libmongoc, whether to use system libmongoc,
[ --with-libmongoc Use system libmongoc], no, no)
[ --with-libmongoc MongoDB: Use system libmongoc], no, no)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing AC_HELP_STRING for these and mongodb-sasl below. I'll take care of that myself.


if test "$PHP_LIBBSON" != "no"; then
if test "$PHP_LIBMONGOC" = "no"; then
Expand Down Expand Up @@ -297,44 +303,23 @@ if test "$PHP_MONGODB" != "no"; then

PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $PHP_MONGODB_MONGOC_SOURCES, $PHP_MONGODB_MONGOC_CFLAGS, shared_objects_mongodb, yes)

AC_SUBST(MONGOC_ENABLE_CRYPTO, 0)
AC_SUBST(MONGOC_ENABLE_SSL, 0)
AC_SUBST(MONGOC_ENABLE_CRYPTO_LIBCRYPTO, 0)
AC_SUBST(MONGOC_ENABLE_SSL_OPENSSL, 0)
AC_SUBST(MONGOC_HAVE_ASN1_STRING_GET0_DATA, 0)
m4_include(scripts/build/autotools/m4/pkg.m4)

PHP_SETUP_OPENSSL(MONGODB_SHARED_LIBADD, [
AC_SUBST(MONGOC_ENABLE_CRYPTO, 1)
AC_SUBST(MONGOC_ENABLE_SSL, 1)
AC_SUBST(MONGOC_ENABLE_CRYPTO_LIBCRYPTO, 1)
AC_SUBST(MONGOC_ENABLE_SSL_OPENSSL, 1)

AC_CHECK_DECLS([ASN1_STRING_get0_data], [AC_SUBST(MONGOC_HAVE_ASN1_STRING_GET0_DATA, 1)], [AC_SUBST(MONGOC_HAVE_ASN1_STRING_GET0_DATA, 0)], [[#include <openssl/asn1.h>]])
])
m4_include(scripts/build/autotools/CheckHost.m4)
m4_include(scripts/build/autotools/CheckSSL.m4)

if test "$PHP_SYSTEM_CIPHERS" != "no"; then
AC_SUBST(MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE, 1)
else
AC_SUBST(MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE, 0)
fi

dnl TODO: Support building with Secure Transport on OSX
AC_SUBST(MONGOC_ENABLE_SSL_SECURE_TRANSPORT, 0)
AC_SUBST(MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO, 0)

dnl Secure Channel only applies to Windows
AC_SUBST(MONGOC_ENABLE_SSL_SECURE_CHANNEL, 0)
AC_SUBST(MONGOC_ENABLE_CRYPTO_CNG, 0)

AC_SUBST(MONGOC_ENABLE_SSL_LIBRESSL, 0)

AC_SUBST(MONGOC_NO_AUTOMATIC_GLOBALS, 1)

AC_CHECK_TYPE([socklen_t], [AC_SUBST(MONGOC_HAVE_SOCKLEN, 1)], [AC_SUBST(MONGOC_HAVE_SOCKLEN, 0)], [#include <sys/socket.h>])

with_snappy=auto
with_zlib=auto
m4_include(src/libmongoc/build/autotools/m4/pkg.m4)
m4_include(src/libmongoc/build/autotools/CheckSnappy.m4)
m4_include(src/libmongoc/build/autotools/CheckZlib.m4)

Expand All @@ -351,7 +336,7 @@ if test "$PHP_MONGODB" != "no"; then


PHP_ARG_WITH(mongodb-sasl, for Cyrus SASL support,
[ --with-mongodb-sasl[=DIR] mongodb: Include Cyrus SASL support], auto, no)
[ --with-mongodb-sasl[=DIR] MongoDB: Include Cyrus SASL support], auto, no)

AC_SUBST(MONGOC_ENABLE_SASL, 0)
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
Expand Down
54 changes: 54 additions & 0 deletions scripts/build/autotools/CheckHost.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
AC_CANONICAL_HOST

os_win32=no
os_netbsd=no
os_freebsd=no
os_openbsd=no
os_hpux=no
os_linux=no
os_solaris=no
os_darwin=no
os_gnu=no

case "$host" in
*-mingw*|*-*-cygwin*)
os_win32=yes
TARGET_OS=windows
;;
*-*-*netbsd*)
os_netbsd=yes
ARGET_OS=unix
;;
*-*-*freebsd*)
os_freebsd=yes
TARGET_OS=unix
;;
*-*-*openbsd*)
os_openbsd=yes
TARGET_OS=unix
;;
*-*-hpux*)
os_hpux=yes
TARGET_OS=unix
;;
*-*-linux*)
os_linux=yes
os_gnu=yes
TARGET_OS=unix
;;
*-*-solaris*)
os_solaris=yes
TARGET_OS=unix
;;
*-*-darwin*)
os_darwin=yes
TARGET_OS=unix
;;
gnu*|k*bsd*-gnu*)
os_gnu=yes
TARGET_OS=unix
;;
*)
AC_MSG_WARN([*** Please add $host to configure.ac checks!])
;;
esac
Loading