forked from yrutschle/sslh
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
version.h: dynamically create version number based on git
When building the source from a checked out tag, eg v1.15, VERSION will equal v1.15. However, when building from anything other than a tagged version, you get 'v1.15-4-g50432d5-dirty' meaning I was 4 patches in front of v1.15, particularly '50432d5' was my current HEAD, and I had uncommited changes, '-dirty'. Very useful for folks submitting bug reports on versions they compiled themselves. Signed-off-by: Jason Cooper <[email protected]>
- Loading branch information
Showing
4 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ sslh-fork | |
sslh-select | ||
sslh.8.gz | ||
tags | ||
version.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/sh | ||
|
||
if [ ${#} -eq 1 ] && [ "x$1" == "x-r" ]; then | ||
# release text only | ||
QUIET=1 | ||
else | ||
QUIET=0 | ||
fi | ||
|
||
if head=`git rev-parse --verify HEAD 2>/dev/null`; then | ||
|
||
if [ $QUIET -ne 1 ]; then | ||
printf "#ifndef _VERSION_H_ \n" | ||
printf "#define _VERSION_H_ \n\n" | ||
printf "#define VERSION \"" | ||
fi | ||
|
||
# generate the version info based on the tag | ||
(git describe --tags || git --describe || git describe --all --long) \ | ||
2>/dev/null | tr -d '\n' | ||
|
||
# Are there uncommitted changes? | ||
git update-index --refresh --unmerged > /dev/null | ||
if git diff-index --name-only HEAD | grep -v "^scripts/package" \ | ||
| read dummy; then | ||
printf '%s' -dirty | ||
fi | ||
|
||
if [ $QUIET -ne 1 ]; then | ||
printf "\"\n" | ||
printf "\n#endif\n" | ||
fi | ||
fi |