Functions Call number Stat
[xy_vsfilter.git] / build_vsfilter.sh
blobaee61d64f5762eed7f1f5a09b551c6e099988d08
1 #!/bin/sh
3 function Usage()
5 echo "Usage:"
6 echo -e "\t$1 [-conf "'"Release Unicode"|"Debug Unicode"'"] [-action build|clean|rebuild] [-proj project] [-voff|--versioning-off] [-solution sln_file]"
7 echo "Default:"
8 echo -e '-conf\t\t"Release Unicode"'
9 echo -e '-action\t\tbuild'
10 echo -e '-project\tvsfilter_2010'
11 echo -e '-solution\tsrc/filters/transform/vsfilter/VSFilter_vs2010.sln'
14 script_dir=`dirname $0`
15 cd $script_dir
17 solution="src/filters/transform/vsfilter/VSFilter_vs2010.sln"
18 action="build"
19 configuration="Release Unicode"
20 project="vsfilter_2010"
21 update_version=1
23 while [ "$1"x != ""x ]
25 if [ "$flag"x == ""x ]; then
26 if [ "$1"x == "-conf"x ]; then
27 flag="configuration"
28 elif [ "$1"x == "-action"x ]; then
29 flag="action"
30 elif [ "$1"x == "-proj"x ]; then
31 flag="project"
32 elif [ "$1"x == "-solution"x ]; then
33 flag="solution"
34 elif [ "$1"x == "--versioning-off"x ] || [ "$1"x == "-voff"x ]; then
35 update_version=0
36 flag=""
37 else
38 echo "Invalid arguments"
39 Usage $0
40 exit -1
42 else
43 if [ "${1:0:1}"x == "-"x ]; then
44 echo "Invalid arguments"
45 Usage $0
46 exit -1
48 eval $flag='"'$1'"'
49 flag=""
51 shift
52 done
54 if [ "$flag"x != ""x ]; then
55 echo "Invalid arguments"
56 Usage $0
57 exit -1
60 if [ "$update_version"x == "1"x ]; then
61 echo "Updating version info"
63 #update version info
64 cur_rev_num=`git rev-list HEAD | wc -l | awk '{print $1}'`
65 base_rev_num=`git rev-list 3.0.0.4 | wc -l | awk '{print $1}'`
66 ((rev_num=$cur_rev_num-$base_rev_num+4))
68 rev_sha1=`git rev-parse HEAD`
69 rev_tag=`git describe --tag --abbrev=0`
70 ver_major=`echo $rev_tag | awk -F$'.' '{print $1}'`
71 ver_minor=`echo $rev_tag | awk -F$'.' '{print $2}'`
72 ver_patch=`echo $rev_tag | awk -F$'.' '{print $3}'`
74 echo "#define XY_VSFILTER_VERSION_MAJOR $ver_major
75 #define XY_VSFILTER_VERSION_MINOR $ver_minor
76 #define XY_VSFILTER_VERSION_PATCH $ver_patch
77 #define XY_VSFILTER_VERSION_COMMIT $rev_num
78 #define XY_VSFILTER_VERSION_COMMIT_SHA1 \"$rev_sha1\"" > src/filters/transform/vsfilter/version_in.h
81 #build
82 echo '
83 CALL "%VS100COMNTOOLS%../../VC/vcvarsall.bat" x86
84 devenv "'$solution'" /'$action' "'$configuration'" /project "'$project'"
85 exit
86 ' | cmd