CC xorg list in the announce template.
[xorg-util-modular.git] / build.sh
blobe3d556e3cf1b383845e22f04ba5086f1309eefce
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
7 # CONFCFLAGS: flags to pass to all configure scripts in ""
8 # MAKEFLAGS: flags to pass to all make calls
9 # LIBDIR: Path under $prefix for libraries (e.g., lib64)
11 failed_components=""
12 nonexistent_components=""
14 failed() {
15 if test x"$NOQUIT" = x1; then
16 echo "***** $1 failed on $2/$3"
17 failed_components="$failed_components $2/$3"
18 else
19 exit 1
23 checkfortars() {
24 M=$1
25 C=$2
26 case $M in
27 "data")
28 case $C in
29 "cursors") C="xcursor-themes" ;;
30 "bitmaps") C="xbitmaps" ;;
31 esac
33 "font")
34 if [ "$C" != "encodings" ]; then
35 C="font-$C"
38 "lib")
39 case $C in
40 "libXRes") C="libXres" ;;
41 "libxtrans") C="xtrans" ;;
42 esac
44 "pixman")
45 M="lib"
46 C="pixman"
48 "proto")
49 case $C in
50 "evieproto") C="evieext" ;;
51 "x11proto") C="xproto" ;;
52 esac
54 "util")
55 case $C in
56 "cf") C="xorg-cf-files" ;;
57 "macros") C="util-macros" ;;
58 esac
60 "xcb")
61 case $C in
62 "proto") C="xcb-proto" ;;
63 "pthread-stubs") M="lib"; C="libpthread-stubs" ;;
64 "util") C="xcb-util" ;;
65 esac
67 "xserver")
68 C="xorg-server"
70 esac
71 for ii in $M .; do
72 for jj in bz2 gz; do
73 TARFILE=`ls -1rt $ii/$C-*.tar.$jj 2> /dev/null | tail -1`
74 if [ -n "$TARFILE" ]; then
75 SRCDIR=`echo $TARFILE | sed "s,.tar.$jj,,"`
76 if [ ! -d $SRCDIR ]; then
77 TAROPTS=xjf
78 if [ "$jj" = "gz" ]; then
79 TAROPTS=xzf
81 tar $TAROPTS $TARFILE -C $ii || failed tar $1 $2
83 return
85 done
86 done
89 build() {
90 if [ -n "$RESUME" ]; then
91 if [ "$RESUME" = "$1/$2" ]; then
92 unset RESUME
93 # Resume build at this module
94 else
95 echo "Skipping $1 module component $2..."
96 return 0
100 SRCDIR=""
101 CONFCMD=""
102 if [ -f $1/$2/autogen.sh ]; then
103 SRCDIR="$1/$2"
104 CONFCMD="autogen.sh"
105 else
106 checkfortars $1 $2
107 CONFCMD="configure"
110 if [ -z $SRCDIR ]; then
111 echo "$1 module component $2 does not exist, skipping."
112 nonexistent_components="$nonexistent_components $1/$2"
113 return
116 echo "Building $1 module component $2..."
117 old_pwd=`pwd`
118 cd $SRCDIR || failed cd1 $1 $2
120 # Build outside source directory
121 if [ "x$DIR_ARCH" != x ] ; then
122 mkdir -p "$DIR_ARCH" || failed mkdir $1 $2
123 if cd "$DIR_ARCH" ; then :; else
124 failed cd2 $1 $2
125 cd ${old_pwd}
126 return
130 # Special configure flags for certain modules
131 MOD_SPECIFIC=
133 if test "$1" = "xserver" && test -n "$MESAPATH"; then
134 MOD_SPECIFIC="--with-mesa-source=${MESAPATH}"
136 if test "$1" = "lib" && test "$2" = "libX11" && test x"$USE_XCB" = xNO; then
137 MOD_SPECIFIC="--with-xcb=no"
140 LIB_FLAGS=
141 if test x$LIBDIR != x ; then
142 LIB_FLAGS="--libdir=${PREFIX}/${LIBDIR}"
145 # Use "sh autogen.sh" since some scripts are not executable in CVS
146 if test "x$NOAUTOGEN" != x1 ; then
147 sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
148 ${MOD_SPECIFIC} ${QUIET:+--quiet} \
149 ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS" || \
150 failed ${CONFCMD} $1 $2
152 ${MAKE} $MAKEFLAGS || failed make $1 $2
153 if test x"$CLEAN" = x1; then
154 ${MAKE} $MAKEFLAGS clean || failed clean $1 $2
156 if test x"$DIST" = x1; then
157 ${MAKE} $MAKEFLAGS dist || failed dist $1 $2
159 if test x"$DISTCHECK" = x1; then
160 ${MAKE} $MAKEFLAGS distcheck || failed distcheck $1 $2
162 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install || \
163 failed install $1 $2
165 cd ${old_pwd}
168 # protocol headers have no build order dependencies
169 build_proto() {
170 build proto applewmproto
171 build proto bigreqsproto
172 build proto compositeproto
173 build proto damageproto
174 build proto dmxproto
175 build proto dri2proto
176 build proto evieproto
177 build proto fixesproto
178 build proto fontcacheproto
179 build proto fontsproto
180 build proto glproto
181 build proto inputproto
182 build proto kbproto
183 build proto randrproto
184 build proto recordproto
185 build proto renderproto
186 build proto resourceproto
187 build proto scrnsaverproto
188 build proto trapproto
189 build proto videoproto
190 build proto windowswmproto
191 build proto x11proto
192 build proto xcmiscproto
193 build proto xextproto
194 build proto xf86bigfontproto
195 build proto xf86dgaproto
196 build proto xf86driproto
197 build proto xf86miscproto
198 build proto xf86vidmodeproto
199 build proto xineramaproto
200 if test x"$USE_XCB" != xNO ; then
201 build xcb proto
205 # bitmaps is needed for building apps, so has to be done separately first
206 # cursors depends on apps/xcursorgen
207 # xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
208 build_data() {
209 # build data bitmaps
210 build data cursors
211 # build data xkbdata
214 # All protocol modules must be installed before the libs (okay, that's an
215 # overstatement, but all protocol modules should be installed anyway)
217 # the libraries have a dependency order:
218 # xtrans, Xau, Xdmcp before anything else
219 # fontenc before Xfont
220 # ICE before SM
221 # X11 before Xext
222 # (X11 and SM) before Xt
223 # Xt before Xmu and Xpm
224 # Xext before any other extension library
225 # Xfixes before Xcomposite
226 # Xp before XprintUtil before XprintAppUtil
228 # If xcb is being used for libX11, it must be built before libX11, but after
229 # Xau & Xdmcp
231 build_lib() {
232 build lib libxtrans
233 build lib libXau
234 build lib libXdmcp
235 if test x"$USE_XCB" != xNO ; then
236 build xcb pthread-stubs
237 build xcb libxcb
239 build lib libX11
240 build lib libXext
241 build lib libAppleWM
242 build lib libWindowsWM
243 build lib libdmx
244 build lib libfontenc
245 build lib libFS
246 build lib libICE
247 #build lib liblbxutil
248 #build lib liboldX
249 build lib libSM
250 build lib libXt
251 build lib libXmu
252 build lib libXpm
253 build lib libXaw
254 build lib libXfixes
255 build lib libXcomposite
256 build lib libXrender
257 build lib libXdamage
258 build lib libXcursor
259 build lib libXevie
260 build lib libXfont
261 build lib libXfontcache
262 build lib libXft
263 build lib libXi
264 build lib libXinerama
265 build lib libxkbfile
266 build lib libxkbui
267 build lib libXrandr
268 build lib libXRes
269 build lib libXScrnSaver
270 build lib libXTrap
271 build lib libXtst
272 build lib libXv
273 build lib libXvMC
274 build lib libXxf86dga
275 build lib libXxf86misc
276 build lib libXxf86vm
277 build lib libpciaccess
278 build pixman ""
281 # Most apps depend at least on libX11.
283 # bdftopcf depends on libXfont
284 # mkfontscale depends on libfontenc and libfreetype
285 # mkfontdir depends on mkfontscale
287 # TODO: detailed breakdown of which apps require which libs
288 build_app() {
289 build app appres
290 build app bdftopcf
291 build app beforelight
292 build app bitmap
293 build app editres
294 build app fonttosfnt
295 build app fslsfonts
296 build app fstobdf
297 build app iceauth
298 build app ico
299 build app listres
300 build app luit
301 # build app mkcfm
302 build app mkfontdir
303 build app mkfontscale
304 build app oclock
305 # build app pclcomp
306 build app rgb
307 build app rendercheck
308 build app rstart
309 build app scripts
310 build app sessreg
311 build app setxkbmap
312 build app showfont
313 build app smproxy
314 build app twm
315 build app viewres
316 build app x11perf
317 build app xauth
318 build app xbacklight
319 build app xbiff
320 build app xcalc
321 build app xclipboard
322 build app xclock
323 build app xcmsdb
324 build app xconsole
325 build app xcursorgen
326 build app xdbedizzy
327 build app xditview
328 build app xdm
329 build app xdpyinfo
330 build app xdriinfo
331 build app xedit
332 build app xev
333 build app xeyes
334 build app xf86dga
335 build app xfindproxy
336 build app xfd
337 build app xfontsel
338 build app xfs
339 build app xfsinfo
340 build app xfwp
341 build app xgamma
342 build app xgc
343 build app xhost
344 build app xinit
345 build app xinput
346 build app xkbcomp
347 build app xkbevd
348 build app xkbprint
349 build app xkbutils
350 build app xkill
351 build app xload
352 build app xlogo
353 build app xlsatoms
354 build app xlsclients
355 build app xlsfonts
356 build app xmag
357 build app xman
358 build app xmessage
359 build app xmh
360 build app xmodmap
361 build app xmore
362 build app xphelloworld
363 build app xplsprinters
364 build app xpr
365 build app xprehashprinterlist
366 build app xprop
367 build app xrandr
368 build app xrdb
369 build app xrefresh
370 build app xrx
371 build app xset
372 build app xsetmode
373 build app xsetpointer
374 build app xsetroot
375 build app xsm
376 build app xstdcmap
377 build app xtrap
378 build app xvidtune
379 build app xvinfo
380 build app xwd
381 build app xwininfo
382 build app xwud
383 # if test x"$USE_XCB" != xNO ; then
384 # build xcb demo
385 # fi
388 build_mesa() {
389 build mesa drm
390 #build mesa mesa
393 # The server requires at least the following libraries:
394 # Xfont, Xau, Xdmcp, pciaccess
395 build_xserver() {
396 build xserver ""
399 build_driver_input() {
400 # Some drivers are only buildable on some OS'es
401 case $HOST_OS in
402 Linux)
403 build driver xf86-input-aiptek
404 build driver xf86-input-evdev
405 #build driver xf86-input-ur98
409 esac
411 # And some drivers are only buildable on some CPUs.
412 case $HOST_CPU in
413 i*86* | amd64* | x86*64*)
414 build driver xf86-input-vmmouse
418 esac
420 build driver xf86-input-acecad
421 #build driver xf86-input-calcomp
422 #build driver xf86-input-citron
423 #build driver xf86-input-digitaledge
424 #build driver xf86-input-dmc
425 #build driver xf86-input-dynapro
426 #build driver xf86-input-elo2300
427 #build driver xf86-input-elographics
428 #build driver xf86-input-fpit
429 #build driver xf86-input-hyperpen
430 #build driver xf86-input-jamstudio
431 build driver xf86-input-joystick
432 build driver xf86-input-keyboard
433 #build driver xf86-input-magellan
434 #build driver xf86-input-magictouch
435 #build driver xf86-input-microtouch
436 build driver xf86-input-mouse
437 #build driver xf86-input-mutouch
438 #build driver xf86-input-palmax
439 #build driver xf86-input-penmount
440 #build driver xf86-input-spaceorb
441 #build driver xf86-input-summa
442 build driver xf86-input-synaptics
443 #build driver xf86-input-tek4957
444 build driver xf86-input-void
447 build_driver_video() {
448 # Some drivers are only buildable on some OS'es
449 case $HOST_OS in
450 *FreeBSD*)
451 case $HOST_CPU in
452 sparc64)
453 build driver xf86-video-sunffb
457 esac
459 *NetBSD* | *OpenBSD*)
460 build driver xf86-video-wsfb
461 build driver xf86-video-sunffb
463 *Linux*)
464 build driver xf86-video-sisusb
465 build driver xf86-video-sunffb
466 build driver xf86-video-v4l
470 esac
472 # Some drivers are only buildable on some architectures
473 case $HOST_CPU in
474 *sparc*)
475 build driver xf86-video-sunbw2
476 build driver xf86-video-suncg14
477 build driver xf86-video-suncg3
478 build driver xf86-video-suncg6
479 build driver xf86-video-sunleo
480 build driver xf86-video-suntcx
482 i*86* | amd64* | x86*64*)
483 build driver xf86-video-i740
484 build driver xf86-video-intel
485 build driver xf86-video-via
489 esac
491 build driver xf86-video-apm
492 build driver xf86-video-ark
493 build driver xf86-video-ast
494 build driver xf86-video-ati
495 build driver xf86-video-avivo
496 build driver xf86-video-chips
497 build driver xf86-video-cirrus
498 build driver xf86-video-dummy
499 build driver xf86-video-fbdev
500 build driver xf86-video-geode
501 # build driver xf86-video-glide
502 build driver xf86-video-glint
503 build driver xf86-video-i128
504 build driver xf86-video-imstt
505 build driver xf86-video-mga
506 build driver xf86-video-neomagic
507 build driver xf86-video-newport
508 build driver xf86-video-nouveau
509 build driver xf86-video-nv
510 build driver xf86-video-radeonhd
511 build driver xf86-video-rendition
512 build driver xf86-video-s3
513 build driver xf86-video-s3virge
514 build driver xf86-video-savage
515 build driver xf86-video-siliconmotion
516 build driver xf86-video-sis
517 build driver xf86-video-tdfx
518 build driver xf86-video-tga
519 build driver xf86-video-trident
520 build driver xf86-video-tseng
521 build driver xf86-video-vesa
522 build driver xf86-video-vmware
523 build driver xf86-video-voodoo
524 build driver xf86-video-xgi
525 build driver xf86-video-xgixp
528 # The server must be built before the drivers
529 build_driver() {
530 build_driver_input
531 build_driver_video
534 # All fonts require mkfontscale and mkfontdir to be available
536 # The following fonts require bdftopcf to be available:
537 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
538 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
539 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
540 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
541 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
542 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
543 # winitzki-cyrillic
545 # Within the font module, the util component must be built before the
546 # following fonts:
547 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
548 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
549 # misc-misc and schumacher-misc
551 # The alias component is recommended to be installed after the other fonts
552 # since the fonts.alias files reference specific fonts installed from the
553 # other font components
554 build_font() {
555 build font util
556 build font encodings
557 build font adobe-100dpi
558 build font adobe-75dpi
559 build font adobe-utopia-100dpi
560 build font adobe-utopia-75dpi
561 build font adobe-utopia-type1
562 build font arabic-misc
563 build font bh-100dpi
564 build font bh-75dpi
565 build font bh-lucidatypewriter-100dpi
566 build font bh-lucidatypewriter-75dpi
567 build font bh-ttf
568 build font bh-type1
569 build font bitstream-100dpi
570 build font bitstream-75dpi
571 build font bitstream-speedo
572 build font bitstream-type1
573 build font cronyx-cyrillic
574 build font cursor-misc
575 build font daewoo-misc
576 build font dec-misc
577 build font ibm-type1
578 build font isas-misc
579 build font jis-misc
580 build font micro-misc
581 build font misc-cyrillic
582 build font misc-ethiopic
583 build font misc-meltho
584 build font misc-misc
585 build font mutt-misc
586 build font schumacher-misc
587 build font screen-cyrillic
588 build font sony-misc
589 build font sun-misc
590 build font winitzki-cyrillic
591 build font xfree86-type1
592 build font alias
595 # makedepend requires xproto
596 build_util() {
597 build util cf
598 build util imake
599 build util makedepend
600 build util gccmakedep
601 build util lndir
602 if test x"$USE_XCB" != xNO ; then
603 build xcb util
607 # xorg-docs requires xorg-sgml-doctools
608 build_doc() {
609 build doc xorg-sgml-doctools
610 build doc xorg-docs
613 usage() {
614 echo "Usage: $0 [options] prefix"
615 echo " where options are:"
616 echo " -a : do NOT run auto config tools (autogen.sh, configure)"
617 echo " -b : use .build.$HAVE_ARCH build directory"
618 echo " -c : run make clean in addition to others"
619 echo " -d : run make distcheck in addition to others"
620 echo " -D : run make dist in addition to others"
621 echo " -g : build with debug information"
622 echo " -m path-to-mesa-sources-for-xserver : full path to Mesa sources"
623 echo " -n : do not quit after error; just print error message"
624 echo " -r module/component : resume building with this comonent"
625 echo " -s sudo-command : sudo command to use"
628 HAVE_ARCH="`uname -i`"
629 DIR_ARCH=""
630 DIR_CONFIG="."
632 # Process command line args
633 while test $# != 0
635 case $1 in
637 NOAUTOGEN=1
640 DIR_ARCH=".build.$HAVE_ARCH"
641 DIR_CONFIG=".."
644 CLEAN=1
647 DISTCHECK=1
650 DIST=1
653 CFLAGS="-g3 -O0"
654 export CFLAGS
655 CONFCFLAGS="CFLAGS=-g3 -O0"
658 shift
659 MESAPATH=$1
662 NOQUIT=1
665 shift
666 RESUME=$1
669 shift
670 SUDO=$1
673 PREFIX=$1
675 esac
677 shift
678 done
680 if test x"${PREFIX}" = x ; then
681 usage
682 exit
685 HOST_OS=`uname -s`
686 HOST_CPU=`uname -m`
688 if test x$LIBDIR = x ; then
689 LIBDIR=lib
692 export HOST_OS
693 export HOST_CPU
694 export LIBDIR
696 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
698 # Must create local aclocal dir or aclocal fails
699 ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
700 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
702 # The following is required to make aclocal find our .m4 macros
703 if test x"$ACLOCAL" = x; then
704 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
705 else
706 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
708 export ACLOCAL
710 # The following is required to make pkg-config find our .pc metadata files
711 if test x"$PKG_CONFIG_PATH" = x; then
712 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/${LIBDIR}/pkgconfig
713 else
714 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/${LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}
716 export PKG_CONFIG_PATH
718 # Set the library path so that locally built libs will be found by apps
719 if test x"$LD_LIBRARY_PATH" = x; then
720 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/${LIBDIR}
721 else
722 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/${LIBDIR}:${LD_LIBRARY_PATH}
724 export LD_LIBRARY_PATH
726 # Set the path so that locally built apps will be found and used
727 if test x"$PATH" = x; then
728 PATH=${DESTDIR}${PREFIX}/bin
729 else
730 PATH=${DESTDIR}${PREFIX}/bin:${PATH}
732 export PATH
734 # Choose which make program to use
735 if test x"$MAKE" = x; then
736 MAKE=make
739 # Set the default font path for xserver/xorg unless it's already set
740 if test x"$FONTPATH" = x; then
741 FONTPATH="${PREFIX}/${LIBDIR}/X11/fonts/misc/,${PREFIX}/${LIBDIR}/X11/fonts/Type1/,${PREFIX}/${LIBDIR}/X11/fonts/75dpi/,${PREFIX}/${LIBDIR}/X11/fonts/100dpi/,${PREFIX}/${LIBDIR}/X11/fonts/cyrillic/,${PREFIX}/${LIBDIR}/X11/fonts/TTF/"
742 export FONTPATH
745 # Create the log file directory
746 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
748 date
750 # We must install the global macros before anything else
751 build util macros
753 build_doc
754 build_proto
755 build_lib
756 build data bitmaps
757 build_app
758 build_mesa
759 build_xserver
760 build_driver
761 build_data
762 build_font
763 build_util
765 date
767 if test "x$nonexistent_components" != x ; then
768 echo ""
769 echo "***** Skipped components (not available) *****"
770 echo "$nonexistent_components"
771 echo ""
774 if test "x$failed_components" != x ; then
775 echo ""
776 echo "***** Failed components *****"
777 echo "$failed_components"
778 echo ""