Skip to content

Commit

Permalink
Use git tag and commit hash as version and revision whenever it is po…
Browse files Browse the repository at this point in the history
…ssible
  • Loading branch information
pinepain committed May 4, 2014
1 parent 0431950 commit 0abce99
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion amqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ PHP_MINFO_FUNCTION(amqp)
{
php_info_print_table_start();
php_info_print_table_header(2, "Version", PHP_AMQP_VERSION);
php_info_print_table_header(2, "Revision", "$Revision: 327551 $");
php_info_print_table_header(2, "Revision", PHP_AMQP_REVISION);
php_info_print_table_header(2, "Compiled", __DATE__ " @ " __TIME__);
php_info_print_table_header(2, "AMQP protocol version", "0-9-1");
php_info_print_table_header(2, "librabbitmq version", amqp_version());
Expand Down
19 changes: 19 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ if test "$PHP_AMQP" != "no"; then
LIBNAME=rabbitmq
LIBSYMBOL=rabbitmq

if test -z "$TRAVIS" ; then
type git &>/dev/null

if test $? -eq 0 ; then
git describe --tags &>/dev/null

if test $? -eq 0 ; then
AC_DEFINE_UNQUOTED([PHP_AMQP_VERSION], ["`git describe --tags --abbr=0`-dev"], [git version])
fi

git rev-parse --short HEAD &>/dev/null

if test $? -eq 0 ; then
AC_DEFINE_UNQUOTED([PHP_AMQP_REVISION], ["`git rev-parse --short HEAD`"], [git revision])
fi
else
AC_MSG_NOTICE([git not installed. Cannot obtain php_amqp version tag. Install git.])
fi
fi

PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $AMQP_DIR/lib, AMQP_SHARED_LIBADD)
PHP_SUBST(AMQP_SHARED_LIBADD)
Expand Down
6 changes: 6 additions & 0 deletions php_amqp.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,13 @@ typedef struct _amqp_envelope_object {
#define AMQP_G(v) (amqp_globals.v)
#endif

#ifndef PHP_AMQP_VERSION
#define PHP_AMQP_VERSION "1.4.0"
#endif

#ifndef PHP_AMQP_REVISION
#define PHP_AMQP_REVISION "no revision"
#endif

void amqp_error(amqp_rpc_reply_t x, char **pstr, amqp_connection_object *connection, amqp_channel_object *channel);

Expand Down

0 comments on commit 0abce99

Please sign in to comment.