• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2git rev-list HEAD | sort > config.git-hash
3SRC_PATH=$1
4LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
5if [ $LOCALVER \> 1 ] ; then
6    VER="$(git rev-list HEAD -n 1 | cut -c 1-7)"
7    if git status | grep -q "modified:" ; then
8        VER="${VER}+M"
9    fi
10    GIT_VERSION=$VER
11else
12    GIT_VERSION=
13    VER="x"
14fi
15GIT_VERSION='"'$GIT_VERSION'"'
16rm -f config.git-hash
17
18mkdir -p codec/common/inc
19cat $SRC_PATH/codec/common/inc/version_gen.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > codec/common/inc/version_gen.h.new
20if cmp codec/common/inc/version_gen.h.new codec/common/inc/version_gen.h > /dev/null 2>&1; then
21    # Identical to old version, don't touch it (to avoid unnecessary rebuilds)
22    rm codec/common/inc/version_gen.h.new
23    echo "Keeping existing codec/common/inc/version_gen.h"
24    exit 0
25fi
26mv codec/common/inc/version_gen.h.new codec/common/inc/version_gen.h
27
28echo "Generated codec/common/inc/version_gen.h"
29