1# 2# $FreeBSD$ 3# 4 5# Figure out where the git binary is. 6.for _P in /usr/bin /usr/local/bin 7. if !defined(GIT_CMD) || empty(GIT_CMD) 8. if exists(${_P}/git) 9GIT_CMD= ${_P}/git 10. endif 11. endif 12.endfor 13.if !defined(GIT_CMD) && empty(GIT_CMD) 14. error "Git binary not found. Set GIT_CMD appropriately." 15.endif 16 17# Set the git branch and hash to export where needed. 18.if !defined(GITBRANCH) || empty(GITBRANCH) 19GITBRANCH!= ${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' 20.export GITBRANCH 21.endif 22.if !defined(GITREV) || empty(GITREV) 23GITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true 24.export GITREV 25.endif 26 27# Set the build date, primarily for snapshot builds. 28.if !defined(BUILDDATE) || empty(BUILDDATE) 29BUILDDATE!= date +%Y%m%d 30.export BUILDDATE 31.endif 32 33