Support unrar64.dll
[xy_vsfilter.git] / build_vsfilter.sh
blob8b7dc9eaa492bdb35764fb2e11127df145a65981
1 #!/bin/sh
3 function Usage()
5 echo "Usage:"
6 echo -e "\t$1 [-conf "'"Release"|"Debug"'"] [-plat platform "'"Win32"|"x64"'"] [-action build|clean|rebuild] [-proj project] [-voff|--versioning-off] [-solution sln_file]"
7 echo "Default:"
8 echo -e '-conf\t\t"Release"'
9 echo -e '-plat\t\t"Win32"'
10 echo -e '-action\t\tbuild'
11 echo -e '-project\tvsfilter_2010'
12 echo -e '-solution\tsrc/filters/transform/vsfilter/VSFilter_vs2010.sln'
15 script_dir=`dirname $0`
16 cd $script_dir
18 solution="src/filters/transform/vsfilter/VSFilter_vs2010.sln"
19 action="build"
20 configuration="Release"
21 platform="Win32"
22 project="vsfilter_2010"
23 update_version=1
25 while [ "$1"x != ""x ]
27 if [ "$flag"x == ""x ]; then
28 if [ "$1"x == "-conf"x ]; then
29 flag="configuration"
30 elif [ "$1"x == "-plat"x ]; then
31 flag="platform"
32 elif [ "$1"x == "-action"x ]; then
33 flag="action"
34 elif [ "$1"x == "-proj"x ]; then
35 flag="project"
36 elif [ "$1"x == "-solution"x ]; then
37 flag="solution"
38 elif [ "$1"x == "--versioning-off"x ] || [ "$1"x == "-voff"x ]; then
39 update_version=0
40 flag=""
41 else
42 echo "Invalid arguments"
43 Usage $0
44 exit -1
46 else
47 if [ "${1:0:1}"x == "-"x ]; then
48 echo "Invalid arguments"
49 Usage $0
50 exit -1
52 eval $flag='"'$1'"'
53 flag=""
55 shift
56 done
58 if [ "$flag"x != ""x ]; then
59 echo "Invalid arguments"
60 Usage $0
61 exit -1
64 if [ "$update_version"x == "1"x ]; then
65 echo "Updating version info"
67 #update version info
68 cur_rev_num=`git rev-list HEAD | wc -l | awk '{print $1}'`
69 base_rev_num=`git rev-list 3.0.0.4 | wc -l | awk '{print $1}'`
70 ((rev_num=$cur_rev_num-$base_rev_num+4))
72 rev_sha1=`git rev-parse HEAD`
73 rev_tag=`git describe --tag --abbrev=0`
74 ver_major=`echo $rev_tag | awk -F$'.' '{print $1}'`
75 ver_minor=`echo $rev_tag | awk -F$'.' '{print $2}'`
76 ver_patch=`echo $rev_tag | awk -F$'.' '{print $3}'`
78 echo "#define XY_VSFILTER_VERSION_MAJOR $ver_major
79 #define XY_VSFILTER_VERSION_MINOR $ver_minor
80 #define XY_VSFILTER_VERSION_PATCH $ver_patch
81 #define XY_VSFILTER_VERSION_COMMIT $rev_num
82 #define XY_VSFILTER_VERSION_COMMIT_SHA1 \"$rev_sha1\"" > src/filters/transform/vsfilter/version_in.h
85 platform_type="x86"
86 if [ "$platform"x = "x64"x ]; then
87 platform_type="x86_amd64"
90 configuration=$configuration"|"$platform
92 #build
93 echo '
94 CALL "%VS100COMNTOOLS%../../VC/vcvarsall.bat" '$platform_type'
95 devenv "'$solution'" /'$action' "'$configuration'" /project "'$project'"
96 exit
97 ' | cmd