129b282f3SGlen Barber# 229b282f3SGlen Barber# 329b282f3SGlen Barber 429b282f3SGlen Barber# Figure out where the git binary is. 529b282f3SGlen Barber.for _P in /usr/bin /usr/local/bin 66e7be14eSGlen Barber. if !defined(GIT_CMD) || empty(GIT_CMD) 729b282f3SGlen Barber. if exists(${_P}/git) 829b282f3SGlen BarberGIT_CMD= ${_P}/git 929b282f3SGlen Barber. endif 106e7be14eSGlen Barber. endif 1129b282f3SGlen Barber.endfor 1229b282f3SGlen Barber 1352a8a2deSGlen Barber.if !empty(GIT_CMD) && exists(${GIT_CMD}) 1429b282f3SGlen Barber# Set the git branch and hash to export where needed. 1529b282f3SGlen Barber. if !defined(GITBRANCH) || empty(GITBRANCH) 166e7be14eSGlen BarberGITBRANCH!= ${GIT_CMD} -C ${.CURDIR} rev-parse --abbrev-ref HEAD 2>/dev/null | sed -e 's/\^\///' 1729b282f3SGlen Barber. export GITBRANCH 1829b282f3SGlen Barber. endif 1929b282f3SGlen Barber. if !defined(GITREV) || empty(GITREV) 206e7be14eSGlen BarberGITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || true 2129b282f3SGlen Barber. export GITREV 2229b282f3SGlen Barber. endif 23d3df64adSGlen Barber. if !defined(GITCOUNT) || empty(GITCOUNT) 24*e5c6913aSGlen BarberGITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --first-parent --count HEAD 2>/dev/null || true 25d3df64adSGlen Barber. export GITCOUNT 26d3df64adSGlen Barber. endif 2752a8a2deSGlen Barber.else 2852a8a2deSGlen BarberGITBRANCH= nullbranch 2952a8a2deSGlen BarberGITREV= nullhash 30d3df64adSGlen BarberGITCOUNT= nullcount 3152a8a2deSGlen Barber. export GITBRANCH 3252a8a2deSGlen Barber. export GITREV 33d3df64adSGlen Barber. export GITCOUNT 3452a8a2deSGlen Barber.endif 3586e5b137SGlen Barber 3686e5b137SGlen Barber# Set the build date, primarily for snapshot builds. 3786e5b137SGlen Barber.if !defined(BUILDDATE) || empty(BUILDDATE) 3886e5b137SGlen BarberBUILDDATE!= date +%Y%m%d 3986e5b137SGlen Barber.export BUILDDATE 4086e5b137SGlen Barber.endif 41233a5529SGlen Barber 420be274d3SGlen Barber# Override UNAME_r to allow building ports for a different branch. 430be274d3SGlen BarberUNAME_r= ${REVISION}-${BRANCH} 440be274d3SGlen Barber.export UNAME_r 45