build.sh: aiptek, acecad and penmount are unmaintained
[xorg-util-modular.git] / build.sh
blobb01d652bc99f5949b7e428ccbcd04f6feade213c
1 #!/bin/sh
3 # Note on portability:
4 # This script is intended to run on any platform supported by X.Org.
5 # The Autoconf generated configure script is a good reference as to what is permitted.
6 # Basically, it should be able to run in a Bourne shell.
8 envoptions() {
9 cat << EOF
10 Environment variables specific to build.sh:
11 PREFIX Install architecture-independent files in PREFIX [/usr/local]
12 Each module/components is invoked with --prefix
13 EPREFIX Install architecture-dependent files in EPREFIX [PREFIX]
14 Each module/components is invoked with --exec-prefix
15 BINDIR Install user executables [EPREFIX/bin]
16 Each module/components is invoked with --bindir
17 DATAROOTDIR Install read-only arch-independent data root [PREFIX/share]
18 Each module/components is invoked with --datarootdir
19 DATADIR Install read-only architecture-independent data [DATAROOTDIR]
20 Each module/components is invoked with --datadir
21 LIBDIR Install object code libraries [EPREFIX/lib]
22 Each module/components is invoked with --libdir
23 LOCALSTATEDIR Modifiable single-machine data [PREFIX/var]
24 Each module/components is invoked with --localstatedir
25 QUIET Do not print messages saying which checks are being made
26 Each module/components is invoked with --quite
27 GITROOT Source code repository path [git://anongit.freedesktop.org/git]
28 Optional when using --clone to update source code before building
29 CONFFLAGS Configure options to pass to all Autoconf configure scripts
30 Refer to 'configure --help' from any module/components
32 Environment variables defined by the GNU Build System:
33 ACLOCAL The aclocal cmd name [aclocal -I \${DESTDIR}/\${DATADIR}/aclocal]
34 DESTDIR Path to the staging area where installed objects are relocated
35 MAKE The name of the make command [make]
36 MAKEFLAGS: Options to pass to all \$(MAKE) invocations
37 CC C compiler command
38 CFLAGS C compiler flags
39 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
40 nonstandard directory <lib dir>
41 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
42 you have headers in a nonstandard directory <include dir>
43 CPP C preprocessor
45 Environment variables defined by the shell:
46 PATH List of directories that the shell searches for commands
47 \$DESTDIR/\$BINDIR is prepended
49 Environment variables defined by the dynamic linker:
50 LD_LIBRARY_PATH List directories that the linker searches for shared objects
51 \$DESTDIR/\$LIBDIR is prepended
53 Environment variables defined by the pkg-config system:
54 PKG_CONFIG_PATH List directories that pkg-config searches for libraries
55 \$DESTDIR/\$DATADIR/pkgconfig and
56 \$DESTDIR/\$LIBDIR/pkgconfig are prepended
57 EOF
60 setup_buildenv() {
62 # Remember if the user had supplied a value through env var or cmd line
63 # A value from cmd line takes precedence of the shell environment
64 PREFIX_USER=${PREFIX:+yes}
65 EPREFIX_USER=${EPREFIX:+yes}
66 BINDIR_USER=${BINDIR:+yes}
67 DATAROOTDIR_USER=${DATAROOTDIR:+yes}
68 DATADIR_USER=${DATADIR:+yes}
69 LIBDIR_USER=${LIBDIR:+yes}
70 LOCALSTATEDIR_USER=${LOCALSTATEDIR:+yes}
72 # Assign a default value if no value was supplied by the user
73 PREFIX=${PREFIX:-/usr/local}
74 EPREFIX=${EPREFIX:-$PREFIX}
75 BINDIR=${BINDIR:-$EPREFIX/bin}
76 DATAROOTDIR=${DATAROOTDIR:-$PREFIX/share}
77 DATADIR=${DATADIR:-$DATAROOTDIR}
78 LIBDIR=${LIBDIR:-$EPREFIX/lib}
79 LOCALSTATEDIR=${LOCALSTATEDIR:-$PREFIX/var}
81 # Support previous usage of LIBDIR which was a subdir relative to PREFIX
82 # We use EPREFIX as this is what PREFIX really meant at the time
83 if [ X"`expr substr $LIBDIR 1 1`" != X/ ]; then
84 echo ""
85 echo "Warning: this usage of \$LIBDIR is deprecated. Use a full path name."
86 echo "The supplied value \"$LIBDIR\" has been replaced with $EPREFIX/$LIBDIR."
87 echo ""
88 LIBDIR=$EPREFIX/$LIBDIR
91 # All directories variables must be full path names
92 check_full_path $PREFIX PREFIX
93 check_full_path $EPREFIX EPREFIX
94 check_full_path $BINDIR BINDIR
95 check_full_path $DATAROOTDIR DATAROOTDIR
96 check_full_path $DATADIR DATADIR
97 check_full_path $LIBDIR LIBDIR
98 check_full_path $LOCALSTATEDIR LOCALSTATEDIR
100 # This will catch the case where user forgets to set PREFIX
101 # and does not have write permission in the /usr/local default location
102 check_writable_dir ${DESTDIR}${PREFIX} PREFIX
104 # Must create local aclocal dir or aclocal fails
105 ACLOCAL_LOCALDIR="${DESTDIR}${DATADIR}/aclocal"
106 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
108 # The following is required to make aclocal find our .m4 macros
109 ACLOCAL=${ACLOCAL:="aclocal"}
110 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
111 export ACLOCAL
113 # The following is required to make pkg-config find our .pc metadata files
114 PKG_CONFIG_PATH=${DESTDIR}${DATADIR}/pkgconfig:${DESTDIR}${LIBDIR}/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}
115 export PKG_CONFIG_PATH
117 # Set the library path so that locally built libs will be found by apps
118 LD_LIBRARY_PATH=${DESTDIR}${LIBDIR}${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
119 export LD_LIBRARY_PATH
121 # Set the path so that locally built apps will be found and used
122 PATH=${DESTDIR}${BINDIR}${PATH+:$PATH}
123 export PATH
125 # Choose which make program to use
126 MAKE=${MAKE:="make"}
128 # Create the log file directory
129 $SUDO mkdir -p ${DESTDIR}${LOCALSTATEDIR}/log
132 # explain where a failure occurred
133 # if you find this message in the build output it can help tell you where the failure occurred
134 # arguments:
135 # $1 - which command failed
136 # $2/$3 - which module/component failed
137 # returns:
138 # (irrelevant)
139 failed() {
140 cmd=$1
141 module=$2
142 component=$3
143 echo "build.sh: \"$cmd\" failed on $module/$component"
144 failed_components="$failed_components $module/$component"
147 # print a pretty title to separate the processing of each module
148 # arguments:
149 # $1 - module
150 # $2 - component
151 # returns:
152 # (irrelevant)
153 module_title() {
154 module=$1
155 component=$2
156 # preconds
157 if [ X"$module" = X ]; then
158 return
161 echo ""
162 echo "======================================================================"
163 echo "== Processing module/component: \"$module/$component\""
166 checkfortars() {
167 module=$1
168 component=$2
169 case $module in
170 "data")
171 case $component in
172 "cursors") component="xcursor-themes" ;;
173 "bitmaps") component="xbitmaps" ;;
174 esac
176 "font")
177 if [ X"$component" != X"encodings" ]; then
178 component="font-$component"
181 "lib")
182 case $component in
183 "libXRes") component="libXres" ;;
184 "libxtrans") component="xtrans" ;;
185 esac
187 "pixman")
188 module="lib"
189 component="pixman"
191 "proto")
192 case $component in
193 "x11proto") component="xproto" ;;
194 esac
196 "util")
197 case $component in
198 "cf") component="xorg-cf-files" ;;
199 "macros") component="util-macros" ;;
200 esac
202 "xcb")
203 case $component in
204 "proto")
205 module="xcb/proto"
206 component="xcb-proto"
208 "pthread-stubs")
209 module="xcb/pthread-stubs"
210 component="libpthread-stubs"
212 "libxcb")
213 module="xcb/libxcb"
214 component="libxcb"
216 util*)
217 module="xcb/$component"
218 component="xcb-$component"
220 esac
222 "mesa")
223 case $component in
224 "drm")
225 module="mesa/drm"
226 component="libdrm"
228 "mesa")
229 module="mesa/mesa"
230 component="MesaLib"
232 esac
234 "xkeyboard-config")
235 component="xkeyboard-config"
237 "xserver")
238 component="xorg-server"
240 esac
241 for ii in $module .; do
242 for jj in bz2 gz; do
243 TARFILE=`ls -1rt $ii/$component-*.tar.$jj 2> /dev/null | tail -n 1`
244 if [ X"$TARFILE" != X ]; then
245 SRCDIR=`echo $TARFILE | sed "s,.tar.$jj,,"`
246 SRCDIR=`echo $SRCDIR | sed "s,MesaLib,Mesa,"`
247 if [ ! -d $SRCDIR ]; then
248 TAROPTS=xjf
249 if [ X"$jj" = X"gz" ]; then
250 TAROPTS=xzf
252 tar $TAROPTS $TARFILE -C $ii
253 if [ $? -ne 0 ]; then
254 failed tar $module $component
255 return 1
258 return 0
260 done
261 done
263 return 0
266 # perform a clone of a git repository
267 # this function provides the mapping between module/component names
268 # and their location in the fd.o repository
269 # arguments:
270 # $1 - module
271 # $2 - component (optional)
272 # returns:
273 # 0 - good
274 # 1 - bad
275 clone() {
276 module=$1
277 component=$2
278 # preconds
279 if [ X"$module" = X ]; then
280 echo "clone() required first argument is missing"
281 return 1
284 case $module in
285 "pixman")
286 BASEDIR=""
288 "xcb")
289 BASEDIR=""
291 "mesa")
292 BASEDIR=""
294 "xkeyboard-config")
295 BASEDIR=""
298 BASEDIR="xorg/"
300 esac
302 DIR="$module/$component"
303 GITROOT=${GITROOT:="git://anongit.freedesktop.org/git"}
305 if [ ! -d "$DIR" ]; then
306 git clone "$GITROOT/$BASEDIR$DIR" "$DIR"
307 if [ $? -ne 0 ]; then
308 echo "Failed to clone $module module component $component. Ignoring."
309 clonefailed_components="$clonefailed_components $module/$component"
310 return 1
312 old_pwd=`pwd`
313 cd $DIR
314 if [ $? -ne 0 ]; then
315 echo "Failed to cd to $module module component $component. Ignoring."
316 clonefailed_components="$clonefailed_components $module/$component"
317 return 1
318 return 1
320 git submodule init
321 if [ $? -ne 0 ]; then
322 echo "Failed to initialize $module module component $component submodule. Ignoring."
323 clonefailed_components="$clonefailed_components $module/$component"
324 return 1
326 git submodule update
327 if [ $? -ne 0 ]; then
328 echo "Failed to update $module module component $component submodule. Ignoring."
329 clonefailed_components="$clonefailed_components $module/$component"
330 return 1
332 cd ${old_pwd}
333 else
334 echo "git cannot clone into an existing directory $module/$component"
335 return 1
338 return 0
341 # perform processing of each module/component
342 # arguments:
343 # $1 - module
344 # $2 - component (optional)
345 # returns:
346 # 0 - good
347 # 1 - bad
348 process() {
349 needs_config=0
351 module=$1
352 component=$2
353 # preconds
354 if [ X"$module" = X ]; then
355 echo "process() required first argument is missing"
356 return 1
359 module_title $module $component
361 SRCDIR=""
362 CONFCMD=""
363 if [ -f $module/$component/autogen.sh ]; then
364 SRCDIR="$module/$component"
365 CONFCMD="autogen.sh"
366 elif [ X"$CLONE" != X ]; then
367 clone $module $component
368 if [ $? -eq 0 ]; then
369 SRCDIR="$module/$component"
370 CONFCMD="autogen.sh"
372 needs_config=1
373 else
374 checkfortars $module $component
375 CONFCMD="configure"
378 if [ X"$SRCDIR" = X ]; then
379 echo "$module module component $component does not exist, skipping."
380 nonexistent_components="$nonexistent_components $module/$component"
381 return 0
384 if [ X"$BUILT_MODULES_FILE" != X ]; then
385 echo "$module/$component" >> $BUILT_MODULES_FILE
388 old_pwd=`pwd`
389 cd $SRCDIR
390 if [ $? -ne 0 ]; then
391 failed cd1 $module $component
392 return 1
395 if [ X"$GITCMD" != X ]; then
396 $GITCMD
397 rtn=$?
398 cd $old_pwd
400 if [ $rtn -ne 0 ]; then
401 failed "$GITCMD" $module $component
402 return 1
404 return 0
407 if [ X"$PULL" != X ]; then
408 git pull --rebase
409 if [ $? -ne 0 ]; then
410 failed "git pull" $module $component
411 cd $old_pwd
412 return 1
414 # The parent module knows which commit the submodule should be at
415 git submodule update
416 if [ $? -ne 0 ]; then
417 failed "git submodule update" $module $component
418 return 1
422 # Build outside source directory
423 if [ X"$DIR_ARCH" != X ] ; then
424 mkdir -p "$DIR_ARCH"
425 if [ $? -ne 0 ]; then
426 failed mkdir $module $component
427 cd $old_pwd
428 return 1
430 cd "$DIR_ARCH"
431 if [ $? -ne 0 ]; then
432 failed cd2 $module $component
433 cd ${old_pwd}
434 return 1
438 # Use "sh autogen.sh" since some scripts are not executable in CVS
439 if [ $needs_config -eq 1 ] || [ X"$NOAUTOGEN" = X ]; then
440 sh ${DIR_CONFIG}/${CONFCMD} \
441 ${PREFIX_USER:+--prefix="$PREFIX"} \
442 ${EPREFIX_USER:+--exec-prefix="$EPREFIX"} \
443 ${BINDIR_USER:+--bindir="$BINDIR"} \
444 ${DATAROOTDIR_USER:+--datarootdir="$DATAROOTDIR"} \
445 ${DATADIR_USER:+--datadir="$DATADIR"} \
446 ${LIBDIR_USER:+--libdir="$LIBDIR"} \
447 ${LOCALSTATEDIR_USER:+--localstatedir="$LOCALSTATEDIR"} \
448 ${QUIET:+--quiet} \
449 ${CONFFLAGS} \
450 ${CC:+CC="$CC"} \
451 ${CPP:+CPP="$CPP"} \
452 ${CPPFLAGS:+CPPFLAGS="$CPPFLAGS"} \
453 ${CFLAGS:+CFLAGS="$CFLAGS"} \
454 ${LDFLAGS:+LDFLAGS="$LDFLAGS"}
455 if [ $? -ne 0 ]; then
456 failed ${CONFCMD} $module $component
457 cd $old_pwd
458 return 1
462 # A custom 'make' target list was supplied through --cmd option
463 if [ X"$MAKECMD" != X ]; then
464 ${MAKE} $MAKEFLAGS $MAKECMD
465 rtn=$?
466 cd $old_pwd
468 if [ $rtn -ne 0 ]; then
469 failed "$MAKE $MAKEFLAGS $MAKECMD" $module $component
470 return 1
472 return 0
475 ${MAKE} $MAKEFLAGS
476 if [ $? -ne 0 ]; then
477 # Rerun with Automake silent rules disabled to see failing gcc statement
478 if [ X"$RETRY_VERBOSE" != X ]; then
479 echo ""
480 echo "build.sh: Rebuilding $component with Automake silent rules disabled"
481 ${MAKE} $MAKEFLAGS V=1
483 failed "$MAKE $MAKEFLAGS" $module $component
484 cd $old_pwd
485 return 1
488 if [ X"$CHECK" != X ]; then
489 ${MAKE} $MAKEFLAGS check
490 if [ $? -ne 0 ]; then
491 failed "$MAKE $MAKEFLAGS check" $module $component
492 cd $old_pwd
493 return 1
497 if [ X"$CLEAN" != X ]; then
498 ${MAKE} $MAKEFLAGS clean
499 if [ $? -ne 0 ]; then
500 failed "$MAKE $MAKEFLAGS clean" $module $component
501 cd $old_pwd
502 return 1
506 if [ X"$DIST" != X ]; then
507 ${MAKE} $MAKEFLAGS dist
508 if [ $? -ne 0 ]; then
509 failed "$MAKE $MAKEFLAGS dist" $module $component
510 cd $old_pwd
511 return 1
515 if [ X"$DISTCHECK" != X ]; then
516 ${MAKE} $MAKEFLAGS distcheck
517 if [ $? -ne 0 ]; then
518 failed "$MAKE $MAKEFLAGS distcheck" $module $component
519 cd $old_pwd
520 return 1
524 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install
525 if [ $? -ne 0 ]; then
526 failed "$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH $MAKE $MAKEFLAGS install" $module $component
527 cd $old_pwd
528 return 1
531 cd ${old_pwd}
532 return 0
535 # process each module/component and handle:
536 # LISTONLY, RESUME, NOQUIT, and BUILD_ONE
537 # arguments:
538 # $1 - module
539 # $2 - component (optional)
540 # returns:
541 # 0 - good
542 # 1 - bad
543 build() {
544 module=$1
545 component=$2
546 if [ X"$LISTONLY" != X ]; then
547 echo "$module/$component"
548 return 0
551 if [ X"$RESUME" != X ]; then
552 if [ X"$RESUME" = X"$module/$component" ]; then
553 unset RESUME
554 # Resume build at this module
555 else
556 echo "Skipping $module module component $component..."
557 return 0
561 process $module $component
562 if [ $? -ne 0 ]; then
563 echo "build.sh: error processing module/component: \"$module/$component\""
564 if [ X"$NOQUIT" = X ]; then
565 exit 1
569 if [ X"$BUILD_ONE" != X ]; then
570 echo "Single-component build complete"
571 exit 0
575 # protocol headers have no build order dependencies
576 build_proto() {
577 case $HOST_OS in
578 Darwin)
579 build proto applewmproto
581 CYGWIN*)
582 build proto windowswmproto
584 esac
585 build proto bigreqsproto
586 build proto compositeproto
587 build proto damageproto
588 build proto dmxproto
589 build proto dri2proto
590 build proto fixesproto
591 build proto fontsproto
592 build proto glproto
593 build proto inputproto
594 build proto kbproto
595 build proto randrproto
596 build proto recordproto
597 build proto renderproto
598 build proto resourceproto
599 build proto scrnsaverproto
600 build proto videoproto
601 build proto x11proto
602 build proto xcmiscproto
603 build proto xextproto
604 build proto xf86bigfontproto
605 build proto xf86dgaproto
606 build proto xf86driproto
607 build proto xf86vidmodeproto
608 build proto xineramaproto
609 build xcb proto
612 # bitmaps is needed for building apps, so has to be done separately first
613 # cursors depends on apps/xcursorgen
614 # xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
615 build_data() {
616 # build data bitmaps
617 build data cursors
620 # All protocol modules must be installed before the libs (okay, that's an
621 # overstatement, but all protocol modules should be installed anyway)
623 # the libraries have a dependency order:
624 # xtrans, Xau, Xdmcp before anything else
625 # fontenc before Xfont
626 # ICE before SM
627 # X11 before Xext
628 # (X11 and SM) before Xt
629 # Xt before Xmu and Xpm
630 # Xext before any other extension library
631 # Xfixes before Xcomposite
632 # Xp before XprintUtil before XprintAppUtil
634 build_lib() {
635 build lib libxtrans
636 build lib libXau
637 build lib libXdmcp
638 build xcb pthread-stubs
639 build xcb libxcb
640 build xcb util
641 build xcb util-image
642 build xcb util-keysyms
643 build xcb util-renderutil
644 build xcb util-wm
645 build lib libX11
646 build lib libXext
647 case $HOST_OS in
648 Darwin)
649 build lib libAppleWM
651 CYGWIN*)
652 build lib libWindowsWM
654 esac
655 build lib libdmx
656 build lib libfontenc
657 build lib libFS
658 build lib libICE
659 build lib libSM
660 build lib libXt
661 build lib libXmu
662 build lib libXpm
663 build lib libXaw
664 build lib libXfixes
665 build lib libXcomposite
666 build lib libXrender
667 build lib libXdamage
668 build lib libXcursor
669 build lib libXfont
670 build lib libXft
671 build lib libXi
672 build lib libXinerama
673 build lib libxkbfile
674 build lib libXrandr
675 build lib libXRes
676 build lib libXScrnSaver
677 build lib libXtst
678 build lib libXv
679 build lib libXvMC
680 build lib libXxf86dga
681 build lib libXxf86vm
682 build lib libpciaccess
683 build pixman ""
686 # Most apps depend at least on libX11.
688 # bdftopcf depends on libXfont
689 # mkfontscale depends on libfontenc and libfreetype
690 # mkfontdir depends on mkfontscale
692 # TODO: detailed breakdown of which apps require which libs
693 build_app() {
694 build app appres
695 build app bdftopcf
696 build app beforelight
697 build app bitmap
698 build app editres
699 build app fonttosfnt
700 build app fslsfonts
701 build app fstobdf
702 build app iceauth
703 build app ico
704 build app listres
705 build app luit
706 build app mkcomposecache
707 build app mkfontdir
708 build app mkfontscale
709 build app oclock
710 build app rgb
711 build app rendercheck
712 build app rstart
713 build app scripts
714 build app sessreg
715 build app setxkbmap
716 build app showfont
717 build app smproxy
718 build app twm
719 build app viewres
720 build app x11perf
721 build app xauth
722 build app xbacklight
723 build app xbiff
724 build app xcalc
725 build app xclipboard
726 build app xclock
727 build app xcmsdb
728 build app xconsole
729 build app xcursorgen
730 build app xdbedizzy
731 build app xditview
732 build app xdm
733 build app xdpyinfo
734 build app xdriinfo
735 build app xedit
736 build app xev
737 build app xeyes
738 build app xf86dga
739 build app xfd
740 build app xfontsel
741 build app xfs
742 build app xfsinfo
743 build app xgamma
744 build app xgc
745 build app xhost
746 build app xinit
747 build app xinput
748 build app xkbcomp
749 build app xkbevd
750 build app xkbprint
751 build app xkbutils
752 build app xkill
753 build app xload
754 build app xlogo
755 build app xlsatoms
756 build app xlsclients
757 build app xlsfonts
758 build app xmag
759 build app xman
760 build app xmessage
761 build app xmh
762 build app xmodmap
763 build app xmore
764 build app xprop
765 build app xrandr
766 build app xrdb
767 build app xrefresh
768 build app xscope
769 build app xset
770 build app xsetmode
771 build app xsetroot
772 build app xsm
773 build app xstdcmap
774 build app xvidtune
775 build app xvinfo
776 build app xwd
777 build app xwininfo
778 build app xwud
781 build_mesa() {
782 build mesa drm
783 build mesa mesa
786 # The server requires at least the following libraries:
787 # Xfont, Xau, Xdmcp, pciaccess
788 build_xserver() {
789 build xserver ""
792 build_driver_input() {
793 # Some drivers are only buildable on some OS'es
794 case $HOST_OS in
795 Linux)
796 build driver xf86-input-evdev
797 build driver xf86-input-joystick
799 FreeBSD | NetBSD | OpenBSD | Dragonfly | GNU/kFreeBSD)
800 build driver xf86-input-joystick
802 esac
804 # And some drivers are only buildable on some CPUs.
805 case $HOST_CPU in
806 i*86 | amd64 | x86_64)
807 build driver xf86-input-vmmouse
809 esac
811 build driver xf86-input-keyboard
812 build driver xf86-input-mouse
813 build driver xf86-input-synaptics
814 build driver xf86-input-void
817 build_driver_video() {
818 # Some drivers are only buildable on some OS'es
819 case $HOST_OS in
820 FreeBSD)
821 case $HOST_CPU in
822 sparc64)
823 build driver xf86-video-sunffb
825 esac
827 NetBSD | OpenBSD)
828 build driver xf86-video-wsfb
829 build driver xf86-video-sunffb
831 Linux)
832 build driver xf86-video-sisusb
833 build driver xf86-video-sunffb
834 build driver xf86-video-v4l
835 build driver xf86-video-xgixp
836 case $HOST_CPU in
837 i*86)
838 # AMD Geode CPU. Driver contains 32 bit assembler code
839 build driver xf86-video-geode
841 esac
843 esac
845 # Some drivers are only buildable on some architectures
846 case $HOST_CPU in
847 sparc | sparc64)
848 build driver xf86-video-suncg14
849 build driver xf86-video-suncg3
850 build driver xf86-video-suncg6
851 build driver xf86-video-sunleo
852 build driver xf86-video-suntcx
854 i*86 | amd64 | x86_64)
855 build driver xf86-video-i740
856 build driver xf86-video-intel
858 esac
860 build driver xf86-video-apm
861 build driver xf86-video-ark
862 build driver xf86-video-ast
863 build driver xf86-video-ati
864 build driver xf86-video-chips
865 build driver xf86-video-cirrus
866 build driver xf86-video-dummy
867 build driver xf86-video-fbdev
868 # build driver xf86-video-glide
869 build driver xf86-video-glint
870 build driver xf86-video-i128
871 build driver xf86-video-mach64
872 build driver xf86-video-mga
873 build driver xf86-video-neomagic
874 build driver xf86-video-newport
875 build driver xf86-video-nv
876 build driver xf86-video-rendition
877 build driver xf86-video-r128
878 build driver xf86-video-s3
879 build driver xf86-video-s3virge
880 build driver xf86-video-savage
881 build driver xf86-video-siliconmotion
882 build driver xf86-video-sis
883 build driver xf86-video-tdfx
884 build driver xf86-video-tga
885 build driver xf86-video-trident
886 build driver xf86-video-tseng
887 build driver xf86-video-vesa
888 build driver xf86-video-vmware
889 build driver xf86-video-voodoo
890 build driver xf86-video-xgi
893 # The server must be built before the drivers
894 build_driver() {
895 # XQuartz doesn't need these...
896 case $HOST_OS in
897 Darwin) return 0 ;;
898 esac
900 build_driver_input
901 build_driver_video
904 # All fonts require mkfontscale and mkfontdir to be available
906 # The following fonts require bdftopcf to be available:
907 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
908 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
909 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
910 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
911 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
912 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
913 # winitzki-cyrillic
915 # The font util component must be built before any of the fonts, since they
916 # use the fontutil.m4 installed by it. (As do several other modules, such
917 # as libfontenc and app/xfs, which is why it is moved up to the top.)
919 # The alias component is recommended to be installed after the other fonts
920 # since the fonts.alias files reference specific fonts installed from the
921 # other font components
922 build_font() {
923 build font encodings
924 build font adobe-100dpi
925 build font adobe-75dpi
926 build font adobe-utopia-100dpi
927 build font adobe-utopia-75dpi
928 build font adobe-utopia-type1
929 build font arabic-misc
930 build font bh-100dpi
931 build font bh-75dpi
932 build font bh-lucidatypewriter-100dpi
933 build font bh-lucidatypewriter-75dpi
934 build font bh-ttf
935 build font bh-type1
936 build font bitstream-100dpi
937 build font bitstream-75dpi
938 build font bitstream-speedo
939 build font bitstream-type1
940 build font cronyx-cyrillic
941 build font cursor-misc
942 build font daewoo-misc
943 build font dec-misc
944 build font ibm-type1
945 build font isas-misc
946 build font jis-misc
947 build font micro-misc
948 build font misc-cyrillic
949 build font misc-ethiopic
950 build font misc-meltho
951 build font misc-misc
952 build font mutt-misc
953 build font schumacher-misc
954 build font screen-cyrillic
955 build font sony-misc
956 build font sun-misc
957 build font winitzki-cyrillic
958 build font xfree86-type1
959 build font alias
962 # makedepend requires xproto
963 build_util() {
964 build util cf
965 build util imake
966 build util gccmakedep
967 build util lndir
969 build xkeyboard-config ""
972 # xorg-docs requires xorg-sgml-doctools
973 build_doc() {
974 build doc xorg-sgml-doctools
975 build doc xorg-docs
978 # just process the sub-projects supplied in the given file ($MODFILE)
979 # in the order in which they are found in the list
980 # (prerequisites and ordering are the responsibility of the user)
981 # globals used:
982 # $MODFILE - readable file containing list of modules to process
983 # arguments:
984 # (none)
985 # returns:
986 # 0 - good
987 # 1 - bad
988 process_module_file() {
989 # preconds
990 if [ X"$MODFILE" = X ]; then
991 echo "internal process_module_file() error, \$MODFILE is empty"
992 return 1
994 if [ ! -r "$MODFILE" ]; then
995 echo "module file '$MODFILE' is not readable or does not exist"
996 return 1
999 # read from input file, skipping blank and comment lines
1000 while read line; do
1001 # skip blank lines
1002 if [ X"$line" = X ]; then
1003 continue
1006 # skip comment lines
1007 echo "$line" | grep "^#" > /dev/null
1008 if [ $? -eq 0 ]; then
1009 continue
1012 module=`echo $line | cut -d'/' -f1`
1013 component=`echo $line | cut -d'/' -f2`
1014 build $module $component
1015 done <"$MODFILE"
1017 return 0
1020 usage() {
1021 basename="`expr "//$0" : '.*/\([^/]*\)'`"
1022 echo "Usage: $basename [options] [prefix]"
1023 echo "Options:"
1024 echo " -a Do NOT run auto config tools (autogen.sh, configure)"
1025 echo " -b Use .build.unknown build directory"
1026 echo " -c Run make clean in addition to \"all install\""
1027 echo " -D Run make dist in addition to \"all install\""
1028 echo " -d Run make distcheck in addition \"all install\""
1029 echo " -g Compile and link with debug information"
1030 echo " -h, --help Display this help and exit successfully"
1031 echo " -n Do not quit after error; just print error message"
1032 echo " -o <module/component> Build just this <module/component>"
1033 echo " -p Update source code before building (git pull --rebase)"
1034 echo " -s <sudo> The command name providing superuser privilege"
1035 echo " --autoresume <file> Append module being built to, and autoresume from, <file>"
1036 echo " --check Run make check in addition \"all install\""
1037 echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
1038 echo " --cmd <cmd> Execute arbitrary git, gmake, or make command <cmd>"
1039 echo " --confflags <options> Pass options to autgen.sh/configure"
1040 echo " --modfile <file> Only process the module/components specified in <file>"
1041 echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
1042 echo ""
1043 echo "Usage: $basename -L"
1044 echo " -L : just list modules to build"
1045 echo ""
1046 envoptions
1049 # Ensure the named variable value contains a full path name
1050 # arguments:
1051 # $1 - the variable value (the path to examine)
1052 # $2 - the name of the variable
1053 # returns:
1054 # returns nothing or exit on error with message
1055 check_full_path () {
1056 path=$1
1057 varname=$2
1058 if [ X"`expr substr $path 1 1`" != X/ ]; then
1059 echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
1060 echo ""
1061 usage
1062 exit 1
1066 # Ensure the named variable value contains a writable directory
1067 # arguments:
1068 # $1 - the variable value (the path to examine)
1069 # $2 - the name of the variable
1070 # returns:
1071 # returns nothing or exit on error with message
1072 check_writable_dir () {
1073 path=$1
1074 varname=$2
1075 if [ X"$SUDO" = X ]; then
1076 if [ ! -d "$path" ] || [ ! -w "$path" ]; then
1077 echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
1078 echo ""
1079 usage
1080 exit 1
1085 # perform sanity checks on cmdline args which require arguments
1086 # arguments:
1087 # $1 - the option being examined
1088 # $2 - the argument to the option
1089 # returns:
1090 # if it returns, everything is good
1091 # otherwise it exit's
1092 required_arg() {
1093 option=$1
1094 arg=$2
1095 # preconds
1096 if [ X"$option" = X ]; then
1097 echo "internal required_arg() error, missing first argument"
1098 exit 1
1101 # check for an argument
1102 if [ X"$arg" = X ]; then
1103 echo "the '$option' option is missing its required argument"
1104 echo ""
1105 usage
1106 exit 1
1109 # does the argument look like an option?
1110 echo $arg | grep "^-" > /dev/null
1111 if [ $? -eq 0 ]; then
1112 echo "the argument '$arg' of option '$option' looks like an option itself"
1113 echo ""
1114 usage
1115 exit 1
1119 #------------------------------------------------------------------------------
1120 # Script main line
1121 #------------------------------------------------------------------------------
1123 # Initialize variables controlling end of run reports
1124 failed_components=""
1125 nonexistent_components=""
1126 clonefailed_components=""
1128 # Set variables supporting multiple binaries for a single source tree
1129 HAVE_ARCH="`uname -i`"
1130 DIR_ARCH=""
1131 DIR_CONFIG="."
1133 # Set variables for conditionally building some components
1134 HOST_OS=`uname -s`
1135 export HOST_OS
1136 HOST_CPU=`uname -m`
1137 export HOST_CPU
1139 # Process command line args
1140 while [ $# != 0 ]
1142 case $1 in
1144 NOAUTOGEN=1
1147 DIR_ARCH=".build.$HAVE_ARCH"
1148 DIR_CONFIG=".."
1151 CLEAN=1
1154 DIST=1
1157 DISTCHECK=1
1160 CFLAGS="${CFLAGS} -g3 -O0"
1162 -h|--help)
1163 usage
1164 exit 0
1167 LISTONLY=1
1170 NOQUIT=1
1173 required_arg $1 $2
1174 shift
1175 RESUME=$1
1176 BUILD_ONE=1
1179 PULL=1
1182 required_arg $1 $2
1183 shift
1184 SUDO=$1
1186 --autoresume)
1187 required_arg $1 $2
1188 shift
1189 BUILT_MODULES_FILE=$1
1190 [ -f $1 ] && RESUME=`tail -n 1 $1`
1192 --check)
1193 CHECK=1
1195 --clone)
1196 CLONE=1
1198 --cmd)
1199 required_arg $1 $2
1200 shift
1201 cmd1=`echo $1 | cut -d' ' -f1`
1202 cmd2=`echo $1 | cut -d' ' -f2`
1204 # verify the command exists
1205 which $cmd1 > /dev/null 2>&1
1206 if [ $? -ne 0 ]; then
1207 echo "The specified command '$cmd1' does not appear to exist"
1208 echo ""
1209 usage
1210 exit 1
1213 case X"$cmd1" in
1214 X"git")
1215 GITCMD=$1
1217 X"make" | X"gmake")
1218 MAKECMD=$cmd2
1221 echo "The script can only process 'make', 'gmake', or 'git' commands"
1222 echo "It can't process '$cmd1' commands"
1223 echo ""
1224 usage
1225 exit 1
1227 esac
1229 --confflags)
1230 shift
1231 CONFFLAGS=$1
1233 --modfile)
1234 required_arg $1 $2
1235 shift
1236 if [ ! -r "$1" ]; then
1237 echo "can't find/read file '$1'"
1238 exit 1
1240 MODFILE=$1
1242 --retry-v1)
1243 RETRY_VERBOSE=1
1246 if [ X"$too_many" = Xyes ]; then
1247 echo "unrecognized and/or too many command-line arguments"
1248 echo " PREFIX: $PREFIX"
1249 echo " Extra arguments: $1"
1250 echo ""
1251 usage
1252 exit 1
1255 # check that 'prefix' doesn't look like an option
1256 echo $1 | grep "^-" > /dev/null
1257 if [ $? -eq 0 ]; then
1258 echo "'prefix' appears to be an option"
1259 echo ""
1260 usage
1261 exit 1
1264 PREFIX=$1
1265 too_many=yes
1267 esac
1269 shift
1270 done
1272 # All user input has been obtained, set-up the user shell variables
1273 if [ X"$LISTONLY" = X ]; then
1274 setup_buildenv
1275 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
1276 date
1279 if [ X"$MODFILE" = X ]; then
1280 # We must install the global macros before anything else
1281 build util macros
1282 build font util
1284 build_doc
1285 build_proto
1286 # Required by mesa and depends on xproto
1287 build util makedepend
1288 build_lib
1289 build_mesa
1291 build data bitmaps
1292 build_app
1293 build_xserver
1294 build_driver
1295 build_data
1296 build_font
1297 build_util
1298 else
1299 process_module_file
1302 if [ X"$LISTONLY" != X ]; then
1303 exit 0
1306 # Print the end date/time to compare with the start date/time
1307 date
1309 # Report about components that failed for one reason or another
1310 if [ X"$nonexistent_components" != X ]; then
1311 echo ""
1312 echo "***** Skipped components (not available) *****"
1313 echo "Could neither find a git repository (at the <module/component> paths)"
1314 echo "or a tarball (at the <module/> paths or ./) for:"
1315 echo " <module/component>"
1316 for mod in $nonexistent_components; do
1317 echo " $mod"
1318 done
1319 echo "You may want to provide the --clone option to build.sh"
1320 echo "to automatically git-clone the missing components"
1321 echo ""
1324 if [ X"$failed_components" != X ]; then
1325 echo ""
1326 echo "***** Failed components *****"
1327 for mod in $failed_components; do
1328 echo " $mod"
1329 done
1330 echo ""
1333 if [ X"$CLONE" != X ] && [ X"$clonefailed_components" != X ]; then
1334 echo ""
1335 echo "***** Components failed to clone *****"
1336 for mod in $clonefailed_components; do
1337 echo " $mod"
1338 done
1339 echo ""