build.sh: Simplify checks for ACLOCAL, PKG_CONFIG_PATH, etc.
[xorg-util-modular.git] / build-from-tarballs.sh
blob27731ccd4c4dd77c92187382d4a4e431576b8794
1 #!/bin/sh
3 # global environment variables you may set:
4 # CACHE: absolute path to a global autoconf cache
5 # QUIET: hush the configure script noise
6 # CONFFLAGS: flags to pass to all configure scripts
8 failed() {
9 if test x"$NOQUIT" = x1; then
10 echo "***** $1 failed on $2/$3"
11 else
12 exit 1
16 build() {
17 test "$USEMODULEDIRS" = "yes" && cd $1
19 TARBALL=`ls -1rt $2-*.tar.$COMPRESSION 2> /dev/null | tail -n 1`
21 if test x"$TARBALL" = x; then
22 echo "WARNING: $2 does not exist -- skipping"
23 test "$USEMODULEDIRS" = "yes" && cd ..
24 return
26 TARDIR=`echo $TARBALL | sed "s,.tar.$COMPRESSION,,"`
28 echo "Building $1 module component $TARDIR..."
30 case $COMPRESSION in
31 bz2)
32 tar xjf $TARBALL
33 break;;
34 gz)
35 tar xvf $TARBALL
36 break;;
37 esac
39 cd $TARDIR
41 if test "$1" = "xserver" && test "$2" = "xorg-server" && test -n "$MESAPATH"; then
42 MESA=-"-with-mesa-source=${MESAPATH}"
43 else
44 MESA=
47 eval sh configure --prefix=${PREFIX} ${MESA} ${QUIET:+--quiet} \
48 ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} || failed configure $1 $2
49 make || failed make $1 $2
50 if test x"$CLEAN" = x1; then
51 make clean || failed clean $1 $2
53 if test x"$DIST" = x1; then
54 make dist || failed dist $1 $2
56 if test x"$DISTCHECK" = x1; then
57 make distcheck || failed distcheck $1 $2
59 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH make install || \
60 failed install $1 $2
62 cd ..
63 test "$USEMODULEDIRS" = "yes" && cd ..
66 # protocol headers have no build order dependencies
67 build_proto() {
68 build proto applewmproto
69 build proto bigreqsproto
70 build proto compositeproto
71 build proto damageproto
72 build proto dmxproto
73 build proto evieext
74 build proto fixesproto
75 build proto fontcacheproto
76 build proto fontsproto
77 build proto glproto
78 build proto inputproto
79 build proto kbproto
80 build proto randrproto
81 build proto recordproto
82 build proto renderproto
83 build proto resourceproto
84 build proto scrnsaverproto
85 build proto trapproto
86 build proto videoproto
87 build proto windowswmproto
88 build proto xcmiscproto
89 build proto xextproto
90 build proto xf86bigfontproto
91 build proto xf86dgaproto
92 build proto xf86driproto
93 build proto xf86miscproto
94 build proto xf86vidmodeproto
95 build proto xineramaproto
96 build proto xproto
99 # bitmaps is needed for building apps, so has to be done separately first
100 # cursors depends on apps/xcursorgen
101 # xkbdata depends on apps/xkbcomp
102 build_data() {
103 # build data xbitmaps
104 build data xcursor-themes
105 build data xkbdata
108 # All protocol modules must be installed before the libs (okay, that's an
109 # overstatement, but all protocol modules should be installed anyway)
111 # the libraries have a dependency order:
112 # xtrans, Xau, Xdmcp before anything else
113 # fontenc before Xfont
114 # ICE before SM
115 # X11 before Xext
116 # (X11 and SM) before Xt
117 # Xt before Xmu and Xpm
118 # Xext before any other extension library
119 # Xfixes before Xcomposite
120 # Xp before XprintUtil before XprintAppUtil
121 build_lib() {
122 build lib xtrans
123 build lib libXau
124 build lib libXdmcp
125 build lib libX11
126 build lib libXext
127 build lib libAppleWM
128 build lib libWindowsWM
129 build lib libdmx
130 build lib libfontenc
131 build lib libFS
132 build lib libICE
133 #build lib liblbxutil
134 #build lib liboldX
135 build lib libSM
136 build lib libXt
137 build lib libXmu
138 build lib libXpm
139 build lib libXaw
140 build lib libXfixes
141 build lib libXcomposite
142 build lib libXrender
143 build lib libXdamage
144 build lib libXcursor
145 build lib libXevie
146 build lib libXfont
147 build lib libXfontcache
148 build lib libXft
149 build lib libXi
150 build lib libXinerama
151 build lib libxkbfile
152 build lib libxkbui
153 build lib libXrandr
154 build lib libXres
155 build lib libXScrnSaver
156 build lib libXTrap
157 build lib libXtst
158 build lib libXv
159 build lib libXvMC
160 build lib libXxf86dga
161 build lib libXxf86misc
162 build lib libXxf86vm
165 # Most apps depend at least on libX11.
167 # bdftopcf depends on libXfont
168 # mkfontscale depends on libfontenc and libfreetype
169 # mkfontdir depends on mkfontscale
171 # TODO: detailed breakdown of which apps require which libs
172 build_app() {
173 build app appres
174 build app bdftopcf
175 build app beforelight
176 build app bitmap
177 build app editres
178 build app fonttosfnt
179 build app fslsfonts
180 build app fstobdf
181 build app iceauth
182 build app ico
183 build app listres
184 build app luit
185 build app mkcfm
186 build app mkfontdir
187 build app mkfontscale
188 build app oclock
189 # build app pclcomp
190 # build app proxymngr
191 build app rgb
192 build app rstart
193 build app scripts
194 build app sessreg
195 build app setxkbmap
196 build app showfont
197 build app smproxy
198 build app twm
199 build app viewres
200 build app x11perf
201 build app xauth
202 build app xbiff
203 build app xcalc
204 build app xclipboard
205 build app xclock
206 build app xcmsdb
207 build app xconsole
208 build app xcursorgen
209 build app xdbedizzy
210 build app xditview
211 build app xdm
212 build app xdpyinfo
213 build app xdriinfo
214 build app xedit
215 build app xev
216 build app xeyes
217 build app xf86dga
218 build app xfd
219 build app xfindproxy
220 build app xfontsel
221 build app xfs
222 build app xfsinfo
223 build app xfwp
224 build app xgamma
225 build app xgc
226 build app xhost
227 build app xinit
228 build app xinput
229 build app xkbcomp
230 build app xkbevd
231 build app xkbprint
232 build app xkbutils
233 build app xkill
234 build app xload
235 build app xlogo
236 build app xlsatoms
237 build app xlsclients
238 build app xlsfonts
239 build app xmag
240 build app xman
241 build app xmessage
242 build app xmh
243 build app xmodmap
244 build app xmore
245 build app xprop
246 build app xrandr
247 build app xrdb
248 build app xrefresh
249 build app xrx
250 build app xset
251 build app xsetmode
252 build app xsetpointer
253 build app xsetroot
254 build app xsm
255 build app xstdcmap
256 build app xtrap
257 build app xvidtune
258 build app xvinfo
259 build app xwd
260 build app xwininfo
261 build app xwud
264 # The server requires at least the following libraries:
265 # Xfont, Xau, Xdmcp
266 build_xserver() {
267 build xserver xorg-server
270 build_driver_input() {
272 HOST_OS=`uname -s`
273 HOST_CPU=`uname -m`
275 # Some drivers are only buildable on some OS'es
276 case $HOST_OS in
277 Linux)
278 build driver xf86-input-aiptek
279 build driver xf86-input-evdev
280 #build driver xf86-input-ur98
284 esac
286 # And some drivers are only buildable on some CPUs.
287 case $HOST_CPU in
288 i*86* | amd64* | x86*64*)
289 build driver xf86-input-vmmouse
293 esac
295 build driver xf86-input-acecad
296 #build driver xf86-input-calcomp
297 #build driver xf86-input-citron
298 #build driver xf86-input-digitaledge
299 #build driver xf86-input-dmc
300 #build driver xf86-input-dynapro
301 #build driver xf86-input-elo2300
302 #build driver xf86-input-elographics
303 #build driver xf86-input-fpit
304 #build driver xf86-input-hyperpen
305 #build driver xf86-input-jamstudio
306 build driver xf86-input-joystick
307 build driver xf86-input-keyboard
308 #build driver xf86-input-magellan
309 #build driver xf86-input-magictouch
310 #build driver xf86-input-microtouch
311 build driver xf86-input-mouse
312 #build driver xf86-input-mutouch
313 #build driver xf86-input-palmax
314 #build driver xf86-input-penmount
315 #build driver xf86-input-spaceorb
316 #build driver xf86-input-summa
317 #build driver xf86-input-tek4957
318 build driver xf86-input-void
321 build_driver_video() {
323 HOST_OS=`uname -s`
325 # Some drivers are only buildable on some OS'es
326 case $HOST_OS in
327 *BSD* | *bsd*)
328 build driver xf86-video-wsfb
329 build driver xf86-video-sunffb
331 *Linux*)
332 build driver xf86-video-sisusb
333 build driver xf86-video-sunffb
334 build driver xf86-video-v4l
338 esac
340 build driver xf86-video-apm
341 build driver xf86-video-ark
342 build driver xf86-video-ati
343 build driver xf86-video-chips
344 build driver xf86-video-cirrus
345 build driver xf86-video-cyrix
346 build driver xf86-video-dummy
347 build driver xf86-video-fbdev
348 build driver xf86-video-glide
349 build driver xf86-video-glint
350 build driver xf86-video-i128
351 build driver xf86-video-i740
352 build driver xf86-video-i810
353 build driver xf86-video-imstt
354 build driver xf86-video-mga
355 build driver xf86-video-neomagic
356 build driver xf86-video-newport
357 build driver xf86-video-nsc
358 build driver xf86-video-nv
359 build driver xf86-video-rendition
360 build driver xf86-video-s3
361 build driver xf86-video-s3virge
362 build driver xf86-video-savage
363 build driver xf86-video-siliconmotion
364 build driver xf86-video-sis
365 build driver xf86-video-sunbw2
366 build driver xf86-video-suncg14
367 build driver xf86-video-suncg3
368 build driver xf86-video-suncg6
369 build driver xf86-video-sunleo
370 build driver xf86-video-suntcx
371 build driver xf86-video-tdfx
372 build driver xf86-video-tga
373 build driver xf86-video-trident
374 build driver xf86-video-tseng
375 build driver xf86-video-vesa
376 build driver xf86-video-vga
377 build driver xf86-video-via
378 build driver xf86-video-vmware
379 build driver xf86-video-voodoo
382 # The server must be built before the drivers
383 build_driver() {
384 build_driver_input
385 build_driver_video
388 # All fonts require mkfontscale and mkfontdir to be available
390 # The following fonts require bdftopcf to be available:
391 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
392 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
393 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
394 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
395 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
396 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
397 # winitzki-cyrillic
399 # Within the font module, the util component must be built before the
400 # following fonts:
401 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
402 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
403 # misc-misc and schumacher-misc
405 # The alias component is recommended to be installed after the other fonts
406 # since the fonts.alias files reference specific fonts installed from the
407 # other font components
408 build_font() {
409 build font font-util
410 build font encodings
411 build font font-adobe-100dpi
412 build font font-adobe-75dpi
413 build font font-adobe-utopia-100dpi
414 build font font-adobe-utopia-75dpi
415 build font font-adobe-utopia-type1
416 build font font-arabic-misc
417 build font font-bh-100dpi
418 build font font-bh-75dpi
419 build font font-bh-lucidatypewriter-100dpi
420 build font font-bh-lucidatypewriter-75dpi
421 build font font-bh-ttf
422 build font font-bh-type1
423 build font font-bitstream-100dpi
424 build font font-bitstream-75dpi
425 build font font-bitstream-speedo
426 build font font-bitstream-type1
427 build font font-cronyx-cyrillic
428 build font font-cursor-misc
429 build font font-daewoo-misc
430 build font font-dec-misc
431 build font font-ibm-type1
432 build font font-isas-misc
433 build font font-jis-misc
434 build font font-micro-misc
435 build font font-misc-cyrillic
436 build font font-misc-ethiopic
437 build font font-misc-meltho
438 build font font-misc-misc
439 build font font-mutt-misc
440 build font font-schumacher-misc
441 build font font-screen-cyrillic
442 build font font-sony-misc
443 build font font-sun-misc
444 build font font-winitzki-cyrillic
445 build font font-xfree86-type1
446 build font font-alias
449 # makedepend requires xproto
450 build_util() {
451 build util xorg-cf-files
452 build util imake
453 build util makedepend
454 build util gccmakedep
455 build util lndir
458 # xorg-docs requires xorg-sgml-doctools
459 build_doc() {
460 build doc xorg-sgml-doctools
461 build doc xorg-docs
464 usage() {
465 echo "Usage: $0 [options] prefix"
466 echo " where options are:"
467 echo " -d : run make distcheck in addition to others"
468 echo " -D : run make dist in addition to others"
469 echo " -c : run make clean in addition to others"
470 echo " -m path-to-mesa-sources-for-xserver : full path to Mesa sources"
471 echo " -n : do not quit after error; just print error message"
472 echo " -s sudo-command : sudo command to use"
473 echo " -bz2 : use tarballs with bzip2 compression (default)"
474 echo " -gz : use tarballs with gzip compression"
475 echo " -e : build from witin the 'everything' dir instead of module dirs"
478 # Initialize defaults
479 COMPRESSION=bz2
480 USEMODULEDIRS=yes
482 # Process command line args
483 while test $# != 0
485 case $1 in
487 shift
488 SUDO=$1
491 shift
492 MESAPATH=$1
495 NOQUIT=1
498 DISTCHECK=1
501 DIST=1
504 CLEAN=1
506 -bz2)
507 COMPRESSION=bz2
509 -gz)
510 COMPRESSION=gz
513 USEMODULEDIRS=no
516 PREFIX=$1
518 esac
520 shift
521 done
523 if test x"${PREFIX}" = x ; then
524 usage
525 exit
528 # Must create local aclocal dir or aclocal fails
529 ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
530 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
532 # The following is required to make aclocal find our .m4 macros
533 if test x"$ACLOCAL" = x; then
534 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
535 else
536 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
538 export ACLOCAL
540 # The following is required to make pkg-config find our .pc metadata files
541 if test x"$PKG_CONFIG_PATH" = x; then
542 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/share/pkgconfig:${DESTDIR}${PREFIX}/lib/pkgconfig
543 else
544 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/share/pkgconfig:${DESTDIR}${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
546 export PKG_CONFIG_PATH
548 # Set the library path so that locally built libs will be found by apps
549 if test x"$LD_LIBRARY_PATH" = x; then
550 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib
551 else
552 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${LD_LIBRARY_PATH}
554 export LD_LIBRARY_PATH
556 # Set the path so that locally built apps will be found and used
557 if test x"$PATH" = x; then
558 PATH=${DESTDIR}${PREFIX}/bin
559 else
560 PATH=${DESTDIR}${PREFIX}/bin:${PATH}
562 export PATH
564 # Set the default font path for xserver/xorg unless it's already set
565 if test x"$FONTPATH" = x; then
566 FONTPATH="${PREFIX}/lib/X11/fonts/misc/,${PREFIX}/lib/X11/fonts/Type1/,${PREFIX}/lib/X11/fonts/75dpi/,${PREFIX}/lib/X11/fonts/100dpi/,${PREFIX}/lib/X11/fonts/cyrillic/,${PREFIX}/lib/X11/fonts/TTF/"
567 export FONTPATH
570 # Create the log file directory
571 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
573 date
575 # We must install the global macros before anything else
576 build util util-macros
578 build_doc
579 build_proto
580 build_lib
581 build data xbitmaps
582 build_app
583 build_xserver
584 build_driver
585 build_data
586 build_font
587 build_util
589 date