Merge branch 'meta/travis'
authorChris Wright <daverandom@php.net>
Mon, 15 Dec 2014 12:38:54 +0000 (12:38 +0000)
committerChris Wright <daverandom@php.net>
Mon, 15 Dec 2014 12:38:54 +0000 (12:38 +0000)
* meta/travis:
  Add README.md for github
  Add travis config
  Ensure server will report notices when test expects them
  Build improvements

.travis.yml [new file with mode: 0644]
README.md [new file with mode: 0644]
config9.m4
tests/trans001.phpt
travis/compile-ext.sh [new file with mode: 0755]
travis/compile-php.sh [new file with mode: 0755]
travis/compile-raphf.sh [new file with mode: 0755]
travis/configure-postgres.sh [new file with mode: 0755]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..296407f
--- /dev/null
@@ -0,0 +1,17 @@
+language: c
+
+addons:
+    postgresql: "9.3"
+
+before_install:
+    - sudo apt-get update -qq
+    - sudo apt-get install -qq libpq-dev
+
+before_script:
+    - sudo ./travis/compile-php.sh
+    - sudo ./travis/compile-raphf.sh
+    - sudo ./travis/compile-ext.sh
+    - sudo ./travis/configure-postgres.sh
+
+script:
+    - REPORT_EXIT_STATUS=1 $HOME/bin/php ./run-tests.php -p $HOME/bin/php --show-diff
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..e251e37
--- /dev/null
+++ b/README.md
@@ -0,0 +1,36 @@
+pecl/pq
+=======
+
+[![Build Status](https://travis-ci.org/php/pecl-database-pq.svg?branch=master)](https://travis-ci.org/php/pecl-database-pq)
+
+About
+-----
+
+This is a modern binding to the mature [libpq](http://www.postgresql.org/docs/current/static/libpq.html), the official PostgreSQL C-client library.
+
+Highlights:
+
+- Nearly 100% support for asynchronous usage.
+- Extended type support by pg_type.
+- Fetching simple multi-dimensional array maps.
+- Working [Gateway implementation](https://github.com/m6w6/pq-gateway).
+
+Installation
+------------
+
+This extension is hosted at [PECL](http://pecl.php.net/) and can be installed with [PEAR](http://pear.php.net/)'s `pecl` command:
+
+    # pecl install pq
+
+Dependencies
+------------
+
+This extension unconditionally depends on the pre-loaded presence of the following PHP extensions:
+
+- [raphf](http://pecl.php.net/package/raphf)
+- [spl](http://php.net/spl)
+
+Documentation
+-------------
+
+Documentation is available [here](http://devel-m6w6.rhcloud.com/mdref/pq).
index ed2e3a36372fea19d8215ca9c9778591cf61678a..b63f2ad6f40dc45864d1a6b8d689537c959da683 100644 (file)
@@ -2,14 +2,22 @@ PHP_ARG_WITH(pq, [whether to enable libpq (PostgreSQL) support],
 [  --with-pq[=DIR]           Include libpq support])
 
 if test "$PHP_PQ" != "no"; then
-       SEARCH_PATH="/usr/local /usr /opt"
+       SEARCH_PATH="/usr/local /usr /usr/include/postgresql /opt"
        if test "$PHP_PQ" != "yes"; then
                SEARCH_PATH="$PHP_PQ $SEARCH_PATH"
        fi
        for i in $SEARCH_PATH; do
+               AC_MSG_CHECKING(for $i/libpq-events.h)
+               if test -f "$i/libpq-events.h"; then
+                       PQ_DIR=$i
+                       AC_MSG_RESULT(yep)
+                       break
+               fi
+               AC_MSG_RESULT(nope)
+
                AC_MSG_CHECKING(for $i/include/libpq-events.h)
                if test -f "$i/include/libpq-events.h"; then
-                       PQ_DIR=$i
+                       PQ_DIR=$i/include
                        AC_MSG_RESULT(yep)
                        break
                fi
@@ -19,7 +27,7 @@ if test "$PHP_PQ" != "no"; then
        if test -z "$PQ_DIR"; then
                AC_MSG_ERROR(could not find include/libpq-events.h)
        fi
-       PHP_ADD_INCLUDE($PQ_DIR/include)
+       PHP_ADD_INCLUDE($PQ_DIR)
 
        ifdef([AC_PROG_EGREP], [
                AC_PROG_EGREP
@@ -32,7 +40,7 @@ if test "$PHP_PQ" != "no"; then
        dnl
        AC_DEFUN([PQ_CHECK_CONST], [
                AC_MSG_CHECKING(for $1)
-               if $EGREP -q $1 $PQ_DIR/include/libpq-fe.h; then
+               if $EGREP -q $1 $PQ_DIR/libpq-fe.h; then
                        AC_DEFINE(HAVE_$1, 1, [Have $1])
                        AC_MSG_RESULT(yep)
                else
index fc00a385c7be31acf028767cb25a0b21ddc8bc2a..1dc97baff9d1fa1bbe8eb0be2c3758be8cb59e0d 100644 (file)
@@ -10,6 +10,7 @@ include "_setup.inc";
 
 $c = new pq\Connection(PQ_DSN);
 $c->exec("DROP TABLE IF EXISTS test CASCADE");
+$c->exec("SET client_min_messages TO NOTICE");
 $c->on(pq\Connection::EVENT_NOTICE, function($c, $notice) {
        echo "Got notice: $notice\n";
 });
diff --git a/travis/compile-ext.sh b/travis/compile-ext.sh
new file mode 100755 (executable)
index 0000000..17b6be8
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh -x
+
+set -e
+
+$HOME/bin/phpize
+./configure --with-php-config=$HOME/bin/php-config --with-pq
+
+make -j2 --quiet install
+
+echo 'extension=pq.so' > $HOME/php.d/20-pq.ini
diff --git a/travis/compile-php.sh b/travis/compile-php.sh
new file mode 100755 (executable)
index 0000000..63c8142
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh -x
+
+set -e
+TARGET_PHP_REF="PHP-5.6"
+
+mkdir -p $HOME/php
+mkdir -p $HOME/php.d
+git clone --depth=1 --branch=$TARGET_PHP_REF https://github.com/php/php-src $HOME/php/src
+
+cd $HOME/php/src
+./buildconf --force
+./configure --prefix=$HOME --with-config-file-scan-dir=$HOME/php.d --disable-all --enable-maintainer-zts --enable-json --with-mhash
+
+make -j2 --quiet install
diff --git a/travis/compile-raphf.sh b/travis/compile-raphf.sh
new file mode 100755 (executable)
index 0000000..99aa4b0
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh -x
+
+set -e
+
+git clone --depth 1 https://github.com/php/pecl-php-raphf $HOME/raphf
+cd $HOME/raphf
+
+$HOME/bin/phpize
+./configure --with-php-config=$HOME/bin/php-config --with-pq
+
+make -j2 --quiet install
+
+echo 'extension=raphf.so' > $HOME/php.d/10-raphf.ini
diff --git a/travis/configure-postgres.sh b/travis/configure-postgres.sh
new file mode 100755 (executable)
index 0000000..de5355c
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh -x
+
+psql -c 'create database pq_test;' -U postgres
+echo '<?php const PQ_DSN = "postgres://postgres@localhost/pq_test";' > ./tests/_setup.inc