]>
Commit | Line | Data |
---|---|---|
5c21198b | 1 | #!/bin/sh |
d711f013 | 2 | |
1608dfa1 | 3 | VERSION="6.9" |
133b069f | 4 | OUT="$1" |
7e10ba7c | 5 | |
26e074a0 YL |
6 | # get the absolute path for the OUT file |
7 | OUT_NAME=$(basename ${OUT}) | |
8 | OUT_DIR=$(cd $(dirname ${OUT}); pwd) | |
9 | OUT="${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. | |
14 | SRC_DIR=$(dirname $0) | |
15 | SRC_DIR=$(cd ${SRC_DIR}; pwd) | |
16 | cd "${SRC_DIR}" | |
2dc285b7 | 17 | |
26e074a0 YL |
18 | v="" |
19 | if [ -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 | |
32 | fi | |
133b069f | 33 | |
26e074a0 YL |
34 | # set to the default version when failed to get the version |
35 | # information with git | |
36 | if [ -z "${v}" ]; then | |
37 | v="$VERSION" | |
d711f013 | 38 | fi |
133b069f | 39 | |
0a236ef5 | 40 | echo '#include "iw.h"' > "$OUT" |
9bc2505d | 41 | echo "const char iw_version[] = \"$v\";" >> "$OUT" |