1 | #! /bin/sh |
---|
2 | # |
---|
3 | # Script to help build RTEMS Graphics Toolkit |
---|
4 | # |
---|
5 | # $Id$ |
---|
6 | # |
---|
7 | |
---|
8 | BASEDIR=`dirname $0` |
---|
9 | |
---|
10 | vfile=`dirname $0`/VERSIONS |
---|
11 | if [ ! -r ${vfile} ] ; then |
---|
12 | echo VERSIONS file not found |
---|
13 | exit 1 |
---|
14 | fi |
---|
15 | |
---|
16 | if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then |
---|
17 | echo RTEMS_MAKEFILE_PATH not set |
---|
18 | exit 1 |
---|
19 | fi |
---|
20 | |
---|
21 | source ${vfile} |
---|
22 | |
---|
23 | if [ X${LIBJPEG} = X ] ; then |
---|
24 | echo VERSION FILE NOT CORRECT |
---|
25 | exit 1 |
---|
26 | fi |
---|
27 | |
---|
28 | ######################## Set defaults ############################# |
---|
29 | # Do we clean after build and install |
---|
30 | do_clean="no" |
---|
31 | # Do we build jpeg support? |
---|
32 | do_jpeg="no" |
---|
33 | # Do we build png support? |
---|
34 | do_png="no" |
---|
35 | # Do we build tiff support? |
---|
36 | do_tiff="no" |
---|
37 | # Do we build Adobe Type 1 Font support? |
---|
38 | do_t1="no" |
---|
39 | # Do we build Truetype Font support? |
---|
40 | do_ttf="no" |
---|
41 | # Are we noisy when running? |
---|
42 | verbose="no" |
---|
43 | ######################## Parse arguments ########################### |
---|
44 | |
---|
45 | usage() |
---|
46 | { |
---|
47 | cat <<EOF |
---|
48 | do_one [options] CPU BSP |
---|
49 | -A - build and install all libraries |
---|
50 | -j - build JPEG support (default=no) |
---|
51 | -p - build PNG support (default=no) |
---|
52 | -t - build TIFF support (default=no) |
---|
53 | -1 - build Adobe Type 1 font support (default=no) |
---|
54 | -T - build Truetype font support (default=no) |
---|
55 | -c - clean after building (default=no) |
---|
56 | -v - verbose |
---|
57 | |
---|
58 | NOTES: |
---|
59 | + Use of each option toggles the setting. For example, \"-v -v -A -1\" |
---|
60 | results in verbose=no and all steps done except Type 1 fonts. |
---|
61 | EOF |
---|
62 | } |
---|
63 | |
---|
64 | fatal() |
---|
65 | { |
---|
66 | usage |
---|
67 | exit 1 |
---|
68 | } |
---|
69 | |
---|
70 | check_status() |
---|
71 | { |
---|
72 | if [ $1 -ne 0 ] ; then |
---|
73 | shift |
---|
74 | echo "ERROR: $*" >&2 |
---|
75 | exit 1 |
---|
76 | fi |
---|
77 | } |
---|
78 | |
---|
79 | toggle() |
---|
80 | { |
---|
81 | case $1 in |
---|
82 | no) echo "yes" ;; |
---|
83 | yes) echo "no" ;; |
---|
84 | *) fatal "Unknown value to toggle ($1)" ;; |
---|
85 | esac |
---|
86 | } |
---|
87 | |
---|
88 | while getopts Ajpt1Tv OPT |
---|
89 | do |
---|
90 | case "$OPT" in |
---|
91 | A) do_jpeg="yes" |
---|
92 | do_png="yes" |
---|
93 | do_tiff="yes" |
---|
94 | do_t1="yes" |
---|
95 | do_ttf="yes" |
---|
96 | ;; |
---|
97 | j) do_jpeg=`toggle ${do_jpeg}` ;; |
---|
98 | p) do_png=`toggle ${do_png}` ;; |
---|
99 | t) do_tiff=`toggle ${do_tiff}` ;; |
---|
100 | 1) do_t1=`toggle ${do_t1}` ;; |
---|
101 | T) do_ttf=`toggle ${do_ttf}` ;; |
---|
102 | c) do_clean=`toggle ${do_clean}` ;; |
---|
103 | v) verbose=`toggle ${verbose}` ;; |
---|
104 | *) fatal;; |
---|
105 | esac |
---|
106 | done |
---|
107 | |
---|
108 | ########################### Grab CPU/BSP ########################### |
---|
109 | |
---|
110 | shiftcount=`expr $OPTIND - 1` |
---|
111 | shift $shiftcount |
---|
112 | |
---|
113 | cpu=${1} |
---|
114 | bsp=${2} |
---|
115 | |
---|
116 | case ${cpu} in |
---|
117 | m32c) |
---|
118 | do_ada=no |
---|
119 | do_cxx=no |
---|
120 | run_acats=no |
---|
121 | echo M32C does not support C++ or Ada |
---|
122 | ;; |
---|
123 | *);; |
---|
124 | esac |
---|
125 | |
---|
126 | if [ ${verbose} = yes ] ; then |
---|
127 | echo "JPEG Library : " ${LIBJPEG} |
---|
128 | echo "Build JPEG Library : " ${do_jpeg} |
---|
129 | echo "PNG Library : " ${LIBPNG} |
---|
130 | echo "Build PNG Library : " ${do_png} |
---|
131 | echo "TIFF Library : " ${TIFFLIB} |
---|
132 | echo "Build TIFF Library : " ${do_tiff} |
---|
133 | echo "" |
---|
134 | echo "Build TrueType Font Library : " ${do_ttf} |
---|
135 | echo "TrueType Font Library : " ${FREETYPE} |
---|
136 | echo "Adobe Type 1 Font Library : " ${T1LIB} |
---|
137 | echo "JPEG Library : " ${do_t1} |
---|
138 | echo "Clean after instal : " ${do_clean} |
---|
139 | fi |
---|
140 | |
---|
141 | test -d ${LIBJPEG} |
---|
142 | check_status $? "${LIBJPEG} not present" |
---|
143 | test -d ${FREETYPE} |
---|
144 | check_status $? "${FREETYPE} not present" |
---|
145 | test -d ${LIBPNG} |
---|
146 | check_status $? "${LIBPNG} not present" |
---|
147 | test -d ${T1LIB} |
---|
148 | check_status $? "${T1LIB} not present" |
---|
149 | test -d ${TIFFLIB} |
---|
150 | check_status $? "${TIFFLIB} not present" |
---|
151 | |
---|
152 | test -d ${RTEMS_MAKEFILE_PATH} |
---|
153 | check_status $? "${RTEMS_MAKEFILE_PATH} not present" |
---|
154 | |
---|
155 | ######### END OF Consistency checks |
---|
156 | |
---|
157 | echo "Generating RTEMS_SETTINGS file..." |
---|
158 | make -f Makefile.settings clean all |
---|
159 | check_status $? Could not generate RTEMS_SETTINGS |
---|
160 | |
---|
161 | source ./RTEMS_SETTINGS |
---|
162 | |
---|
163 | PREFIX=${BSPTOP} |
---|
164 | |
---|
165 | if [ ${verbose} = yes ] ; then |
---|
166 | echo "USING ${PREFIX} for install point!!!" |
---|
167 | fi |
---|
168 | |
---|
169 | |
---|
170 | ######### Log Directory |
---|
171 | LOGDIR=${BASEDIR}/log |
---|
172 | if [ ! -d ${LOGDIR} ] ; then |
---|
173 | mkdir ${LOGDIR} |
---|
174 | fi |
---|
175 | ######### |
---|
176 | |
---|
177 | ######### Build and install JPEG |
---|
178 | j_jpeg() |
---|
179 | { |
---|
180 | cd ${LIBJPEG} |
---|
181 | CFLAGS="${CPU_CFLAGS}" \ |
---|
182 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
183 | --includedir=${PREFIX}/lib/include \ |
---|
184 | --disable-shared \ |
---|
185 | --disable-programs |
---|
186 | check_status $? Could not configure ${LIBJPEG} |
---|
187 | |
---|
188 | make |
---|
189 | check_status $? Could not make ${LIBJPEG} |
---|
190 | |
---|
191 | make install |
---|
192 | check_status $? Could not make isntall ${LIBJPEG} |
---|
193 | |
---|
194 | if [ ${do_clean} = yes ] ; then |
---|
195 | make distclean |
---|
196 | check_status $? Could not make distclean ${LIBJPEG} |
---|
197 | fi |
---|
198 | |
---|
199 | cd .. |
---|
200 | } |
---|
201 | |
---|
202 | if [ ${do_jpeg} = yes ] ; then |
---|
203 | echo "Building ${LIBJPEG} ..." |
---|
204 | j_jpeg >${LOGDIR}/${TARGET}-${LIBJPEG}.log 2>&1 |
---|
205 | fi |
---|
206 | |
---|
207 | ######### Build and install PNG support |
---|
208 | j_png() |
---|
209 | { |
---|
210 | cd ${LIBPNG} |
---|
211 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
212 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
213 | --includedir=${PREFIX}/lib/include \ |
---|
214 | --disable-shared |
---|
215 | check_status $? Could not configure ${LIBPNG} |
---|
216 | |
---|
217 | make |
---|
218 | check_status $? Could not make ${LIBPNG} |
---|
219 | |
---|
220 | make install |
---|
221 | check_status $? Could not make isntall ${LIBPNG} |
---|
222 | |
---|
223 | if [ ${do_clean} = yes ] ; then |
---|
224 | make distclean |
---|
225 | check_status $? Could not make distclean ${LIBPNG} |
---|
226 | fi |
---|
227 | |
---|
228 | cd .. |
---|
229 | } |
---|
230 | |
---|
231 | if [ ${do_png} = yes ] ; then |
---|
232 | echo "Building ${LIBPNG} ..." |
---|
233 | j_png >${LOGDIR}/${TARGET}-${LIBPNG}.log 2>&1 |
---|
234 | fi |
---|
235 | |
---|
236 | ######### Build and install TIFF support |
---|
237 | j_tiff() |
---|
238 | { |
---|
239 | cd ${TIFFLIB} |
---|
240 | CFLAGS="${CPU_CFLAGS}" \ |
---|
241 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
242 | --includedir=${PREFIX}/lib/include \ |
---|
243 | --disable-shared |
---|
244 | check_status $? Could not configure ${TIFFLIB} |
---|
245 | |
---|
246 | make |
---|
247 | check_status $? Could not make ${TIFFLIB} |
---|
248 | |
---|
249 | make install |
---|
250 | check_status $? Could not make isntall ${TIFFLIB} |
---|
251 | |
---|
252 | if [ ${do_clean} = yes ] ; then |
---|
253 | make distclean |
---|
254 | check_status $? Could not make distclean ${TIFFLIB} |
---|
255 | fi |
---|
256 | |
---|
257 | cd .. |
---|
258 | } |
---|
259 | |
---|
260 | if [ ${do_tiff} = yes ] ; then |
---|
261 | echo "Building ${TIFFLIB} ..." |
---|
262 | j_tiff >${LOGDIR}/${TARGET}-${TIFFLIB}.log 2>&1 |
---|
263 | fi |
---|
264 | |
---|
265 | ######### Build and install Adobe Type 1 Font support |
---|
266 | j_t1() |
---|
267 | { |
---|
268 | cd ${T1LIB} |
---|
269 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
270 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
271 | --includedir=${PREFIX}/lib/include \ |
---|
272 | --datadir=${PREFIX}/share \ |
---|
273 | --disable-shared \ |
---|
274 | --without-athena --without-x |
---|
275 | check_status $? Could not configure ${T1LIB} |
---|
276 | |
---|
277 | make |
---|
278 | check_status $? Could not make ${T1LIB} |
---|
279 | |
---|
280 | make install |
---|
281 | check_status $? Could not make isntall ${T1LIB} |
---|
282 | |
---|
283 | if [ ${do_clean} = yes ] ; then |
---|
284 | make distclean |
---|
285 | check_status $? Could not make distclean ${T1LIB} |
---|
286 | fi |
---|
287 | |
---|
288 | cd .. |
---|
289 | } |
---|
290 | |
---|
291 | if [ ${do_t1} = yes ] ; then |
---|
292 | echo "Building ${T1LIB}..." |
---|
293 | j_t1 >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1 |
---|
294 | fi |
---|
295 | |
---|
296 | ######### Build and install Truetype Font support |
---|
297 | j_ttf() |
---|
298 | { |
---|
299 | cd ${FREETYPE} |
---|
300 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
301 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
302 | --includedir=${PREFIX}/lib/include \ |
---|
303 | --disable-shared |
---|
304 | check_status $? Could not configure ${FREETYPE} |
---|
305 | |
---|
306 | make |
---|
307 | check_status $? Could not make ${FREETYPE} |
---|
308 | |
---|
309 | make install |
---|
310 | check_status $? Could not make isntall ${FREETYPE} |
---|
311 | |
---|
312 | if [ ${do_clean} = yes ] ; then |
---|
313 | make distclean |
---|
314 | check_status $? Could not make distclean ${FREETYPE} |
---|
315 | fi |
---|
316 | |
---|
317 | cd .. |
---|
318 | } |
---|
319 | |
---|
320 | if [ ${do_ttf} = yes ] ; then |
---|
321 | echo "Building ${FREETYPE} ..." |
---|
322 | j_ttf >${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1 |
---|
323 | fi |
---|
324 | |
---|
325 | exit 0 |
---|