build.sh: use meaningful names for parameter variables
[xorg-util-modular.git] / build.sh
bloba731480ea73782aab92374a6edcd36f9cbfac526
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/util"
218 component="xcb-util"
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 else
313 echo "git cannot clone into an existing directory $module/$component"
314 return 1
317 return 0
320 # perform processing of each module/component
321 # arguments:
322 # $1 - module
323 # $2 - component (optional)
324 # returns:
325 # 0 - good
326 # 1 - bad
327 process() {
328 needs_config=0
330 module=$1
331 component=$2
332 # preconds
333 if [ X"$module" = X ]; then
334 echo "process() required first argument is missing"
335 return 1
338 module_title $module $component
340 SRCDIR=""
341 CONFCMD=""
342 if [ -f $module/$component/autogen.sh ]; then
343 SRCDIR="$module/$component"
344 CONFCMD="autogen.sh"
345 elif [ X"$CLONE" != X ]; then
346 clone $module $component
347 if [ $? -eq 0 ]; then
348 SRCDIR="$module/$component"
349 CONFCMD="autogen.sh"
351 needs_config=1
352 else
353 checkfortars $module $component
354 CONFCMD="configure"
357 if [ X"$SRCDIR" = X ]; then
358 echo "$module module component $component does not exist, skipping."
359 nonexistent_components="$nonexistent_components $module/$component"
360 return 0
363 if [ X"$BUILT_MODULES_FILE" != X ]; then
364 echo "$module/$component" >> $BUILT_MODULES_FILE
367 old_pwd=`pwd`
368 cd $SRCDIR
369 if [ $? -ne 0 ]; then
370 failed cd1 $module $component
371 return 1
374 if [ X"$GITCMD" != X ]; then
375 $GITCMD
376 rtn=$?
377 cd $old_pwd
379 if [ $rtn -ne 0 ]; then
380 failed "$GITCMD" $module $component
381 return 1
383 return 0
386 if [ X"$PULL" != X ]; then
387 git pull --rebase
388 if [ $? -ne 0 ]; then
389 failed "git pull" $module $component
390 cd $old_pwd
391 return 1
395 # Build outside source directory
396 if [ X"$DIR_ARCH" != X ] ; then
397 mkdir -p "$DIR_ARCH"
398 if [ $? -ne 0 ]; then
399 failed mkdir $module $component
400 cd $old_pwd
401 return 1
403 cd "$DIR_ARCH"
404 if [ $? -ne 0 ]; then
405 failed cd2 $module $component
406 cd ${old_pwd}
407 return 1
411 # Use "sh autogen.sh" since some scripts are not executable in CVS
412 if [ $needs_config -eq 1 ] || [ X"$NOAUTOGEN" = X ]; then
413 sh ${DIR_CONFIG}/${CONFCMD} \
414 ${PREFIX_USER:+--prefix="$PREFIX"} \
415 ${EPREFIX_USER:+--exec-prefix="$EPREFIX"} \
416 ${BINDIR_USER:+--bindir="$BINDIR"} \
417 ${DATAROOTDIR_USER:+--datarootdir="$DATAROOTDIR"} \
418 ${DATADIR_USER:+--datadir="$DATADIR"} \
419 ${LIBDIR_USER:+--libdir="$LIBDIR"} \
420 ${LOCALSTATEDIR_USER:+--localstatedir="$LOCALSTATEDIR"} \
421 ${QUIET:+--quiet} \
422 ${CONFFLAGS} \
423 ${CC:+CC="$CC"} \
424 ${CPP:+CPP="$CPP"} \
425 ${CPPFLAGS:+CPPFLAGS="$CPPFLAGS"} \
426 ${CFLAGS:+CFLAGS="$CFLAGS"} \
427 ${LDFLAGS:+LDFLAGS="$LDFLAGS"}
428 if [ $? -ne 0 ]; then
429 failed ${CONFCMD} $module $component
430 cd $old_pwd
431 return 1
435 # A custom 'make' target list was supplied through --cmd option
436 if [ X"$MAKECMD" != X ]; then
437 ${MAKE} $MAKEFLAGS $MAKECMD
438 rtn=$?
439 cd $old_pwd
441 if [ $rtn -ne 0 ]; then
442 failed "$MAKE $MAKEFLAGS $MAKECMD" $module $component
443 return 1
445 return 0
448 ${MAKE} $MAKEFLAGS
449 if [ $? -ne 0 ]; then
450 failed "$MAKE $MAKEFLAGS" $module $component
451 cd $old_pwd
452 return 1
455 if [ X"$CHECK" != X ]; then
456 ${MAKE} $MAKEFLAGS check
457 if [ $? -ne 0 ]; then
458 failed "$MAKE $MAKEFLAGS check" $module $component
459 cd $old_pwd
460 return 1
464 if [ X"$CLEAN" != X ]; then
465 ${MAKE} $MAKEFLAGS clean
466 if [ $? -ne 0 ]; then
467 failed "$MAKE $MAKEFLAGS clean" $module $component
468 cd $old_pwd
469 return 1
473 if [ X"$DIST" != X ]; then
474 ${MAKE} $MAKEFLAGS dist
475 if [ $? -ne 0 ]; then
476 failed "$MAKE $MAKEFLAGS dist" $module $component
477 cd $old_pwd
478 return 1
482 if [ X"$DISTCHECK" != X ]; then
483 ${MAKE} $MAKEFLAGS distcheck
484 if [ $? -ne 0 ]; then
485 failed "$MAKE $MAKEFLAGS distcheck" $module $component
486 cd $old_pwd
487 return 1
491 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install
492 if [ $? -ne 0 ]; then
493 failed "$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH $MAKE $MAKEFLAGS install" $module $component
494 cd $old_pwd
495 return 1
498 cd ${old_pwd}
499 return 0
502 # process each module/component and handle:
503 # LISTONLY, RESUME, NOQUIT, and BUILD_ONE
504 # arguments:
505 # $1 - module
506 # $2 - component (optional)
507 # returns:
508 # 0 - good
509 # 1 - bad
510 build() {
511 module=$1
512 component=$2
513 if [ X"$LISTONLY" != X ]; then
514 echo "$module/$component"
515 return 0
518 if [ X"$RESUME" != X ]; then
519 if [ X"$RESUME" = X"$module/$component" ]; then
520 unset RESUME
521 # Resume build at this module
522 else
523 echo "Skipping $module module component $component..."
524 return 0
528 process $module $component
529 if [ $? -ne 0 ]; then
530 echo "build.sh: error processing module/component: \"$module/$component\""
531 if [ X"$NOQUIT" = X ]; then
532 exit 1
536 if [ X"$BUILD_ONE" != X ]; then
537 echo "Single-component build complete"
538 exit 0
542 # protocol headers have no build order dependencies
543 build_proto() {
544 case $HOST_OS in
545 Darwin)
546 build proto applewmproto
548 CYGWIN*)
549 build proto windowswmproto
553 esac
554 build proto bigreqsproto
555 build proto compositeproto
556 build proto damageproto
557 build proto dmxproto
558 build proto dri2proto
559 build proto fixesproto
560 build proto fontsproto
561 build proto glproto
562 build proto inputproto
563 build proto kbproto
564 build proto randrproto
565 build proto recordproto
566 build proto renderproto
567 build proto resourceproto
568 build proto scrnsaverproto
569 build proto videoproto
570 build proto x11proto
571 build proto xcmiscproto
572 build proto xextproto
573 build proto xf86bigfontproto
574 build proto xf86dgaproto
575 build proto xf86driproto
576 build proto xf86vidmodeproto
577 build proto xineramaproto
578 build xcb proto
581 # bitmaps is needed for building apps, so has to be done separately first
582 # cursors depends on apps/xcursorgen
583 # xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
584 build_data() {
585 # build data bitmaps
586 build data cursors
589 # All protocol modules must be installed before the libs (okay, that's an
590 # overstatement, but all protocol modules should be installed anyway)
592 # the libraries have a dependency order:
593 # xtrans, Xau, Xdmcp before anything else
594 # fontenc before Xfont
595 # ICE before SM
596 # X11 before Xext
597 # (X11 and SM) before Xt
598 # Xt before Xmu and Xpm
599 # Xext before any other extension library
600 # Xfixes before Xcomposite
601 # Xp before XprintUtil before XprintAppUtil
603 build_lib() {
604 build lib libxtrans
605 build lib libXau
606 build lib libXdmcp
607 build xcb pthread-stubs
608 build xcb libxcb
609 build xcb util
610 build lib libX11
611 build lib libXext
612 case $HOST_OS in
613 Darwin)
614 build lib libAppleWM
616 CYGWIN*)
617 build lib libWindowsWM
621 esac
622 build lib libdmx
623 build lib libfontenc
624 build lib libFS
625 build lib libICE
626 build lib libSM
627 build lib libXt
628 build lib libXmu
629 build lib libXpm
630 build lib libXaw
631 build lib libXfixes
632 build lib libXcomposite
633 build lib libXrender
634 build lib libXdamage
635 build lib libXcursor
636 build lib libXfont
637 build lib libXft
638 build lib libXi
639 build lib libXinerama
640 build lib libxkbfile
641 build lib libXrandr
642 build lib libXRes
643 build lib libXScrnSaver
644 build lib libXtst
645 build lib libXv
646 build lib libXvMC
647 build lib libXxf86dga
648 build lib libXxf86vm
649 build lib libpciaccess
650 build pixman ""
653 # Most apps depend at least on libX11.
655 # bdftopcf depends on libXfont
656 # mkfontscale depends on libfontenc and libfreetype
657 # mkfontdir depends on mkfontscale
659 # TODO: detailed breakdown of which apps require which libs
660 build_app() {
661 build app appres
662 build app bdftopcf
663 build app beforelight
664 build app bitmap
665 build app editres
666 build app fonttosfnt
667 build app fslsfonts
668 build app fstobdf
669 build app iceauth
670 build app ico
671 build app listres
672 build app luit
673 build app mkcomposecache
674 build app mkfontdir
675 build app mkfontscale
676 build app oclock
677 build app rgb
678 build app rendercheck
679 build app rstart
680 build app scripts
681 build app sessreg
682 build app setxkbmap
683 build app showfont
684 build app smproxy
685 build app twm
686 build app viewres
687 build app x11perf
688 build app xauth
689 build app xbacklight
690 build app xbiff
691 build app xcalc
692 build app xclipboard
693 build app xclock
694 build app xcmsdb
695 build app xconsole
696 build app xcursorgen
697 build app xdbedizzy
698 build app xditview
699 build app xdm
700 build app xdpyinfo
701 build app xdriinfo
702 build app xedit
703 build app xev
704 build app xeyes
705 build app xf86dga
706 build app xfd
707 build app xfontsel
708 build app xfs
709 build app xfsinfo
710 build app xgamma
711 build app xgc
712 build app xhost
713 build app xinit
714 build app xinput
715 build app xkbcomp
716 build app xkbevd
717 build app xkbprint
718 build app xkbutils
719 build app xkill
720 build app xload
721 build app xlogo
722 build app xlsatoms
723 build app xlsclients
724 build app xlsfonts
725 build app xmag
726 build app xman
727 build app xmessage
728 build app xmh
729 build app xmodmap
730 build app xmore
731 build app xprop
732 build app xrandr
733 build app xrdb
734 build app xrefresh
735 build app xscope
736 build app xset
737 build app xsetmode
738 build app xsetroot
739 build app xsm
740 build app xstdcmap
741 build app xvidtune
742 build app xvinfo
743 build app xwd
744 build app xwininfo
745 build app xwud
748 build_mesa() {
749 build mesa drm
750 build mesa mesa
753 # The server requires at least the following libraries:
754 # Xfont, Xau, Xdmcp, pciaccess
755 build_xserver() {
756 build xserver ""
759 build_driver_input() {
760 # Some drivers are only buildable on some OS'es
761 case $HOST_OS in
762 Linux)
763 build driver xf86-input-aiptek
764 build driver xf86-input-evdev
765 build driver xf86-input-joystick
767 FreeBSD | NetBSD | OpenBSD | Dragonfly | GNU/kFreeBSD)
768 build driver xf86-input-joystick
772 esac
774 # And some drivers are only buildable on some CPUs.
775 case $HOST_CPU in
776 i*86 | amd64 | x86_64)
777 build driver xf86-input-vmmouse
781 esac
783 build driver xf86-input-acecad
784 build driver xf86-input-keyboard
785 build driver xf86-input-mouse
786 build driver xf86-input-penmount
787 build driver xf86-input-synaptics
788 build driver xf86-input-void
791 build_driver_video() {
792 # Some drivers are only buildable on some OS'es
793 case $HOST_OS in
794 FreeBSD)
795 case $HOST_CPU in
796 sparc64)
797 build driver xf86-video-sunffb
801 esac
803 NetBSD | OpenBSD)
804 build driver xf86-video-wsfb
805 build driver xf86-video-sunffb
807 Linux)
808 build driver xf86-video-sisusb
809 build driver xf86-video-sunffb
810 build driver xf86-video-v4l
811 build driver xf86-video-xgixp
812 case $HOST_CPU in
813 i*86)
814 # AMD Geode CPU. Driver contains 32 bit assembler code
815 build driver xf86-video-geode
817 esac
821 esac
823 # Some drivers are only buildable on some architectures
824 case $HOST_CPU in
825 sparc | sparc64)
826 build driver xf86-video-suncg14
827 build driver xf86-video-suncg3
828 build driver xf86-video-suncg6
829 build driver xf86-video-sunleo
830 build driver xf86-video-suntcx
832 i*86 | amd64 | x86_64)
833 build driver xf86-video-i740
834 build driver xf86-video-intel
838 esac
840 build driver xf86-video-apm
841 build driver xf86-video-ark
842 build driver xf86-video-ast
843 build driver xf86-video-ati
844 build driver xf86-video-chips
845 build driver xf86-video-cirrus
846 build driver xf86-video-dummy
847 build driver xf86-video-fbdev
848 # build driver xf86-video-glide
849 build driver xf86-video-glint
850 build driver xf86-video-i128
851 build driver xf86-video-mach64
852 build driver xf86-video-mga
853 build driver xf86-video-neomagic
854 build driver xf86-video-newport
855 build driver xf86-video-nv
856 build driver xf86-video-qxl
857 build driver xf86-video-rendition
858 build driver xf86-video-r128
859 build driver xf86-video-s3
860 build driver xf86-video-s3virge
861 build driver xf86-video-savage
862 build driver xf86-video-siliconmotion
863 build driver xf86-video-sis
864 build driver xf86-video-tdfx
865 build driver xf86-video-tga
866 build driver xf86-video-trident
867 build driver xf86-video-tseng
868 build driver xf86-video-vesa
869 build driver xf86-video-vmware
870 build driver xf86-video-voodoo
871 build driver xf86-video-xgi
874 # The server must be built before the drivers
875 build_driver() {
876 # XQuartz doesn't need these...
877 case $HOST_OS in
878 Darwin) return 0 ;;
879 esac
881 build_driver_input
882 build_driver_video
885 # All fonts require mkfontscale and mkfontdir to be available
887 # The following fonts require bdftopcf to be available:
888 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
889 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
890 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
891 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
892 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
893 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
894 # winitzki-cyrillic
896 # The font util component must be built before any of the fonts, since they
897 # use the fontutil.m4 installed by it. (As do several other modules, such
898 # as libfontenc and app/xfs, which is why it is moved up to the top.)
900 # The alias component is recommended to be installed after the other fonts
901 # since the fonts.alias files reference specific fonts installed from the
902 # other font components
903 build_font() {
904 build font encodings
905 build font adobe-100dpi
906 build font adobe-75dpi
907 build font adobe-utopia-100dpi
908 build font adobe-utopia-75dpi
909 build font adobe-utopia-type1
910 build font arabic-misc
911 build font bh-100dpi
912 build font bh-75dpi
913 build font bh-lucidatypewriter-100dpi
914 build font bh-lucidatypewriter-75dpi
915 build font bh-ttf
916 build font bh-type1
917 build font bitstream-100dpi
918 build font bitstream-75dpi
919 build font bitstream-speedo
920 build font bitstream-type1
921 build font cronyx-cyrillic
922 build font cursor-misc
923 build font daewoo-misc
924 build font dec-misc
925 build font ibm-type1
926 build font isas-misc
927 build font jis-misc
928 build font micro-misc
929 build font misc-cyrillic
930 build font misc-ethiopic
931 build font misc-meltho
932 build font misc-misc
933 build font mutt-misc
934 build font schumacher-misc
935 build font screen-cyrillic
936 build font sony-misc
937 build font sun-misc
938 build font winitzki-cyrillic
939 build font xfree86-type1
940 build font alias
943 # makedepend requires xproto
944 build_util() {
945 build util cf
946 build util imake
947 build util gccmakedep
948 build util lndir
950 build xkeyboard-config ""
953 # xorg-docs requires xorg-sgml-doctools
954 build_doc() {
955 build doc xorg-sgml-doctools
956 build doc xorg-docs
959 # just process the sub-projects supplied in the given file ($MODFILE)
960 # in the order in which they are found in the list
961 # (prerequisites and ordering are the responsibility of the user)
962 # globals used:
963 # $MODFILE - readable file containing list of modules to process
964 # arguments:
965 # (none)
966 # returns:
967 # 0 - good
968 # 1 - bad
969 process_module_file() {
970 # preconds
971 if [ X"$MODFILE" = X ]; then
972 echo "internal process_module_file() error, \$MODFILE is empty"
973 return 1
975 if [ ! -r "$MODFILE" ]; then
976 echo "module file '$MODFILE' is not readable or does not exist"
977 return 1
980 # read from input file, skipping blank and comment lines
981 while read line; do
982 # skip blank lines
983 if [ X"$line" = X ]; then
984 continue
987 # skip comment lines
988 echo "$line" | grep "^#" > /dev/null
989 if [ $? -eq 0 ]; then
990 continue
993 module=`echo $line | cut -d'/' -f1`
994 component=`echo $line | cut -d'/' -f2`
995 build $module $component
996 done <"$MODFILE"
998 return 0
1001 usage() {
1002 basename="`expr "//$0" : '.*/\([^/]*\)'`"
1003 echo "Usage: $basename [options] [prefix]"
1004 echo "Options:"
1005 echo " -a Do NOT run auto config tools (autogen.sh, configure)"
1006 echo " -b Use .build.unknown build directory"
1007 echo " -c Run make clean in addition to \"all install\""
1008 echo " -D Run make dist in addition to \"all install\""
1009 echo " -d Run make distcheck in addition \"all install\""
1010 echo " -g Compile and link with debug information"
1011 echo " -h, --help Display this help and exit successfully"
1012 echo " -n Do not quit after error; just print error message"
1013 echo " -o <module/component> Build just this <module/component>"
1014 echo " -p Update source code before building (git pull --rebase)"
1015 echo " -s <sudo> The command name providing superuser privilege"
1016 echo " --autoresume <file> Append module being built to, and autoresume from, <file>"
1017 echo " --check Run make check in addition \"all install\""
1018 echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
1019 echo " --cmd <cmd> Execute arbitrary git, gmake, or make command <cmd>"
1020 echo " --confflags <options> Pass options to autgen.sh/configure"
1021 echo " --modfile <file> Only process the module/components specified in <file>"
1022 echo ""
1023 echo "Usage: $basename -L"
1024 echo " -L : just list modules to build"
1025 echo ""
1026 envoptions
1029 # Ensure the named variable value contains a full path name
1030 # arguments:
1031 # $1 - the variable value (the path to examine)
1032 # $2 - the name of the variable
1033 # returns:
1034 # returns nothing or exit on error with message
1035 check_full_path () {
1036 path=$1
1037 varname=$2
1038 if [ X"`expr substr $path 1 1`" != X/ ]; then
1039 echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
1040 echo ""
1041 usage
1042 exit 1
1046 # Ensure the named variable value contains a writable directory
1047 # arguments:
1048 # $1 - the variable value (the path to examine)
1049 # $2 - the name of the variable
1050 # returns:
1051 # returns nothing or exit on error with message
1052 check_writable_dir () {
1053 path=$1
1054 varname=$2
1055 if [ X"$SUDO" = X ]; then
1056 if [ ! -d "$path" ] || [ ! -w "$path" ]; then
1057 echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
1058 echo ""
1059 usage
1060 exit 1
1065 # perform sanity checks on cmdline args which require arguments
1066 # arguments:
1067 # $1 - the option being examined
1068 # $2 - the argument to the option
1069 # returns:
1070 # if it returns, everything is good
1071 # otherwise it exit's
1072 required_arg() {
1073 option=$1
1074 arg=$2
1075 # preconds
1076 if [ X"$option" = X ]; then
1077 echo "internal required_arg() error, missing first argument"
1078 exit 1
1081 # check for an argument
1082 if [ X"$arg" = X ]; then
1083 echo "the '$option' option is missing its required argument"
1084 echo ""
1085 usage
1086 exit 1
1089 # does the argument look like an option?
1090 echo $arg | grep "^-" > /dev/null
1091 if [ $? -eq 0 ]; then
1092 echo "the argument '$arg' of option '$option' looks like an option itself"
1093 echo ""
1094 usage
1095 exit 1
1099 #------------------------------------------------------------------------------
1100 # Script main line
1101 #------------------------------------------------------------------------------
1103 # Initialize variables controlling end of run reports
1104 failed_components=""
1105 nonexistent_components=""
1106 clonefailed_components=""
1108 # Set variables supporting multiple binaries for a single source tree
1109 HAVE_ARCH="`uname -i`"
1110 DIR_ARCH=""
1111 DIR_CONFIG="."
1113 # Set variables for conditionally building some components
1114 HOST_OS=`uname -s`
1115 export HOST_OS
1116 HOST_CPU=`uname -m`
1117 export HOST_CPU
1119 # Process command line args
1120 while [ $# != 0 ]
1122 case $1 in
1124 NOAUTOGEN=1
1127 DIR_ARCH=".build.$HAVE_ARCH"
1128 DIR_CONFIG=".."
1131 CLEAN=1
1134 DIST=1
1137 DISTCHECK=1
1140 CFLAGS="${CFLAGS} -g3 -O0"
1142 -h|--help)
1143 usage
1144 exit 0
1147 LISTONLY=1
1150 NOQUIT=1
1153 required_arg $1 $2
1154 shift
1155 RESUME=$1
1156 BUILD_ONE=1
1159 PULL=1
1162 required_arg $1 $2
1163 shift
1164 SUDO=$1
1166 --autoresume)
1167 required_arg $1 $2
1168 shift
1169 BUILT_MODULES_FILE=$1
1170 [ -f $1 ] && RESUME=`tail -n 1 $1`
1172 --check)
1173 CHECK=1
1175 --clone)
1176 CLONE=1
1178 --cmd)
1179 required_arg $1 $2
1180 shift
1181 cmd1=`echo $1 | cut -d' ' -f1`
1182 cmd2=`echo $1 | cut -d' ' -f2`
1184 # verify the command exists
1185 which $cmd1 > /dev/null 2>&1
1186 if [ $? -ne 0 ]; then
1187 echo "The specified command '$cmd1' does not appear to exist"
1188 echo ""
1189 usage
1190 exit 1
1193 case X"$cmd1" in
1194 X"git")
1195 GITCMD=$1
1197 X"make" | X"gmake")
1198 MAKECMD=$cmd2
1201 echo "The script can only process 'make', 'gmake', or 'git' commands"
1202 echo "It can't process '$cmd1' commands"
1203 echo ""
1204 usage
1205 exit 1
1207 esac
1209 --confflags)
1210 shift
1211 CONFFLAGS=$1
1213 --modfile)
1214 required_arg $1 $2
1215 shift
1216 if [ ! -r "$1" ]; then
1217 echo "can't find/read file '$1'"
1218 exit 1
1220 MODFILE=$1
1223 if [ X"$too_many" = Xyes ]; then
1224 echo "unrecognized and/or too many command-line arguments"
1225 echo " PREFIX: $PREFIX"
1226 echo " Extra arguments: $1"
1227 echo ""
1228 usage
1229 exit 1
1232 # check that 'prefix' doesn't look like an option
1233 echo $1 | grep "^-" > /dev/null
1234 if [ $? -eq 0 ]; then
1235 echo "'prefix' appears to be an option"
1236 echo ""
1237 usage
1238 exit 1
1241 PREFIX=$1
1242 too_many=yes
1244 esac
1246 shift
1247 done
1249 # All user input has been obtained, set-up the user shell variables
1250 if [ X"$LISTONLY" = X ]; then
1251 setup_buildenv
1252 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
1253 date
1256 if [ X"$MODFILE" = X ]; then
1257 # We must install the global macros before anything else
1258 build util macros
1259 build font util
1260 # Required by mesa
1261 build util makedepend
1263 build_doc
1264 build_proto
1265 build_lib
1266 build_mesa
1268 build data bitmaps
1269 build_app
1270 build_xserver
1271 build_driver
1272 build_data
1273 build_font
1274 build_util
1275 else
1276 process_module_file
1279 if [ X"$LISTONLY" != X ]; then
1280 exit 0
1283 # Print the end date/time to compare with the start date/time
1284 date
1286 # Report about components that failed for one reason or another
1287 if [ X"$nonexistent_components" != X ]; then
1288 echo ""
1289 echo "***** Skipped components (not available) *****"
1290 echo "Could neither find a git repository (at the <module/component> paths)"
1291 echo "or a tarball (at the <module/> paths or ./) for:"
1292 echo " <module/component>"
1293 for mod in $nonexistent_components; do
1294 echo " $mod"
1295 done
1296 echo "You may want to provide the --clone option to build.sh"
1297 echo "to automatically git-clone the missing components"
1298 echo ""
1301 if [ X"$failed_components" != X ]; then
1302 echo ""
1303 echo "***** Failed components *****"
1304 for mod in $failed_components; do
1305 echo " $mod"
1306 done
1307 echo ""
1310 if [ X"$CLONE" != X ] && [ X"$clonefailed_components" != X ]; then
1311 echo ""
1312 echo "***** Components failed to clone *****"
1313 for mod in $clonefailed_components; do
1314 echo " $mod"
1315 done
1316 echo ""