diff --git a/configure b/configure index 7ed01c91..4c91c693 100755 --- a/configure +++ b/configure @@ -193,6 +193,10 @@ echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK echo "CPPFLAGS += -DHAVE_CONFIG_H" >>$CONFIG_MK echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK +if [ -d .git ]; then + _gitrev=$(git rev-parse master) + echo "CPPFLAGS += -DXBPS_GIT=\\\"${_gitrev}\\\"" >>$CONFIG_MK +fi if [ -n "$DEBUG" -a "$DEBUG" != no -a "$DEBUG" != false ]; then echo "Building with debugging symbols." diff --git a/include/xbps_api.h.in b/include/xbps_api.h.in index a57de359..b23ad95e 100644 --- a/include/xbps_api.h.in +++ b/include/xbps_api.h.in @@ -61,14 +61,17 @@ #ifndef XBPS_VERSION #define XBPS_VERSION "UNSET" #endif - +#ifndef XBPS_GIT + #define XBPS_GIT "UNSET" +#endif /** * @def XBPS_RELVER * Current library release date. */ #define XBPS_RELVER "XBPS: " XBPS_VERSION \ " API: " XBPS_API_VERSION \ - " INDEX: " XBPS_PKGINDEX_VERSION + " INDEX: " XBPS_PKGINDEX_VERSION \ + " GIT: " XBPS_GIT /** * @def XBPS_META_PATH