17aeaeec37ef11d4f9fbb80aa2583f574b4ac3bfTimo SirainenDOVECOT_BUILD_INFO=${DOVECOT_BUILD_INFO:-DOVECOT_VERSION_FULL}
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk if [ ${2} -eq 1 ]; then
8232ca302ed650200ea91cb6d5438379d187753eTimo Sirainen# when using a different BUILDDIR just copy from SRCDIR, if there is no .git
8232ca302ed650200ea91cb6d5438379d187753eTimo Sirainen if [ ! -d "${SRCDIR}/.git" ] && [ -f "${SRCDIR}/${VERSION_H}" ]; then
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk cmp -s "${SRCDIR}/${VERSION_H}" "${BUILDDIR}/${VERSION_H}"
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk cp "${SRCDIR}/${VERSION_H}" "${BUILDDIR}/${VERSION_H}"
8232ca302ed650200ea91cb6d5438379d187753eTimo Sirainen# Don't generate dovecot-version.h if the source tree has no .git dir but
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk# a dovecot-version.h. This may be the result of a release/nightly tarball.
8232ca302ed650200ea91cb6d5438379d187753eTimo Sirainen[ ! -d "${SRCDIR}/.git" ] && [ -f "${BUILDDIR}/${VERSION_H}" ] && exit 0
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk# Lets generate the dovecot-version.h
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk[ -f "${BUILDDIR}/${VERSION_HT}" ] && rm -f "${BUILDDIR}/${VERSION_HT}"
bdf3c77e7299a2d036cc1016c77a5aa76f230fb9Timo Sirainen GITID=`git --git-dir ${SRCDIR}/.git rev-parse --short HEAD`
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#ifndef DOVECOT_VERSION_H
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#define DOVECOT_VERSION_H
8232ca302ed650200ea91cb6d5438379d187753eTimo Sirainen#define DOVECOT_VERSION_FULL VERSION" (${GITID})"
17aeaeec37ef11d4f9fbb80aa2583f574b4ac3bfTimo Sirainen#define DOVECOT_BUILD_INFO ${DOVECOT_BUILD_INFO}
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#endif /* DOVECOT_VERSION_H */
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#ifndef DOVECOT_VERSION_H
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#define DOVECOT_VERSION_H
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#define DOVECOT_VERSION_FULL VERSION
17aeaeec37ef11d4f9fbb80aa2583f574b4ac3bfTimo Sirainen#define DOVECOT_BUILD_INFO ${DOVECOT_BUILD_INFO}
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volk#endif /* DOVECOT_VERSION_H */
2152111779d69aefaf7cfe474d80356a5d059d54Pascal Volkcmp -s "${BUILDDIR}/${VERSION_H}" "${BUILDDIR}/${VERSION_HT}" && \
0b27cde4733690450b0e8f754806b3f6ff4af722Timo Sirainen mv -f "${BUILDDIR}/${VERSION_HT}" "${BUILDDIR}/${VERSION_H}"