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