[PATCH] configure: add git describe output to PG_VERSION when building a git tree

From: Oskari Saarenmaa <os(at)ohmu(dot)fi>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] configure: add git describe output to PG_VERSION when building a git tree
Date: 2013-11-05 10:22:26
Message-ID: 20131105102226.GA26836@saarenmaa.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This makes it easy to see if the binaries were built from a real release
or if they were built from a custom git tree.
---
configure.in | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.in b/configure.in
index a4baeaf..7c5b3ce 100644
--- a/configure.in
+++ b/configure.in
@@ -29,7 +29,14 @@ AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(/usr/local/pgsql)
AC_SUBST(configure_args, [$ac_configure_args])

-AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version as a string])
+# Append git tag based version to PG_VERSION if we're building from a git
+# checkout, but don't touch PACKAGE_VERSION which is used to create other
+# version variables (major version and numeric version.)
+PG_VERSION="$PACKAGE_VERSION"
+if test -d .git; then
+ PG_VERSION="$PG_VERSION (`git describe --tags --long --dirty HEAD || echo unknown`)"
+fi
+AC_DEFINE_UNQUOTED(PG_VERSION, "$PG_VERSION", [PostgreSQL version as a string])
[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
AC_SUBST(PG_MAJORVERSION)
AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
--
1.8.4.2

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-11-05 10:42:14 Re: Fast insertion indexes: why no developments
Previous Message Leonardo Francalanci 2013-11-05 09:57:17 Re: Fast insertion indexes: why no developments