Oops, dropped the 'git push origin' command.
[xorg-util-modular.git] / build.sh
blobdd786ed6af7ed402aff2c06af1e443157c7a607a
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 || failed 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 applewmproto
62 build proto bigreqsproto
63 build proto compositeproto
64 build proto damageproto
65 build proto dmxproto
66 build proto evieproto
67 build proto fixesproto
68 build proto fontcacheproto
69 build proto fontsproto
70 build proto glproto
71 build proto inputproto
72 build proto kbproto
73 build proto pmproto
74 build proto printproto
75 build proto randrproto
76 build proto recordproto
77 build proto renderproto
78 build proto resourceproto
79 build proto scrnsaverproto
80 build proto trapproto
81 build proto videoproto
82 build proto windowswmproto
83 build proto x11proto
84 build proto xcmiscproto
85 build proto xextproto
86 build proto xf86bigfontproto
87 build proto xf86dgaproto
88 build proto xf86driproto
89 build proto xf86miscproto
90 build proto xf86rushproto
91 build proto xf86vidmodeproto
92 build proto xineramaproto
93 if test x"$USE_XCB" != xNO ; then
94 build xcb proto
98 # bitmaps is needed for building apps, so has to be done separately first
99 # cursors depends on apps/xcursorgen
100 # xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
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 libxtrans
126 build lib libXau
127 build lib libXdmcp
128 if test x"$USE_XCB" != xNO ; then
129 build xcb pthread-stubs
130 build xcb libxcb
132 build lib libX11
133 build lib libXext
134 build lib libAppleWM
135 build lib libWindowsWM
136 build lib libdmx
137 build lib libfontenc
138 build lib libFS
139 build lib libICE
140 build lib liblbxutil
141 build lib liboldX
142 build lib libSM
143 build lib libXt
144 build lib libXmu
145 build lib libXpm
146 build lib libXp
147 build lib libXaw
148 build lib libXfixes
149 build lib libXcomposite
150 build lib libXrender
151 build lib libXdamage
152 build lib libXcursor
153 build lib libXevie
154 build lib libXfont
155 build lib libXfontcache
156 build lib libXft
157 build lib libXi
158 build lib libXinerama
159 build lib libxkbfile
160 build lib libxkbui
161 build lib libXprintUtil
162 build lib libXprintAppUtil
163 build lib libXrandr
164 build lib libXRes
165 build lib libXScrnSaver
166 build lib libXTrap
167 build lib libXtst
168 build lib libXv
169 build lib libXvMC
170 build lib libXxf86dga
171 build lib libXxf86misc
172 build lib libXxf86vm
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 demo
279 # fi
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`
342 HOST_CPU=`uname -m`
344 # Some drivers are only buildable on some OS'es
345 case $HOST_OS in
346 *FreeBSD*)
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 # Some drivers are only buildable on some architectures
369 case $HOST_CPU in
370 *sparc*)
371 build driver xf86-video-sunbw2
372 build driver xf86-video-suncg14
373 build driver xf86-video-suncg3
374 build driver xf86-video-suncg6
375 build driver xf86-video-sunleo
376 build driver xf86-video-suntcx
380 esac
382 build driver xf86-video-apm
383 build driver xf86-video-ark
384 build driver xf86-video-ast
385 build driver xf86-video-ati
386 build driver xf86-video-chips
387 build driver xf86-video-cirrus
388 build driver xf86-video-cyrix
389 build driver xf86-video-dummy
390 build driver xf86-video-fbdev
391 # build driver xf86-video-glide
392 build driver xf86-video-glint
393 build driver xf86-video-i128
394 build driver xf86-video-i740
395 build driver xf86-video-intel
396 build driver xf86-video-imstt
397 build driver xf86-video-mga
398 build driver xf86-video-neomagic
399 build driver xf86-video-newport
400 build driver xf86-video-nsc
401 build driver xf86-video-nv
402 build driver xf86-video-rendition
403 build driver xf86-video-s3
404 build driver xf86-video-s3virge
405 build driver xf86-video-savage
406 build driver xf86-video-siliconmotion
407 build driver xf86-video-sis
408 build driver xf86-video-tdfx
409 build driver xf86-video-tga
410 build driver xf86-video-trident
411 build driver xf86-video-tseng
412 build driver xf86-video-vesa
413 build driver xf86-video-vga
414 build driver xf86-video-via
415 build driver xf86-video-vmware
416 build driver xf86-video-voodoo
419 # The server must be built before the drivers
420 build_driver() {
421 build_driver_input
422 build_driver_video
425 # All fonts require mkfontscale and mkfontdir to be available
427 # The following fonts require bdftopcf to be available:
428 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
429 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
430 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
431 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
432 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
433 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
434 # winitzki-cyrillic
436 # Within the font module, the util component must be built before the
437 # following fonts:
438 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
439 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
440 # misc-misc and schumacher-misc
442 # The alias component is recommended to be installed after the other fonts
443 # since the fonts.alias files reference specific fonts installed from the
444 # other font components
445 build_font() {
446 build font util
447 build font encodings
448 build font adobe-100dpi
449 build font adobe-75dpi
450 build font adobe-utopia-100dpi
451 build font adobe-utopia-75dpi
452 build font adobe-utopia-type1
453 build font arabic-misc
454 build font bh-100dpi
455 build font bh-75dpi
456 build font bh-lucidatypewriter-100dpi
457 build font bh-lucidatypewriter-75dpi
458 build font bh-ttf
459 build font bh-type1
460 build font bitstream-100dpi
461 build font bitstream-75dpi
462 build font bitstream-speedo
463 build font bitstream-type1
464 build font cronyx-cyrillic
465 build font cursor-misc
466 build font daewoo-misc
467 build font dec-misc
468 build font ibm-type1
469 build font isas-misc
470 build font jis-misc
471 build font micro-misc
472 build font misc-cyrillic
473 build font misc-ethiopic
474 build font misc-meltho
475 build font misc-misc
476 build font mutt-misc
477 build font schumacher-misc
478 build font screen-cyrillic
479 build font sony-misc
480 build font sun-misc
481 build font winitzki-cyrillic
482 build font xfree86-type1
483 build font alias
486 # makedepend requires xproto
487 build_util() {
488 build util cf
489 build util imake
490 build util makedepend
491 build util gccmakedep
492 build util lndir
495 # xorg-docs requires xorg-sgml-doctools
496 build_doc() {
497 build doc xorg-sgml-doctools
498 build doc xorg-docs
501 usage() {
502 echo "Usage: $0 [options] prefix"
503 echo " where options are:"
504 echo " -d : run make distcheck in addition to others"
505 echo " -D : run make dist in addition to others"
506 echo " -c : run make clean in addition to others"
507 echo " -m path-to-mesa-sources-for-xserver : full path to Mesa sources"
508 echo " -n : do not quit after error; just print error message"
509 echo " -s sudo-command : sudo command to use"
510 echo " -r module/component : resume building with this comonent"
513 # Process command line args
514 while test $# != 0
516 case $1 in
518 shift
519 SUDO=$1
522 shift
523 MESAPATH=$1
526 NOQUIT=1
529 DISTCHECK=1
532 DIST=1
535 CLEAN=1
538 shift
539 RESUME=$1
542 PREFIX=$1
544 esac
546 shift
547 done
549 if test x"${PREFIX}" = x ; then
550 usage
551 exit
554 # Must create local aclocal dir or aclocal fails
555 ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
556 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
558 # The following is required to make aclocal find our .m4 macros
559 if test x"$ACLOCAL" = x; then
560 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
561 else
562 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
564 export ACLOCAL
566 # The following is required to make pkg-config find our .pc metadata files
567 if test x"$PKG_CONFIG_PATH" = x; then
568 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig
569 else
570 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}
572 export PKG_CONFIG_PATH
574 # Set the library path so that locally built libs will be found by apps
575 if test x"$LD_LIBRARY_PATH" = x; then
576 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib
577 else
578 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/lib:${LD_LIBRARY_PATH}
580 export LD_LIBRARY_PATH
582 # Set the path so that locally built apps will be found and used
583 if test x"$PATH" = x; then
584 PATH=${DESTDIR}${PREFIX}/bin
585 else
586 PATH=${DESTDIR}${PREFIX}/bin:${PATH}
588 export PATH
590 # Choose which make program to use
591 if test x"$MAKE" = x; then
592 MAKE=make
595 # Set the default font path for xserver/xorg unless it's already set
596 if test x"$FONTPATH" = x; then
597 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/"
598 export FONTPATH
601 # Create the log file directory
602 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
604 date
606 # We must install the global macros before anything else
607 build util macros
609 build_doc
610 build_proto
611 build_lib
612 build data bitmaps
613 build_app
614 build_xserver
615 build_driver
616 build_data
617 build_font
618 build_util
620 date