Permalink
Browse files

Merge commit 'refs/pull/263/head' of github.com:znc/znc

  • Loading branch information...
2 parents c216c94 + 12d9aee commit 65a51ead8eb9b6bb2e9287ba0ec31f1e08c27d35 @DarthGandalf DarthGandalf committed Dec 20, 2012
Showing with 28 additions and 3 deletions.
  1. +3 −3 Makefile.in
  2. +25 −0 version.sh
View
@@ -104,11 +104,11 @@ src/%.o: src/%.cpp Makefile
ifneq "$(GIT)" ""
# If git-describe differs from .version_extra, add a phony target to dependencies, forcing version.o to be recompiled
# znc-0.200-430-g80acaa7 -> -DVERSION_EXTRA="\"-git-430-80acaa7\""
-src/version.o: src/version.cpp Makefile $(shell if [ x`cat .version_extra 2> /dev/null` != x`$(GIT) --git-dir=$(srcdir)/.git describe 2> /dev/null` ]; then echo version_extra_recompile; fi)
+src/version.o: src/version.cpp Makefile $(shell if [ x`cat .version_extra 2> /dev/null` != x`$(srcdir)/version.sh $(GIT) 2> /dev/null` ]; then echo version_extra_recompile; fi)
@mkdir -p .depend src
$(E) Building core object version...
- $(Q)$(CXX) $(shell $(GIT) --git-dir=$(srcdir)/.git describe 2> /dev/null | $(SED) 's/.*-\([0123456789][0123456789]*\)-g\(.*\)/-DVERSION_EXTRA="\\"-git-\1-\2\\""/') $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/version.dep -MT $@
- $(Q)$(GIT) --git-dir=$(srcdir)/.git describe > .version_extra 2> /dev/null || true
+ $(Q)$(CXX) "$(shell $(srcdir)/version.sh $(GIT))" $(CXXFLAGS) -c -o $@ $< -MD -MF .depend/version.dep -MT $@
+ -$(Q)$(srcdir)/version.sh $(GIT) > .version_extra 2> /dev/null
endif
install: znc $(LIBZNC)
View
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Change into the source directory
+cd `dirname $0`
+
+# Our first argument should be the path to git
+GIT="$1"
+if [ "x$GIT" = "x" ]
+then
+ # Let's hope the best
+ GIT=git
+fi
+
+# Figure out the information we need
+LATEST_TAG=`${GIT} describe --abbrev=0 HEAD`
+COMMITS_SINCE=`${GIT} log --format=oneline ${LATEST_TAG}..HEAD | wc -l`
+SHORT_ID=`${GIT} rev-parse --short HEAD`
+
+# If this commit is tagged, don't print anything
+# (the assumption here is: this is a release)
+if [ "x$COMMITS_SINCE" = "x0" ]
+then
+ exit 0
+fi
+echo "-DVERSION_EXTRA=\\\"-git-${COMMITS_SINCE}-${SHORT_ID}\\\""

0 comments on commit 65a51ea

Please sign in to comment.