iw: bump version to 4.7
[thirdparty/iw.git] / version.sh
CommitLineData
5c21198b 1#!/bin/sh
d711f013 2
feea0ff2 3VERSION="4.7"
133b069f 4OUT="$1"
7e10ba7c 5
26e074a0
YL
6# get the absolute path for the OUT file
7OUT_NAME=$(basename ${OUT})
8OUT_DIR=$(cd $(dirname ${OUT}); pwd)
9OUT="${OUT_DIR}/${OUT_NAME}"
10
11# the version check should be under the source directory
12# where this script is located, instead of the currect directory
13# where this script is excuted.
14SRC_DIR=$(dirname $0)
15SRC_DIR=$(cd ${SRC_DIR}; pwd)
16cd "${SRC_DIR}"
2dc285b7 17
26e074a0
YL
18v=""
19if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
20 git update-index --refresh --unmerged > /dev/null
21 descr=$(git describe --match=v* 2>/dev/null)
22 if [ $? -eq 0 ]; then
23 # on git builds check that the version number above
24 # is correct...
25 if [ "${descr%%-*}" = "v$VERSION" ]; then
26 v="${descr#v}"
27 if git diff-index --name-only HEAD | read dummy ; then
28 v="$v"-dirty
29 fi
30 fi
31 fi
32fi
133b069f 33
26e074a0
YL
34# set to the default version when failed to get the version
35# information with git
36if [ -z "${v}" ]; then
37 v="$VERSION"
d711f013 38fi
133b069f 39
0a236ef5 40echo '#include "iw.h"' > "$OUT"
9bc2505d 41echo "const char iw_version[] = \"$v\";" >> "$OUT"