K-means weightp
[x264-7mod.git] / version.sh
blob97c288f9aeb55b1a2e911300ee1e300728d0852c
1 #!/bin/sh
3 cd "$(dirname "$0")" >/dev/null && [ -f x264.h ] || exit 1
5 GIT_HEAD=`git branch --list | grep "*" | awk '{print $2}'`
6 BUILD_ARCH=`grep "SYS_ARCH=" < config.mak | awk -F= '{print $2}'`
7 BIT_DEPTH=`grep "X264_BIT_DEPTH" < x264_config.h | awk '{print $3}'`
8 CHROMA_FORMATS=`grep "X264_CHROMA_FORMAT" < x264_config.h | awk '{print $3}'`
9 if [ $CHROMA_FORMATS == "0" ] ; then
10 CHROMA_FORMATS="all"
11 elif [ $CHROMA_FORMATS == "X264_CSP_I420" ] ; then
12 CHROMA_FORMATS="4:2:0"
13 elif [ $CHROMA_FORMATS == "X264_CSP_I422" ] ; then
14 CHROMA_FORMATS="4:2:2"
15 elif [ $CHROMA_FORMATS == "X264_CSP_I444" ] ; then
16 CHROMA_FORMATS="4:4:4"
19 api="$(grep '#define X264_BUILD' < x264.h | sed 's/^.* \([1-9][0-9]*\).*$/\1/')"
20 ver="x [${BIT_DEPTH}-bit@${CHROMA_FORMATS} ${BUILD_ARCH}]"
21 version=""
23 if [ -d .git ] && command -v git >/dev/null 2>&1 ; then
24 localver="$(($(git rev-list HEAD | wc -l)))"
25 if [ "$localver" -gt 1 ] ; then
26 ver_diff="$(($(git rev-list origin/plain..HEAD | wc -l)))"
27 ver="$((localver-ver_diff))"
28 echo "#define X264_REV $ver"
29 echo "#define X264_REV_DIFF $ver_diff"
30 if [ "$ver_diff" -ne 0 ] ; then
31 ver="$ver+$ver_diff"
33 if git status | grep -q "modified:" ; then
34 ver="${ver}M"
36 ver="$ver $(git rev-list -n 1 HEAD | cut -c 1-7) $GIT_HEAD [${BIT_DEPTH}-bit@${CHROMA_FORMATS} ${BUILD_ARCH}]"
37 version=" r$ver"
41 echo "#define X264_VERSION \"$version\""
42 echo "#define X264_POINTVER \"0.$api.$ver\""