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