Use `` instead of $() for compatibility with classic /bin/sh
[xorg-util-modular.git] / build.sh
blobb49a932a539dbd0e62e85aabf94b63a66e3b8fe5
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 if [ -n "$RESUME" ]; then
18 if [ "$RESUME" = "$1/$2" ]; then
19 unset RESUME
20 # Resume build at this module
21 else
22 echo "Skipping $1 module component $2..."
23 return 0
26 echo "Building $1 module component $2..."
27 old_pwd=`pwd`
28 cd $1/$2
30 # Special configure flags for certain modules
31 MOD_SPECIFIC=
33 if test "$1" = "xserver" && test -n "$MESAPATH"; then
34 MOD_SPECIFIC="--with-mesa-source=${MESAPATH}"
36 if test "$1" = "lib" && test "$2" = "libX11" && test x"$USE_XCB" = xNO; then
37 MOD_SPECIFIC="--with-xcb=no"
40 # Use "sh autogen.sh" since some scripts are not executable in CVS
41 sh autogen.sh --prefix=${PREFIX} ${MOD_SPECIFIC} ${QUIET:+--quiet} \
42 ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} || failed autogen $1 $2
43 ${MAKE} || failed make $1 $2
44 if test x"$CLEAN" = x1; then
45 ${MAKE} clean || failed clean $1 $2
47 if test x"$DIST" = x1; then
48 ${MAKE} dist || failed dist $1 $2
50 if test x"$DISTCHECK" = x1; then
51 ${MAKE} distcheck || failed distcheck $1 $2
53 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} install || \
54 failed install $1 $2
56 cd ${old_pwd}
59 # protocol headers have no build order dependencies
60 build_proto() {
61 build proto AppleWM
62 build proto BigReqs
63 build proto Composite
64 build proto Damage
65 build proto DMX
66 build proto EvIE
67 build proto Fixes
68 build proto Fontcache
69 build proto Fonts
70 build proto GL
71 build proto Input
72 build proto KB
73 build proto PM
74 build proto Print
75 build proto Randr
76 build proto Record
77 build proto Render
78 build proto Resource
79 build proto ScrnSaver
80 build proto Trap
81 build proto Video
82 build proto WindowsWM
83 build proto X11
84 build proto XCMisc
85 build proto XExt
86 build proto XF86BigFont
87 build proto XF86DGA
88 build proto XF86DRI
89 build proto XF86Misc
90 build proto XF86Rush
91 build proto XF86VidMode
92 build proto Xinerama
93 if test x"$USE_XCB" != xNO ; then
94 build xcb xcb-proto
98 # bitmaps is needed for building apps, so has to be done separately first
99 # cursors depends on apps/xcursorgen
100 # xkbdata depends on apps/xkbcomp
101 build_data() {
102 # build data bitmaps
103 build data cursors
104 build data xkbdata
107 # All protocol modules must be installed before the libs (okay, that's an
108 # overstatement, but all protocol modules should be installed anyway)
110 # the libraries have a dependency order:
111 # xtrans, Xau, Xdmcp before anything else
112 # fontenc before Xfont
113 # ICE before SM
114 # X11 before Xext
115 # (X11 and SM) before Xt
116 # Xt before Xmu and Xpm
117 # Xext before any other extension library
118 # Xfixes before Xcomposite
119 # Xp before XprintUtil before XprintAppUtil
121 # If xcb is being used for libX11, it must be built before libX11, but after
122 # Xau & Xdmcp
124 build_lib() {
125 build lib xtrans
126 build lib Xau
127 build lib Xdmcp
128 if test x"$USE_XCB" != xNO ; then
129 build xcb xcb
130 build xcb xcb-util
132 build lib libX11
133 build lib Xext
134 build lib AppleWM
135 build lib WindowsWM
136 build lib dmx
137 build lib fontenc
138 build lib FS
139 build lib ICE
140 build lib lbxutil
141 build lib oldX
142 build lib SM
143 build lib Xt
144 build lib Xmu
145 build lib Xpm
146 build lib Xp
147 build lib Xaw
148 build lib Xfixes
149 build lib Xcomposite
150 build lib Xrender
151 build lib Xdamage
152 build lib Xcursor
153 build lib Xevie
154 build lib Xfont
155 build lib Xfontcache
156 build lib Xft
157 build lib Xi
158 build lib Xinerama
159 build lib xkbfile
160 build lib xkbui
161 build lib XprintUtil
162 build lib XprintAppUtil
163 build lib Xrandr
164 build lib XRes
165 build lib XScrnSaver
166 build lib XTrap
167 build lib Xtst
168 build lib Xv
169 build lib XvMC
170 build lib Xxf86dga
171 build lib Xxf86misc
172 build lib Xxf86vm
175 # Most apps depend at least on libX11.
177 # bdftopcf depends on libXfont
178 # mkfontscale depends on libfontenc and libfreetype
179 # mkfontdir depends on mkfontscale
181 # TODO: detailed breakdown of which apps require which libs
182 build_app() {
183 build app appres
184 build app bdftopcf
185 build app beforelight
186 build app bitmap
187 build app editres
188 build app fonttosfnt
189 build app fslsfonts
190 build app fstobdf
191 build app iceauth
192 build app ico
193 build app lbxproxy
194 build app listres
195 build app luit
196 build app mkcfm
197 build app mkfontdir
198 build app mkfontscale
199 build app oclock
200 # build app pclcomp
201 build app proxymngr
202 build app rgb
203 build app rendercheck
204 build app rstart
205 build app scripts
206 build app sessreg
207 build app setxkbmap
208 build app showfont
209 build app smproxy
210 build app twm
211 build app viewres
212 build app x11perf
213 build app xauth
214 build app xbiff
215 build app xcalc
216 build app xclipboard
217 build app xclock
218 build app xcmsdb
219 build app xconsole
220 build app xcursorgen
221 build app xdbedizzy
222 build app xditview
223 build app xdm
224 build app xdpyinfo
225 build app xdriinfo
226 build app xedit
227 build app xev
228 build app xeyes
229 build app xf86dga
230 build app xfindproxy
231 build app xfd
232 build app xfontsel
233 build app xfs
234 build app xfsinfo
235 build app xfwp
236 build app xgamma
237 build app xgc
238 build app xhost
239 build app xinit
240 build app xkbcomp
241 build app xkbevd
242 build app xkbprint
243 build app xkbutils
244 build app xkill
245 build app xload
246 build app xlogo
247 build app xlsatoms
248 build app xlsclients
249 build app xlsfonts
250 build app xmag
251 build app xman
252 build app xmessage
253 build app xmh
254 build app xmodmap
255 build app xmore
256 build app xphelloworld
257 build app xplsprinters
258 build app xpr
259 build app xprehashprinterlist
260 build app xprop
261 build app xrandr
262 build app xrdb
263 build app xrefresh
264 build app xrx
265 build app xset
266 build app xsetmode
267 build app xsetpointer
268 build app xsetroot
269 build app xsm
270 build app xstdcmap
271 build app xtrap
272 build app xvidtune
273 build app xvinfo
274 build app xwd
275 build app xwininfo
276 build app xwud
277 if test x"$USE_XCB" != xNO ; then
278 build xcb xcb-demo
282 # The server requires at least the following libraries:
283 # Xfont, Xau, Xdmcp
284 build_xserver() {
285 build xserver ""
288 build_driver_input() {
290 HOST_OS=`uname -s`
291 HOST_CPU=`uname -m`
293 # Some drivers are only buildable on some OS'es
294 case $HOST_OS in
295 Linux)
296 build driver xf86-input-aiptek
297 build driver xf86-input-evdev
298 build driver xf86-input-ur98
302 esac
304 # And some drivers are only buildable on some CPUs.
305 case $HOST_CPU in
306 i*86* | amd64* | x86*64*)
307 build driver xf86-input-vmmouse
311 esac
313 build driver xf86-input-acecad
314 build driver xf86-input-calcomp
315 build driver xf86-input-citron
316 build driver xf86-input-digitaledge
317 build driver xf86-input-dmc
318 build driver xf86-input-dynapro
319 build driver xf86-input-elo2300
320 build driver xf86-input-elographics
321 build driver xf86-input-fpit
322 build driver xf86-input-hyperpen
323 build driver xf86-input-jamstudio
324 build driver xf86-input-joystick
325 build driver xf86-input-keyboard
326 build driver xf86-input-magellan
327 build driver xf86-input-magictouch
328 build driver xf86-input-microtouch
329 build driver xf86-input-mouse
330 build driver xf86-input-mutouch
331 build driver xf86-input-palmax
332 build driver xf86-input-penmount
333 build driver xf86-input-spaceorb
334 build driver xf86-input-summa
335 build driver xf86-input-tek4957
336 build driver xf86-input-void
339 build_driver_video() {
341 HOST_OS=`uname -s`
343 # Some drivers are only buildable on some OS'es
344 case $HOST_OS in
345 *FreeBSD*)
346 HOST_CPU=`uname -m`
347 case $HOST_CPU in
348 sparc64)
349 build driver xf86-video-sunffb
353 esac
355 *NetBSD* | *OpenBSD*)
356 build driver xf86-video-wsfb
357 build driver xf86-video-sunffb
359 *Linux*)
360 build driver xf86-video-sisusb
361 build driver xf86-video-sunffb
362 build driver xf86-video-v4l
366 esac
368 build driver xf86-video-apm
369 build driver xf86-video-ark
370 build driver xf86-video-ast
371 build driver xf86-video-ati
372 build driver xf86-video-chips
373 build driver xf86-video-cirrus
374 build driver xf86-video-cyrix
375 build driver xf86-video-dummy
376 build driver xf86-video-fbdev
377 # build driver xf86-video-glide
378 build driver xf86-video-glint
379 build driver xf86-video-i128
380 build driver xf86-video-i740
381 build driver xf86-video-intel
382 build driver xf86-video-imstt
383 build driver xf86-video-mga
384 build driver xf86-video-neomagic
385 build driver xf86-video-newport
386 build driver xf86-video-nsc
387 build driver xf86-video-nv
388 build driver xf86-video-rendition
389 build driver xf86-video-s3
390 build driver xf86-video-s3virge
391 build driver xf86-video-savage
392 build driver xf86-video-siliconmotion
393 build driver xf86-video-sis
394 build driver xf86-video-sunbw2
395 build driver xf86-video-suncg14
396 build driver xf86-video-suncg3
397 build driver xf86-video-suncg6
398 build driver xf86-video-sunleo
399 build driver xf86-video-suntcx
400 build driver xf86-video-tdfx
401 build driver xf86-video-tga
402 build driver xf86-video-trident
403 build driver xf86-video-tseng
404 build driver xf86-video-vesa
405 build driver xf86-video-vga
406 build driver xf86-video-via
407 build driver xf86-video-vmware
408 build driver xf86-video-voodoo
411 # The server must be built before the drivers
412 build_driver() {
413 build_driver_input
414 build_driver_video
417 # All fonts require mkfontscale and mkfontdir to be available
419 # The following fonts require bdftopcf to be available:
420 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
421 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
422 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
423 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
424 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
425 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
426 # winitzki-cyrillic
428 # Within the font module, the util component must be built before the
429 # following fonts:
430 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
431 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
432 # misc-misc and schumacher-misc
434 # The alias component is recommended to be installed after the other fonts
435 # since the fonts.alias files reference specific fonts installed from the
436 # other font components
437 build_font() {
438 build font util
439 build font encodings
440 build font adobe-100dpi
441 build font adobe-75dpi
442 build font adobe-utopia-100dpi
443 build font adobe-utopia-75dpi
444 build font adobe-utopia-type1
445 build font arabic-misc
446 build font bh-100dpi
447 build font bh-75dpi
448 build font bh-lucidatypewriter-100dpi
449 build font bh-lucidatypewriter-75dpi
450 build font bh-ttf
451 build font bh-type1
452 build font bitstream-100dpi
453 build font bitstream-75dpi
454 build font bitstream-speedo
455 build font bitstream-type1
456 build font cronyx-cyrillic
457 build font cursor-misc
458 build font daewoo-misc
459 build font dec-misc
460 build font ibm-type1
461 build font isas-misc
462 build font jis-misc
463 build font micro-misc
464 build font misc-cyrillic
465 build font misc-ethiopic
466 build font misc-meltho
467 build font misc-misc
468 build font mutt-misc
469 build font schumacher-misc
470 build font screen-cyrillic
471 build font sony-misc
472 build font sun-misc
473 build font winitzki-cyrillic
474 build font xfree86-type1
475 build font alias
478 # makedepend requires xproto
479 build_util() {
480 build util cf
481 build util imake
482 build util makedepend
483 build util gccmakedep
484 build util lndir
487 # xorg-docs requires xorg-sgml-doctools
488 build_doc() {
489 build doc xorg-sgml-doctools
490 build doc xorg-docs
493 usage() {
494 echo "Usage: $0 [options] prefix"
495 echo " where options are:"
496 echo " -d : run make distcheck in addition to others"
497 echo " -D : run make dist in addition to others"
498 echo " -c : run make clean in addition to others"
499 echo " -m path-to-mesa-sources-for-xserver : full path to Mesa sources"
500 echo " -n : do not quit after error; just print error message"
501 echo " -s sudo-command : sudo command to use"
504 # Process command line args
505 while test $# != 0
507 case $1 in
509 shift
510 SUDO=$1
513 shift
514 MESAPATH=$1
517 NOQUIT=1
520 DISTCHECK=1
523 DIST=1
526 CLEAN=1
529 shift
530 RESUME=$1
533 PREFIX=$1
535 esac
537 shift
538 done
540 if test x"${PREFIX}" = x ; then
541 usage
542 exit
545 # Must create local aclocal dir or aclocal fails
546 ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
547 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
549 # The following is required to make aclocal find our .m4 macros
550 if test x"$ACLOCAL" = x; then
551 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
552 else
553 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
555 export ACLOCAL
557 # The following is required to make pkg-config find our .pc metadata files
558 if test x"$PKG_CONFIG_PATH" = x; then
559 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig
560 else
561 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
563 export PKG_CONFIG_PATH
565 # Set the library path so that locally built libs will be found by apps
566 if test x"$LD_LIBRARY_PATH" = x; then
567 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib
568 else
569 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${LD_LIBRARY_PATH}
571 export LD_LIBRARY_PATH
573 # Set the path so that locally built apps will be found and used
574 if test x"$PATH" = x; then
575 PATH=${DESTDIR}${PREFIX}/bin
576 else
577 PATH=${DESTDIR}${PREFIX}/bin:${PATH}
579 export PATH
581 # Choose which make program to use
582 if test x"$MAKE" = x; then
583 MAKE=make
586 # Set the default font path for xserver/xorg unless it's already set
587 if test x"$FONTPATH" = x; then
588 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/"
589 export FONTPATH
592 # Create the log file directory
593 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
595 date
597 # We must install the global macros before anything else
598 build util macros
600 build_doc
601 build_proto
602 build_lib
603 build data bitmaps
604 build_app
605 build_xserver
606 build_driver
607 build_data
608 build_font
609 build_util
611 date