source: extensions/gsdl-video/trunk/lib/cascade-lib.bash@ 18425

Last change on this file since 18425 was 18425, checked in by davidb, 15 years ago

Video extension to Greenstone

File size: 3.3 KB
Line 
1
2run_untar()
3{
4 local package=$1
5 local version=$2
6 local ext=$3
7
8 tar_args="";
9
10 if [ $ext = ".tar.gz" ] ; then
11 tar_args="xvzf"
12 elif [ $ext = ".tgz" ] ; then
13 tar_args="xvzf"
14 elif [ $ext = ".tar.bz2" ] ; then
15 tar_args="xvjf"
16 elif [ $ext = ".tar.bz" ] ; then
17 tar_args="xvjf"
18 elif [ $ext = ".tar" ] ; then
19 tar_args="xvf"
20 else
21 echo "Warning: Unrecognized extension: $ext"
22 echo "Assuming tarred, gzipped file"
23 tar_args="xvjf"
24 fi
25
26
27 echo tar $tar_args $package$version$ext
28 tar $tar_args $package$version$ext
29
30 if [ $? != 0 ] ; then
31 echo " Error encountered running *untar* stage of $progname"
32 exit 1
33 fi
34}
35
36opt_run_tarclean()
37{
38 local type=$1
39 local package=$2
40 local version=$3
41
42 if [ $type = "1" ] ; then
43
44 local dir=$package$version
45 if [ -d $dir ] ; then
46 echo /bin/rm -rf $dir
47 /bin/rm -rf $dir
48
49 if [ $? != 0 ] ; then
50 echo " Error encountered running *tarclean* stage of $progname"
51 exit 1
52 fi
53 else
54 echo "Unable to find directory $dir"
55 fi
56 fi
57}
58
59opt_run_untar()
60{
61 local force_untar=$1
62 local auto_untar=$2
63 local package=$3
64 local version=$4
65
66 local ext="";
67
68 if [ ! -z "$5" ] ; then
69 ext=$5
70 else
71 ext=".tar.gz"
72 fi
73
74 if [ $force_untar = "1" ] ; then
75 run_untar $package $version $ext
76 elif [ $auto_config = "1" ] ; then
77 if [ -d $package$version ] ; then
78 echo "Found untarred version of $package$version$ext => no need to untar"
79 else
80 run_untar $package $version $ext
81 fi
82 fi
83}
84
85
86opt_run_configure()
87{
88 local force_config=$1
89 local auto_config=$2
90 local package=$3
91 local version=$4
92 local prefix=$5
93 local opt_args="";
94
95 if [ ! -z "$6" ] ; then
96 opt_args=$6
97 fi
98
99 if [ $force_config = "1" ] ; then
100 echo "[pushd $package$version]"
101 ( cd $package$version ; \
102 echo ./configure --prefix="$prefix" $opt_args ; \
103 ./configure --prefix="$prefix" $opt_args )
104 if [ $? != 0 ] ; then
105 echo " Error encountered running *configure* stage of $progname"
106 exit 1
107 fi
108 echo "[popd]"
109 else
110 if [ $auto_config = "1" ] ; then
111 echo "Found top-level for ${progname%.*} => no need to run ./configure"
112 fi
113 fi
114}
115
116
117opt_run_make()
118{
119 local type=$1
120 local package=$2
121 local version=$3
122 local opt_target=""
123
124 if [ ! -z "$4" ] ; then
125 opt_target=$4
126 fi
127
128 if [ $type = "1" ] ; then
129 ( cd $package$version ; \
130 make $opt_target)
131
132 if [ $? != 0 ] ; then
133 echo " Error encountered running *make $target* stage of $progname"
134 exit 1
135 fi
136 fi
137}
138
139
140
141force_untar=0
142auto_untar=0
143
144force_config=0
145auto_config=0
146
147compile=0
148install=0
149clean=0
150distclean=0
151tarclean=0
152
153if [ $# -gt 0 ] ; then
154 for cmd in $* ; do
155 echo $cmd
156 if [ $cmd = "untar" ] ; then force_untar=1
157 elif [ $cmd = "configure" ] ; then force_config=1
158 elif [ $cmd = "compile" ] ; then compile=1
159 elif [ $cmd = "install" ] ; then install=1
160 elif [ $cmd = "clean" ] ; then clean=1
161 elif [ $cmd = "distclean" ] ; then distclean=1
162 elif [ $cmd = "tarclean" ] ; then tarclean=1
163 fi
164 done
165else
166 # defaults
167 auto_untar=1
168 auto_config=1
169 compile=1
170 install=1
171 clean=0
172 distclean=0
173 tarclean=0
174fi
175
176if [ $auto_config = "1" ] ; then
177 if [ ! -e $package$version/Makefile ] ; then
178 force_config=1
179 fi
180fi
181
Note: See TracBrowser for help on using the repository browser.