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; shift
|
---|
100 | local auto_config=$1; shift
|
---|
101 | local package=$1; shift
|
---|
102 | local version=$1; shift
|
---|
103 | local prefix=$1; shift
|
---|
104 |
|
---|
105 | if [ $force_config = "1" ] ; then
|
---|
106 | echo "[pushd $package$version]"
|
---|
107 | ( cd $package$version ; \
|
---|
108 | echo ./configure --prefix="$prefix" $CROSSCOMPILE $@ ; \
|
---|
109 | ./configure --prefix="$prefix" $CROSSCOMPILE $@ )
|
---|
110 | if [ $? != 0 ] ; then
|
---|
111 | echo " Error encountered running *configure* stage of $progname"
|
---|
112 | exit 1
|
---|
113 | fi
|
---|
114 | echo "[popd]"
|
---|
115 | else
|
---|
116 | if [ $auto_config = "1" ] ; then
|
---|
117 | echo "Found top-level for ${progname%.*} => no need to run ./configure"
|
---|
118 | fi
|
---|
119 | fi
|
---|
120 | }
|
---|
121 |
|
---|
122 |
|
---|
123 | opt_run_make()
|
---|
124 | {
|
---|
125 | local type=$1
|
---|
126 | local package=$2
|
---|
127 | local version=$3
|
---|
128 | local opt_target=""
|
---|
129 |
|
---|
130 | if [ ! -z "$4" ] ; then
|
---|
131 | opt_target=$4
|
---|
132 | fi
|
---|
133 |
|
---|
134 | if [ $type = "1" ] ; then
|
---|
135 | ( cd $package$version ; \
|
---|
136 | make $opt_target)
|
---|
137 |
|
---|
138 | if [ $? != 0 ] ; then
|
---|
139 | echo " Error encountered running *make $target* stage of $progname"
|
---|
140 | exit 1
|
---|
141 | fi
|
---|
142 | fi
|
---|
143 | }
|
---|
144 |
|
---|
145 |
|
---|
146 |
|
---|
147 | force_untar=0
|
---|
148 | auto_untar=0
|
---|
149 |
|
---|
150 | force_config=0
|
---|
151 | auto_config=0
|
---|
152 |
|
---|
153 | compile=0
|
---|
154 | install=0
|
---|
155 | clean=0
|
---|
156 | distclean=0
|
---|
157 | tarclean=0
|
---|
158 |
|
---|
159 | if [ $# -gt 0 ] ; then
|
---|
160 | for cmd in $* ; do
|
---|
161 | echo $cmd
|
---|
162 | if [ $cmd = "untar" ] ; then force_untar=1
|
---|
163 | elif [ $cmd = "configure" ] ; then force_config=1
|
---|
164 | elif [ $cmd = "compile" ] ; then compile=1
|
---|
165 | elif [ $cmd = "install" ] ; then install=1
|
---|
166 | elif [ $cmd = "clean" ] ; then clean=1
|
---|
167 | elif [ $cmd = "distclean" ] ; then distclean=1
|
---|
168 | elif [ $cmd = "tarclean" ] ; then tarclean=1
|
---|
169 | fi
|
---|
170 | done
|
---|
171 | else
|
---|
172 | # defaults
|
---|
173 | auto_untar=1
|
---|
174 | auto_config=1
|
---|
175 | compile=1
|
---|
176 | install=1
|
---|
177 | clean=0
|
---|
178 | distclean=0
|
---|
179 | tarclean=0
|
---|
180 | fi
|
---|
181 |
|
---|
182 | if [ $auto_config = "1" ] ; then
|
---|
183 | if [ ! -e $package$version/Makefile ] && [ ! -e $package$version/config.h ] ; then
|
---|
184 | force_config=1
|
---|
185 | fi
|
---|
186 |
|
---|
187 | fi
|
---|
188 |
|
---|