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 | source ${vfile} |
---|
17 | |
---|
18 | if [ X${LIBJPEG} = X ] ; then |
---|
19 | echo VERSION FILE NOT CORRECT |
---|
20 | exit 1 |
---|
21 | fi |
---|
22 | |
---|
23 | ######################## Set defaults ############################# |
---|
24 | # Do we clean after build and install |
---|
25 | do_clean="no" |
---|
26 | # Do we build jpeg support? |
---|
27 | do_jpeg="no" |
---|
28 | # Do we build png support? |
---|
29 | do_png="no" |
---|
30 | # Do we build tiff support? |
---|
31 | do_tiff="no" |
---|
32 | # Do we build Adobe Type 1 Font support? |
---|
33 | do_t1="no" |
---|
34 | # Do we build Truetype Font support? |
---|
35 | do_ttf="no" |
---|
36 | |
---|
37 | # Do we build Microwindows/Nano-X support? |
---|
38 | do_nanox="no" |
---|
39 | # Are we noisy when running? |
---|
40 | verbose="no" |
---|
41 | ######################## Parse arguments ########################### |
---|
42 | |
---|
43 | usage() |
---|
44 | { |
---|
45 | cat <<EOF |
---|
46 | do_it [options] |
---|
47 | -A - build and install all libraries |
---|
48 | -j - build JPEG support (default=no) |
---|
49 | -p - build PNG support (default=no) |
---|
50 | -t - build TIFF support (default=no) |
---|
51 | -1 - build Adobe Type 1 font support (default=no) |
---|
52 | -T - build Truetype font support (default=no) |
---|
53 | -n - build Microwindows/Nano-X support (default=no) |
---|
54 | -c - clean after building (default=no) |
---|
55 | -v - verbose |
---|
56 | |
---|
57 | NOTES: |
---|
58 | + Use of each option toggles the setting. For example, \"-v -v -A -1\" |
---|
59 | results in verbose=no and all steps done except Type 1 fonts. |
---|
60 | + RTEMS_MAKEFILE_PATH must be set. |
---|
61 | + By default, nothing is built. |
---|
62 | EOF |
---|
63 | } |
---|
64 | |
---|
65 | fatal() |
---|
66 | { |
---|
67 | usage |
---|
68 | exit 1 |
---|
69 | } |
---|
70 | |
---|
71 | check_status() |
---|
72 | { |
---|
73 | if [ $1 -ne 0 ] ; then |
---|
74 | shift |
---|
75 | echo "ERROR: $*" >&2 |
---|
76 | exit 1 |
---|
77 | fi |
---|
78 | } |
---|
79 | |
---|
80 | toggle() |
---|
81 | { |
---|
82 | case $1 in |
---|
83 | no) echo "yes" ;; |
---|
84 | yes) echo "no" ;; |
---|
85 | *) fatal "Unknown value to toggle ($1)" ;; |
---|
86 | esac |
---|
87 | } |
---|
88 | |
---|
89 | while getopts Ajpt1Tncv OPT |
---|
90 | do |
---|
91 | case "$OPT" in |
---|
92 | A) do_jpeg="yes" |
---|
93 | do_png="yes" |
---|
94 | do_tiff="yes" |
---|
95 | do_t1="yes" |
---|
96 | do_ttf="yes" |
---|
97 | do_nanox="yes" |
---|
98 | ;; |
---|
99 | j) do_jpeg=`toggle ${do_jpeg}` ;; |
---|
100 | p) do_png=`toggle ${do_png}` ;; |
---|
101 | t) do_tiff=`toggle ${do_tiff}` ;; |
---|
102 | 1) do_t1=`toggle ${do_t1}` ;; |
---|
103 | T) do_ttf=`toggle ${do_ttf}` ;; |
---|
104 | n) do_nanox=`toggle ${do_nanox}` ;; |
---|
105 | c) do_clean=`toggle ${do_clean}` ;; |
---|
106 | v) verbose=`toggle ${verbose}` ;; |
---|
107 | *) fatal;; |
---|
108 | esac |
---|
109 | done |
---|
110 | |
---|
111 | shiftcount=`expr $OPTIND - 1` |
---|
112 | shift $shiftcount |
---|
113 | |
---|
114 | if [ ${verbose} = yes ] ; then |
---|
115 | echo "JPEG Library : " ${LIBJPEG} |
---|
116 | echo "Build JPEG Library : " ${do_jpeg} |
---|
117 | echo "PNG Library : " ${LIBPNG} |
---|
118 | echo "Build PNG Library : " ${do_png} |
---|
119 | echo "TIFF Library : " ${TIFFLIB} |
---|
120 | echo "Build TIFF Library : " ${do_tiff} |
---|
121 | echo "" |
---|
122 | echo "Build TrueType Font Library : " ${do_ttf} |
---|
123 | echo "TrueType Font Library : " ${FREETYPE} |
---|
124 | echo "Build Adobe Type 1 Font Library : " ${do_t1} |
---|
125 | echo "Adobe Type 1 Font Library : " ${T1LIB} |
---|
126 | echo "" |
---|
127 | echo "Build Microwindows/Nano-X : " ${do_nanox} |
---|
128 | echo "Microwindows/Nano-X Source : " ${NANOX} |
---|
129 | |
---|
130 | echo "Clean after install : " ${do_clean} |
---|
131 | fi |
---|
132 | |
---|
133 | ######### START OF Consistency checks |
---|
134 | |
---|
135 | if [ X${RTEMS_MAKEFILE_PATH} = X ] ; then |
---|
136 | echo RTEMS_MAKEFILE_PATH not set |
---|
137 | exit 1 |
---|
138 | fi |
---|
139 | |
---|
140 | # XXX TBD check if enabled before checking if present? |
---|
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 | test -d ${NANOX} |
---|
152 | check_status $? "${NANOX} not present" |
---|
153 | |
---|
154 | test -d ${RTEMS_MAKEFILE_PATH} |
---|
155 | check_status $? "${RTEMS_MAKEFILE_PATH} not present" |
---|
156 | |
---|
157 | ######### END OF Consistency checks |
---|
158 | |
---|
159 | echo "Generating RTEMS_SETTINGS file..." |
---|
160 | make -f Makefile.settings clean all |
---|
161 | check_status $? Could not generate RTEMS_SETTINGS |
---|
162 | |
---|
163 | source ./RTEMS_SETTINGS |
---|
164 | |
---|
165 | PREFIX=${BSPTOP} |
---|
166 | |
---|
167 | if [ ${verbose} = yes ] ; then |
---|
168 | echo "USING ${PREFIX} for install point!!!" |
---|
169 | fi |
---|
170 | |
---|
171 | case ${BSP} in |
---|
172 | pc386) ;; # can be used to turn on detect svgalib supportable on this BSP |
---|
173 | *) |
---|
174 | esac |
---|
175 | |
---|
176 | ######### Log Directory |
---|
177 | LOGDIR=${BASEDIR}/log |
---|
178 | if [ ! -d ${LOGDIR} ] ; then |
---|
179 | mkdir ${LOGDIR} |
---|
180 | fi |
---|
181 | ######### |
---|
182 | |
---|
183 | ######### Build and install JPEG |
---|
184 | j_jpeg() |
---|
185 | { |
---|
186 | cd ${LIBJPEG} |
---|
187 | CFLAGS="${CPU_CFLAGS}" \ |
---|
188 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
189 | --includedir=${PREFIX}/lib/include \ |
---|
190 | --disable-shared \ |
---|
191 | --disable-programs |
---|
192 | check_status $? Could not configure ${LIBJPEG} |
---|
193 | |
---|
194 | make |
---|
195 | check_status $? Could not make ${LIBJPEG} |
---|
196 | |
---|
197 | make install |
---|
198 | check_status $? Could not make isntall ${LIBJPEG} |
---|
199 | |
---|
200 | if [ ${do_clean} = yes ] ; then |
---|
201 | make distclean |
---|
202 | check_status $? Could not make distclean ${LIBJPEG} |
---|
203 | fi |
---|
204 | |
---|
205 | cd .. |
---|
206 | } |
---|
207 | |
---|
208 | if [ ${do_jpeg} = yes ] ; then |
---|
209 | echo "Building ${LIBJPEG} ..." |
---|
210 | j_jpeg >${LOGDIR}/${TARGET}-${LIBJPEG}.log 2>&1 |
---|
211 | fi |
---|
212 | |
---|
213 | ######### Build and install PNG support |
---|
214 | j_png() |
---|
215 | { |
---|
216 | cd ${LIBPNG} |
---|
217 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
218 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
219 | --includedir=${PREFIX}/lib/include \ |
---|
220 | --disable-shared |
---|
221 | check_status $? Could not configure ${LIBPNG} |
---|
222 | |
---|
223 | make |
---|
224 | check_status $? Could not make ${LIBPNG} |
---|
225 | |
---|
226 | make install |
---|
227 | check_status $? Could not make isntall ${LIBPNG} |
---|
228 | |
---|
229 | if [ ${do_clean} = yes ] ; then |
---|
230 | make distclean |
---|
231 | check_status $? Could not make distclean ${LIBPNG} |
---|
232 | fi |
---|
233 | |
---|
234 | cd .. |
---|
235 | } |
---|
236 | |
---|
237 | if [ ${do_png} = yes ] ; then |
---|
238 | echo "Building ${LIBPNG} ..." |
---|
239 | j_png >${LOGDIR}/${TARGET}-${LIBPNG}.log 2>&1 |
---|
240 | fi |
---|
241 | |
---|
242 | ######### Build and install TIFF support |
---|
243 | j_tiff() |
---|
244 | { |
---|
245 | cd ${TIFFLIB} |
---|
246 | CFLAGS="${CPU_CFLAGS}" \ |
---|
247 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
248 | --includedir=${PREFIX}/lib/include \ |
---|
249 | --disable-shared |
---|
250 | check_status $? Could not configure ${TIFFLIB} |
---|
251 | |
---|
252 | make |
---|
253 | check_status $? Could not make ${TIFFLIB} |
---|
254 | |
---|
255 | make install |
---|
256 | check_status $? Could not make isntall ${TIFFLIB} |
---|
257 | |
---|
258 | if [ ${do_clean} = yes ] ; then |
---|
259 | make distclean |
---|
260 | check_status $? Could not make distclean ${TIFFLIB} |
---|
261 | fi |
---|
262 | |
---|
263 | cd .. |
---|
264 | } |
---|
265 | |
---|
266 | if [ ${do_tiff} = yes ] ; then |
---|
267 | echo "Building ${TIFFLIB} ..." |
---|
268 | j_tiff >${LOGDIR}/${TARGET}-${TIFFLIB}.log 2>&1 |
---|
269 | fi |
---|
270 | |
---|
271 | ######### Build and install Adobe Type 1 Font support |
---|
272 | j_t1() |
---|
273 | { |
---|
274 | cd ${T1LIB} |
---|
275 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
276 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
277 | --includedir=${PREFIX}/lib/include \ |
---|
278 | --datadir=${PREFIX}/share \ |
---|
279 | --disable-shared \ |
---|
280 | --without-athena --without-x |
---|
281 | check_status $? Could not configure ${T1LIB} |
---|
282 | |
---|
283 | make |
---|
284 | check_status $? Could not make ${T1LIB} |
---|
285 | |
---|
286 | make install |
---|
287 | check_status $? Could not make isntall ${T1LIB} |
---|
288 | |
---|
289 | if [ ${do_clean} = yes ] ; then |
---|
290 | make distclean |
---|
291 | check_status $? Could not make distclean ${T1LIB} |
---|
292 | fi |
---|
293 | |
---|
294 | cd .. |
---|
295 | } |
---|
296 | |
---|
297 | if [ ${do_t1} = yes ] ; then |
---|
298 | echo "Building ${T1LIB}..." |
---|
299 | j_t1 >${LOGDIR}/${TARGET}-${T1LIB}.log 2>&1 |
---|
300 | fi |
---|
301 | |
---|
302 | ######### Build and install Truetype Font support |
---|
303 | j_ttf() |
---|
304 | { |
---|
305 | cd ${FREETYPE} |
---|
306 | CFLAGS="${BSP_CFLAGS} ${CPU_CFLAGS}" \ |
---|
307 | ./configure --host=${TARGET} --prefix=${PREFIX} \ |
---|
308 | --includedir=${PREFIX}/lib/include \ |
---|
309 | --disable-shared |
---|
310 | check_status $? Could not configure ${FREETYPE} |
---|
311 | |
---|
312 | make |
---|
313 | check_status $? Could not make ${FREETYPE} |
---|
314 | |
---|
315 | make install |
---|
316 | check_status $? Could not make isntall ${FREETYPE} |
---|
317 | |
---|
318 | if [ ${do_clean} = yes ] ; then |
---|
319 | make distclean |
---|
320 | check_status $? Could not make distclean ${FREETYPE} |
---|
321 | fi |
---|
322 | |
---|
323 | cd .. |
---|
324 | } |
---|
325 | |
---|
326 | if [ ${do_ttf} = yes ] ; then |
---|
327 | echo "Building ${FREETYPE} ..." |
---|
328 | j_ttf >${LOGDIR}/${TARGET}-${FREETYPE}.log 2>&1 |
---|
329 | fi |
---|
330 | |
---|
331 | ######### Build and install Nano-X support |
---|
332 | j_nanox() |
---|
333 | { |
---|
334 | cd ${NANOX}/src |
---|
335 | |
---|
336 | # RTEMS_MAKEFILE_PATH inherited |
---|
337 | export RTEMS_MAKEFILE_PATH |
---|
338 | |
---|
339 | make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems |
---|
340 | check_status $? Could not make ${NANOX} |
---|
341 | |
---|
342 | make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems install |
---|
343 | check_status $? Could not make isntall ${NANOX} |
---|
344 | |
---|
345 | if [ ${do_clean} = yes ] ; then |
---|
346 | make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems clean |
---|
347 | check_status $? Could not make distclean ${NANOX} |
---|
348 | fi |
---|
349 | |
---|
350 | cd ../.. |
---|
351 | } |
---|
352 | |
---|
353 | if [ ${do_nanox} = yes ] ; then |
---|
354 | echo "Building ${NANOX} ..." |
---|
355 | j_nanox >${LOGDIR}/${TARGET}-${NANOX}.log 2>&1 |
---|
356 | fi |
---|
357 | |
---|
358 | exit 0 |
---|