build.sh: Disable xf86-video-imstt. Unmaintained, broken.
[xorg-util-modular.git] / build.sh
blob1c0b7af347572a75aca3dafe6d810d63b34ffb9a
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)
10 # GITROOT: Path to freedesktop.org git root (default: git://anongit.freedesktop.org/git). Only needed for --clone
12 failed_components=""
13 nonexistent_components=""
14 clonefailed_components=""
16 failed() {
17 if test x"$NOQUIT" = x1; then
18 echo "***** $1 failed on $2/$3"
19 failed_components="$failed_components $2/$3"
20 else
21 exit 1
25 checkfortars() {
26 M=$1
27 C=$2
28 case $M in
29 "data")
30 case $C in
31 "cursors") C="xcursor-themes" ;;
32 "bitmaps") C="xbitmaps" ;;
33 esac
35 "font")
36 if [ "$C" != "encodings" ]; then
37 C="font-$C"
40 "lib")
41 case $C in
42 "libXRes") C="libXres" ;;
43 "libxtrans") C="xtrans" ;;
44 esac
46 "pixman")
47 M="lib"
48 C="pixman"
50 "proto")
51 case $C in
52 "evieproto") C="evieext" ;;
53 "x11proto") C="xproto" ;;
54 esac
56 "util")
57 case $C in
58 "cf") C="xorg-cf-files" ;;
59 "macros") C="util-macros" ;;
60 esac
62 "xcb")
63 case $C in
64 "proto") C="xcb-proto" ;;
65 "pthread-stubs") M="lib"; C="libpthread-stubs" ;;
66 "util") C="xcb-util" ;;
67 esac
69 "xserver")
70 C="xorg-server"
72 esac
73 for ii in $M .; do
74 for jj in bz2 gz; do
75 TARFILE=`ls -1rt $ii/$C-*.tar.$jj 2> /dev/null | tail -n 1`
76 if [ -n "$TARFILE" ]; then
77 SRCDIR=`echo $TARFILE | sed "s,.tar.$jj,,"`
78 if [ ! -d $SRCDIR ]; then
79 TAROPTS=xjf
80 if [ "$jj" = "gz" ]; then
81 TAROPTS=xzf
83 tar $TAROPTS $TARFILE -C $ii || failed tar $1 $2
85 return
87 done
88 done
91 clone() {
92 case $1 in
93 "pixman")
94 BASEDIR=""
96 "xcb")
97 BASEDIR=""
99 "mesa")
100 BASEDIR=""
102 "xkeyboard-config")
103 BASEDIR=""
106 BASEDIR="xorg/"
108 esac
110 DIR="$1/$2"
112 if ! test -d "$DIR"; then
113 mkdir -p "$DIR"
116 if test -z "$GITROOT"; then
117 GITROOT="git://anongit.freedesktop.org/git"
120 git clone "$GITROOT/$BASEDIR$DIR" "$DIR"
122 if test "$?" -ne 0 && ! test -d "$DIR"; then
123 return 1
126 return 0
129 build() {
130 if [ -n "$RESUME" ]; then
131 if [ "$RESUME" = "$1/$2" ]; then
132 unset RESUME
133 # Resume build at this module
134 else
135 echo "Skipping $1 module component $2..."
136 return 0
140 SRCDIR=""
141 CONFCMD=""
142 if [ -f $1/$2/autogen.sh ]; then
143 SRCDIR="$1/$2"
144 CONFCMD="autogen.sh"
145 elif [ "x$CLONE" != "x" ]; then
146 clone $1 $2
147 if [ $? -ne 0 ]; then
148 echo "Failed to clone $1 component $2. Ignoring."
149 clonefailed_components="$clonefailed_components $1/$2"
150 if test x"$BUILD_ONE" = x1; then
151 exit 1
153 return
155 SRCDIR="$1/$2"
156 CONFCMD="autogen.sh"
157 else
158 checkfortars $1 $2
159 CONFCMD="configure"
162 if [ -z $SRCDIR ]; then
163 echo "$1 module component $2 does not exist, skipping."
164 nonexistent_components="$nonexistent_components $1/$2"
165 return
168 echo "Building $1 module component $2..."
170 if test x"$BUILT_MODULES_FILE" != "x"; then
171 echo "$1/$2" >> $BUILT_MODULES_FILE
174 old_pwd=`pwd`
175 cd $SRCDIR || failed cd1 $1 $2
177 if test x"$PULL" = x1; then
178 git pull --rebase || failed "git pull" $1 $2
181 # Build outside source directory
182 if [ "x$DIR_ARCH" != x ] ; then
183 mkdir -p "$DIR_ARCH" || failed mkdir $1 $2
184 if cd "$DIR_ARCH" ; then :; else
185 failed cd2 $1 $2
186 cd ${old_pwd}
187 return
191 # Special configure flags for certain modules
192 MOD_SPECIFIC=
194 if test "$1" = "lib" && test "$2" = "libX11" && test x"$USE_XCB" = xNO; then
195 MOD_SPECIFIC="--with-xcb=no"
198 LIB_FLAGS=
199 if test x$LIBDIR != x ; then
200 LIB_FLAGS="--libdir=${PREFIX}/${LIBDIR}"
203 # Use "sh autogen.sh" since some scripts are not executable in CVS
204 if test "x$NOAUTOGEN" != x1 ; then
205 sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
206 ${MOD_SPECIFIC} ${QUIET:+--quiet} \
207 ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS" || \
208 failed ${CONFCMD} $1 $2
210 ${MAKE} $MAKEFLAGS || failed make $1 $2
211 if test x"$CLEAN" = x1; then
212 ${MAKE} $MAKEFLAGS clean || failed clean $1 $2
214 if test x"$DIST" = x1; then
215 ${MAKE} $MAKEFLAGS dist || failed dist $1 $2
217 if test x"$DISTCHECK" = x1; then
218 ${MAKE} $MAKEFLAGS distcheck || failed distcheck $1 $2
220 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install || \
221 failed install $1 $2
223 cd ${old_pwd}
225 if test x"$BUILD_ONE" = x1; then
226 echo "Single-component build complete"
227 exit 0
231 # protocol headers have no build order dependencies
232 build_proto() {
233 case $HOST_OS in
234 Darwin*)
235 build proto applewmproto
237 CYGWIN*)
238 build proto windowswmproto
242 esac
243 build proto bigreqsproto
244 build proto compositeproto
245 build proto damageproto
246 build proto dmxproto
247 build proto dri2proto
248 build proto evieproto
249 build proto fixesproto
250 build proto fontcacheproto
251 build proto fontsproto
252 build proto glproto
253 build proto inputproto
254 build proto kbproto
255 build proto randrproto
256 build proto recordproto
257 build proto renderproto
258 build proto resourceproto
259 build proto scrnsaverproto
260 build proto trapproto
261 build proto videoproto
262 build proto x11proto
263 build proto xcmiscproto
264 build proto xextproto
265 build proto xf86bigfontproto
266 build proto xf86dgaproto
267 build proto xf86driproto
268 build proto xf86miscproto
269 build proto xf86vidmodeproto
270 build proto xineramaproto
271 if test x"$USE_XCB" != xNO ; then
272 build xcb proto
276 # bitmaps is needed for building apps, so has to be done separately first
277 # cursors depends on apps/xcursorgen
278 # xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
279 build_data() {
280 # build data bitmaps
281 build data cursors
282 # build data xkbdata
285 # All protocol modules must be installed before the libs (okay, that's an
286 # overstatement, but all protocol modules should be installed anyway)
288 # the libraries have a dependency order:
289 # xtrans, Xau, Xdmcp before anything else
290 # fontenc before Xfont
291 # ICE before SM
292 # X11 before Xext
293 # (X11 and SM) before Xt
294 # Xt before Xmu and Xpm
295 # Xext before any other extension library
296 # Xfixes before Xcomposite
297 # Xp before XprintUtil before XprintAppUtil
299 # If xcb is being used for libX11, it must be built before libX11, but after
300 # Xau & Xdmcp
302 build_lib() {
303 build lib libxtrans
304 build lib libXau
305 build lib libXdmcp
306 if test x"$USE_XCB" != xNO ; then
307 build xcb pthread-stubs
308 build xcb libxcb
310 build lib libX11
311 build lib libXext
312 case $HOST_OS in
313 Darwin*)
314 build lib libAppleWM
316 CYGWIN*)
317 build lib libWindowsWM
321 esac
322 build lib libdmx
323 build lib libfontenc
324 build lib libFS
325 build lib libICE
326 #build lib liblbxutil
327 #build lib liboldX
328 build lib libSM
329 build lib libXt
330 build lib libXmu
331 build lib libXpm
332 build lib libXaw
333 build lib libXfixes
334 build lib libXcomposite
335 build lib libXrender
336 build lib libXdamage
337 build lib libXcursor
338 build lib libXevie
339 build lib libXfont
340 build lib libXfontcache
341 build lib libXft
342 build lib libXi
343 build lib libXinerama
344 build lib libxkbfile
345 build lib libxkbui
346 build lib libXrandr
347 build lib libXRes
348 build lib libXScrnSaver
349 build lib libXTrap
350 build lib libXtst
351 build lib libXv
352 build lib libXvMC
353 build lib libXxf86dga
354 build lib libXxf86misc
355 build lib libXxf86vm
356 build lib libpciaccess
357 build pixman ""
360 # Most apps depend at least on libX11.
362 # bdftopcf depends on libXfont
363 # mkfontscale depends on libfontenc and libfreetype
364 # mkfontdir depends on mkfontscale
366 # TODO: detailed breakdown of which apps require which libs
367 build_app() {
368 build app appres
369 build app bdftopcf
370 build app beforelight
371 build app bitmap
372 build app editres
373 build app fonttosfnt
374 build app fslsfonts
375 build app fstobdf
376 build app iceauth
377 build app ico
378 build app listres
379 build app luit
380 build app mkfontdir
381 build app mkfontscale
382 build app oclock
383 build app rgb
384 build app rendercheck
385 build app rstart
386 build app scripts
387 build app sessreg
388 build app setxkbmap
389 build app showfont
390 build app smproxy
391 build app twm
392 build app viewres
393 build app x11perf
394 build app xauth
395 build app xbacklight
396 build app xbiff
397 build app xcalc
398 build app xclipboard
399 build app xclock
400 build app xcmsdb
401 build app xconsole
402 build app xcursorgen
403 build app xdbedizzy
404 build app xditview
405 build app xdm
406 build app xdpyinfo
407 build app xdriinfo
408 build app xedit
409 build app xev
410 build app xeyes
411 build app xf86dga
412 build app xfd
413 build app xfontsel
414 build app xfs
415 build app xfsinfo
416 build app xgamma
417 build app xgc
418 build app xhost
419 build app xinit
420 build app xinput
421 build app xkbcomp
422 build app xkbevd
423 build app xkbprint
424 build app xkbutils
425 build app xkill
426 build app xload
427 build app xlogo
428 build app xlsatoms
429 build app xlsclients
430 build app xlsfonts
431 build app xmag
432 build app xman
433 build app xmessage
434 build app xmh
435 build app xmodmap
436 build app xmore
437 build app xprop
438 build app xrandr
439 build app xrdb
440 build app xrefresh
441 build app xset
442 build app xsetmode
443 build app xsetpointer
444 build app xsetroot
445 build app xsm
446 build app xstdcmap
447 build app xtrap
448 build app xvidtune
449 build app xvinfo
450 build app xwd
451 build app xwininfo
452 build app xwud
453 # if test x"$USE_XCB" != xNO ; then
454 # build xcb demo
455 # fi
458 build_mesa() {
459 build mesa drm
460 #build mesa mesa
463 # The server requires at least the following libraries:
464 # Xfont, Xau, Xdmcp, pciaccess
465 build_xserver() {
466 build xserver ""
469 build_driver_input() {
470 # Some drivers are only buildable on some OS'es
471 case $HOST_OS in
472 Linux)
473 build driver xf86-input-aiptek
474 build driver xf86-input-evdev
475 build driver xf86-input-joystick
476 #build driver xf86-input-ur98
478 *BSD*)
479 build driver xf86-input-joystick
483 esac
485 # And some drivers are only buildable on some CPUs.
486 case $HOST_CPU in
487 i*86* | amd64* | x86*64*)
488 build driver xf86-input-vmmouse
492 esac
494 build driver xf86-input-acecad
495 #build driver xf86-input-calcomp
496 #build driver xf86-input-citron
497 #build driver xf86-input-digitaledge
498 #build driver xf86-input-dmc
499 #build driver xf86-input-dynapro
500 #build driver xf86-input-elo2300
501 #build driver xf86-input-elographics
502 #build driver xf86-input-fpit
503 #build driver xf86-input-hyperpen
504 #build driver xf86-input-jamstudio
505 build driver xf86-input-keyboard
506 #build driver xf86-input-magellan
507 #build driver xf86-input-magictouch
508 #build driver xf86-input-microtouch
509 build driver xf86-input-mouse
510 #build driver xf86-input-mutouch
511 #build driver xf86-input-palmax
512 #build driver xf86-input-penmount
513 #build driver xf86-input-spaceorb
514 #build driver xf86-input-summa
515 build driver xf86-input-synaptics
516 #build driver xf86-input-tek4957
517 build driver xf86-input-void
520 build_driver_video() {
521 # Some drivers are only buildable on some OS'es
522 case $HOST_OS in
523 *FreeBSD*)
524 case $HOST_CPU in
525 sparc64)
526 build driver xf86-video-sunffb
530 esac
532 *NetBSD* | *OpenBSD*)
533 build driver xf86-video-wsfb
534 build driver xf86-video-sunffb
536 *Linux*)
537 build driver xf86-video-sisusb
538 build driver xf86-video-sunffb
539 build driver xf86-video-v4l
543 esac
545 # Some drivers are only buildable on some architectures
546 case $HOST_CPU in
547 *sparc*)
548 build driver xf86-video-sunbw2
549 build driver xf86-video-suncg14
550 build driver xf86-video-suncg3
551 build driver xf86-video-suncg6
552 build driver xf86-video-sunleo
553 build driver xf86-video-suntcx
555 i*86* | amd64* | x86*64*)
556 build driver xf86-video-i740
557 build driver xf86-video-intel
558 # build driver xf86-video-via
562 esac
564 build driver xf86-video-apm
565 build driver xf86-video-ark
566 build driver xf86-video-ast
567 build driver xf86-video-ati
568 build driver xf86-video-chips
569 build driver xf86-video-cirrus
570 build driver xf86-video-dummy
571 build driver xf86-video-fbdev
572 build driver xf86-video-geode
573 # build driver xf86-video-glide
574 build driver xf86-video-glint
575 build driver xf86-video-i128
576 # build driver xf86-video-imstt
577 build driver xf86-video-mach64
578 build driver xf86-video-mga
579 build driver xf86-video-neomagic
580 build driver xf86-video-newport
581 build driver xf86-video-nouveau
582 build driver xf86-video-nv
583 build driver xf86-video-radeonhd
584 build driver xf86-video-rendition
585 build driver xf86-video-r128
586 build driver xf86-video-s3
587 build driver xf86-video-s3virge
588 build driver xf86-video-savage
589 build driver xf86-video-siliconmotion
590 build driver xf86-video-sis
591 build driver xf86-video-tdfx
592 build driver xf86-video-tga
593 build driver xf86-video-trident
594 build driver xf86-video-tseng
595 build driver xf86-video-vesa
596 build driver xf86-video-vmware
597 build driver xf86-video-voodoo
598 build driver xf86-video-xgi
599 build driver xf86-video-xgixp
602 # The server must be built before the drivers
603 build_driver() {
604 # XQuartz doesn't need these...
605 case $HOST_OS in
606 Darwin*) return 0 ;;
607 esac
609 build_driver_input
610 build_driver_video
613 # All fonts require mkfontscale and mkfontdir to be available
615 # The following fonts require bdftopcf to be available:
616 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
617 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
618 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
619 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
620 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
621 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
622 # winitzki-cyrillic
624 # Within the font module, the util component must be built before the
625 # following fonts:
626 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
627 # bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi, bh-lucidatypewriter-75dpi,
628 # misc-misc and schumacher-misc
630 # The alias component is recommended to be installed after the other fonts
631 # since the fonts.alias files reference specific fonts installed from the
632 # other font components
633 build_font() {
634 build font util
635 build font encodings
636 build font adobe-100dpi
637 build font adobe-75dpi
638 build font adobe-utopia-100dpi
639 build font adobe-utopia-75dpi
640 build font adobe-utopia-type1
641 build font arabic-misc
642 build font bh-100dpi
643 build font bh-75dpi
644 build font bh-lucidatypewriter-100dpi
645 build font bh-lucidatypewriter-75dpi
646 build font bh-ttf
647 build font bh-type1
648 build font bitstream-100dpi
649 build font bitstream-75dpi
650 build font bitstream-speedo
651 build font bitstream-type1
652 build font cronyx-cyrillic
653 build font cursor-misc
654 build font daewoo-misc
655 build font dec-misc
656 build font ibm-type1
657 build font isas-misc
658 build font jis-misc
659 build font micro-misc
660 build font misc-cyrillic
661 build font misc-ethiopic
662 build font misc-meltho
663 build font misc-misc
664 build font mutt-misc
665 build font schumacher-misc
666 build font screen-cyrillic
667 build font sony-misc
668 build font sun-misc
669 build font winitzki-cyrillic
670 build font xfree86-type1
671 build font alias
674 # makedepend requires xproto
675 build_util() {
676 build util cf
677 build util imake
678 build util makedepend
679 build util gccmakedep
680 build util lndir
681 if test x"$USE_XCB" != xNO ; then
682 build xcb util
685 build xkeyboard-config ""
688 # xorg-docs requires xorg-sgml-doctools
689 build_doc() {
690 build doc xorg-sgml-doctools
691 build doc xorg-docs
694 usage() {
695 echo "Usage: $0 [options] prefix"
696 echo " where options are:"
697 echo " -a : do NOT run auto config tools (autogen.sh, configure)"
698 echo " -b : use .build.$HAVE_ARCH build directory"
699 echo " -c : run make clean in addition to others"
700 echo " -d : run make distcheck in addition to others"
701 echo " -D : run make dist in addition to others"
702 echo " -f file: append module being built to file. The last line of this"
703 echo " file can be used for resuming with -r."
704 echo " -g : build with debug information"
705 echo " -n : do not quit after error; just print error message"
706 echo " -o module/component : build just this component"
707 echo " -p : run git pull on each component"
708 echo " -r module/component : resume building with this comonent"
709 echo " -s sudo-command : sudo command to use"
710 echo " --clone : clone non-existing repositories (uses \$GITROOT if set)"
713 HAVE_ARCH="`uname -i`"
714 DIR_ARCH=""
715 DIR_CONFIG="."
716 LIB_ONLY=0
718 # Process command line args
719 while test $# != 0
721 case $1 in
723 NOAUTOGEN=1
726 DIR_ARCH=".build.$HAVE_ARCH"
727 DIR_CONFIG=".."
730 CLEAN=1
733 DISTCHECK=1
736 DIST=1
739 shift
740 BUILT_MODULES_FILE=$1
743 CFLAGS="-g3 -O0"
744 export CFLAGS
745 CONFCFLAGS="CFLAGS=-g3 -O0"
748 LIB_ONLY=1
751 NOQUIT=1
754 shift
755 RESUME=$1
756 BUILD_ONE=1
759 PULL=1
761 --clone)
762 CLONE=1
765 shift
766 RESUME=$1
769 shift
770 SUDO=$1
773 PREFIX=$1
775 esac
777 shift
778 done
780 if test x"${PREFIX}" = x ; then
781 usage
782 exit
785 HOST_OS=`uname -s`
786 HOST_CPU=`uname -m`
788 if test x$LIBDIR = x ; then
789 LIBDIR=lib
792 export HOST_OS
793 export HOST_CPU
794 export LIBDIR
796 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
798 # Must create local aclocal dir or aclocal fails
799 ACLOCAL_LOCALDIR="${DESTDIR}${PREFIX}/share/aclocal"
800 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
802 # The following is required to make aclocal find our .m4 macros
803 if test x"$ACLOCAL" = x; then
804 ACLOCAL="aclocal -I ${ACLOCAL_LOCALDIR}"
805 else
806 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
808 export ACLOCAL
810 # The following is required to make pkg-config find our .pc metadata files
811 if test x"$PKG_CONFIG_PATH" = x; then
812 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/${LIBDIR}/pkgconfig
813 else
814 PKG_CONFIG_PATH=${DESTDIR}${PREFIX}/${LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}
816 export PKG_CONFIG_PATH
818 # Set the library path so that locally built libs will be found by apps
819 if test x"$LD_LIBRARY_PATH" = x; then
820 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/${LIBDIR}
821 else
822 LD_LIBRARY_PATH=${DESTDIR}${PREFIX}/${LIBDIR}:${LD_LIBRARY_PATH}
824 export LD_LIBRARY_PATH
826 # Set the path so that locally built apps will be found and used
827 if test x"$PATH" = x; then
828 PATH=${DESTDIR}${PREFIX}/bin
829 else
830 PATH=${DESTDIR}${PREFIX}/bin:${PATH}
832 export PATH
834 # Choose which make program to use
835 if test x"$MAKE" = x; then
836 MAKE=make
839 # Set the default font path for xserver/xorg unless it's already set
840 if test x"$FONTPATH" = x; then
841 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/"
842 export FONTPATH
845 # Create the log file directory
846 $SUDO mkdir -p ${DESTDIR}${PREFIX}/var/log
848 date
850 # We must install the global macros before anything else
851 build util macros
853 build_proto
854 build_lib
855 build_mesa
857 if test $LIB_ONLY -eq 0; then
858 build_doc
859 build data bitmaps
860 build_app
861 build_xserver
862 build_driver
863 build_data
864 build_font
865 build_util
868 date
870 if test "x$nonexistent_components" != x ; then
871 echo ""
872 echo "***** Skipped components (not available) *****"
873 echo "$nonexistent_components"
874 echo ""
877 if test "x$failed_components" != x ; then
878 echo ""
879 echo "***** Failed components *****"
880 echo "$failed_components"
881 echo ""
884 if test "x$CLONE" != x && test "x$clonefailed_components" != x ; then
885 echo ""
886 echo "***** Components failed to clone *****"
887 echo "$clonefailed_components"
888 echo ""