jhbuild: remove libdrm dependency on util-macros
[xorg-util-modular.git] / build.sh
blob0269ea3ad9a305e83f411483105ccd36582900ca
1 #!/bin/sh
2 # ===========================================================================
4 # NAME
5 # build.sh - extract, configure, build and install the X Window System
7 # SYNOPSIS
8 # build.sh [options] [prefix]
9 # build.sh [-L]
11 # DESCRIPTION
12 # The script ultimate goal is to build all of the X Window and some of its
13 # dependencies from source.
15 # X.Org Modular Tree Developer's Guide
17 # Please consult the guide at http://www.x.org/wiki/ModularDevelopersGuide
18 # It provides detailed instructions on the build tools to install, where to
19 # find the script and how to invoke it.
21 # The X Window System Source Code
23 # The source code is hosted by freedesktop.org and is composed of over 200
24 # modules under the git source code management system. X.Org releases are
25 # available at http://www.x.org/releases/ in the form of software packages.
27 # Basic Operation
29 # The script goes through its list of modules to build. If the source code is
30 # not on disk, it attempts to obtain it from git if the --clone option is
31 # specified. If not, it looks for a package archive file on disk. If it is
32 # still not found, the module is skipped.
34 # The script then runs the appropriate configure script, either autogen.sh
35 # for git modules or the autoconf generated configure script for package
36 # archives.
38 # FEATURES
39 # Over time, functionality have been added to help building a large
40 # number modules. Progress report, handling build breaks, supporting the
41 # GNU Build System features, final build report, and so on.
43 # Building from a Custom Modules List
45 # Starting from the list generated using the -L option, remove unwanted
46 # modules. You may also add your own module or add specific configure
47 # options for some modules to meet your configuration needs. Using the
48 # --modfile option, your list replaces the built-in list of the script.
50 # Resuming Build After a Break
52 # The script can resume building at the last point of failure. This saves a
53 # lot of build time as the modules already built are skipped. The --autoresume
54 # option can be used with --modfile such that only the modules you care about
55 # are built and revisited until successful completion.
57 # Specifying Custom Build Commands
59 # By default, the script invokes the make program with the target "all" and
60 # "install". Some options like -c, -D, or -d alter the targets the make
61 # program builds, but you can specify your own command instead. Using the
62 # --cmd option, provide a different make or git command.
64 # Specifying Configuration Options to Specific Modules
66 # In the modulesfile used by the --modfile option, add any configuration
67 # options you want to pass to the modules as it gets configures by autoconf.
68 # Write the configure options next to the module name in the file.
69 # It could be something like --enable-strict-compilation for example.
71 # OPTIONS
72 # -a Do NOT run auto config tools (autogen.sh, configure)
73 # -b Use .build.unknown build directory
74 # -c Run make clean in addition to "all install"
75 # -D Run make dist in addition to "all install"
76 # -d Run make distcheck in addition "all install"
77 # -g Compile and link with debug information
78 # -L Just list modules to build
79 # -h, --help Display this help and exit successfully
80 # -n Do not quit after error; just print error message
81 # -o module/component
82 # Build just this module/component
83 # -p Update source code before building (git pull --rebase)
84 # -s sudo The command name providing superuser privilege
85 # --autoresume resumefile
86 # Append module being built to, and autoresume from, resumefile
87 # --check Run make check in addition "all install"
88 # --clone Clone non-existing repositories (uses \$GITROOT if set)
89 # --cmd command
90 # Execute arbitrary git, gmake, or make command
91 # --confflags options
92 # Pass options to autgen.sh/configure of all modules
93 # --modfile modulesfile
94 # Only process the module/components specified in modulesfile
95 # Any text after, and on the same line as, the module/component
96 # is assumed to be configuration options for the configuration
97 # of each module/component specifically
98 # --retry-v1 Remake 'all' on failure with Automake silent rules disabled
100 # PREFIX
101 # An absolute filename where GNU "make" will install binaries, libraries and
102 # other installable files. The value is passed to Autoconf through the
103 # --prefix option.
105 # FILES
106 # resumefile
107 # When using --autoresume, the script reads and skips modules tagged with
108 # "PASS" and resume building at the module tagged with "FAIL". The resumefile
109 # file is not intended to be user edited.
111 # modulesfile
112 # When using --modfile, the script replaces its internal modules list with
113 # the list contained in the file. This allows you to build only the modules
114 # you care about and to add third party modules or modules you create.
115 # It is helpful to initialized the file using the -L option.#
117 # ENVIRONMENT
118 # Environment variables specific to build.sh:
120 # PREFIX Install architecture-independent files in PREFIX [/usr/local]
121 # Each module/components is invoked with --prefix
122 # EPREFIX Install architecture-dependent files in EPREFIX [PREFIX]
123 # Each module/components is invoked with --exec-prefix
124 # BINDIR Install user executables [EPREFIX/bin]
125 # Each module/components is invoked with --bindir
126 # DATAROOTDIR Install read-only arch-independent data root [PREFIX/share]
127 # Each module/components is invoked with --datarootdir
128 # DATADIR Install read-only architecture-independent data [DATAROOTDIR]
129 # Each module/components is invoked with --datadir
130 # LIBDIR Install object code libraries [EPREFIX/lib]
131 # Each module/components is invoked with --libdir
132 # LOCALSTATEDIR
133 # Modifiable single-machine data [PREFIX/var]
134 # Each module/components is invoked with --localstatedir
135 # QUIET Do not print messages saying which checks are being made
136 # Each module/components is invoked with --quite
137 # GITROOT Source code repository path [git://anongit.freedesktop.org/git]
138 # Optional when using --clone to update source code before building
139 # CONFFLAGS Configure options to pass to all Autoconf configure scripts
140 # Refer to 'configure --help' from any module/components
142 # Environment variables defined by the GNU Build System:
144 # ACLOCAL The aclocal cmd name [aclocal -I ${DESTDIR}/${DATADIR}/aclocal]
145 # DESTDIR Path to the staging area where installed objects are relocated
146 # MAKE The name of the make command [make]
147 # MAKEFLAGS Options to pass to all $(MAKE) invocations
148 # CC C compiler command
149 # CFLAGS C compiler flags
150 # LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
151 # nonstandard directory <lib dir>
152 # CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
153 # you have headers in a nonstandard directory <include dir>
154 # CPP C preprocessor
156 # Environment variables defined by the shell:
157 # PATH List of directories that the shell searches for commands
158 # $DESTDIR/$BINDIR is prepended
160 # Environment variables defined by the dynamic linker:
161 # LD_LIBRARY_PATH
162 # List directories that the linker searches for shared objects
163 # $DESTDIR/$LIBDIR is prepended
165 # Environment variables defined by the pkg-config system:
167 # PKG_CONFIG_PATH
168 # List directories that pkg-config searches for libraries
169 # $DESTDIR/$DATADIR/pkgconfig and
170 # $DESTDIR/$LIBDIR/pkgconfig are prepended
172 # PORTABILITY
173 # This script is intended to run on any platform supported by X.Org.
174 # The script must be able to run in a Bourne shell.
176 # ===========================================================================
178 envoptions() {
179 cat << EOF
180 Environment variables specific to build.sh:
181 PREFIX Install architecture-independent files in PREFIX [/usr/local]
182 Each module/components is invoked with --prefix
183 EPREFIX Install architecture-dependent files in EPREFIX [PREFIX]
184 Each module/components is invoked with --exec-prefix
185 BINDIR Install user executables [EPREFIX/bin]
186 Each module/components is invoked with --bindir
187 DATAROOTDIR Install read-only arch-independent data root [PREFIX/share]
188 Each module/components is invoked with --datarootdir
189 DATADIR Install read-only architecture-independent data [DATAROOTDIR]
190 Each module/components is invoked with --datadir
191 LIBDIR Install object code libraries [EPREFIX/lib]
192 Each module/components is invoked with --libdir
193 LOCALSTATEDIR
194 Modifiable single-machine data [PREFIX/var]
195 Each module/components is invoked with --localstatedir
196 QUIET Do not print messages saying which checks are being made
197 Each module/components is invoked with --quite
198 GITROOT Source code repository path [git://anongit.freedesktop.org/git]
199 Optional when using --clone to update source code before building
200 CONFFLAGS Configure options to pass to all Autoconf configure scripts
201 Refer to 'configure --help' from any module/components
203 Environment variables defined by the GNU Build System:
204 ACLOCAL The aclocal cmd name [aclocal -I \${DESTDIR}/\${DATADIR}/aclocal]
205 DESTDIR Path to the staging area where installed objects are relocated
206 MAKE The name of the make command [make]
207 MAKEFLAGS Options to pass to all \$(MAKE) invocations
208 CC C compiler command
209 CFLAGS C compiler flags
210 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
211 nonstandard directory <lib dir>
212 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
213 you have headers in a nonstandard directory <include dir>
214 CPP C preprocessor
216 Environment variables defined by the shell:
217 PATH List of directories that the shell searches for commands
218 \$DESTDIR/\$BINDIR is prepended
220 Environment variables defined by the dynamic linker:
221 LD_LIBRARY_PATH
222 List directories that the linker searches for shared objects
223 \$DESTDIR/\$LIBDIR is prepended
225 Environment variables defined by the pkg-config system:
226 PKG_CONFIG_PATH
227 List directories that pkg-config searches for libraries
228 \$DESTDIR/\$DATADIR/pkgconfig and
229 \$DESTDIR/\$LIBDIR/pkgconfig are prepended
233 setup_buildenv() {
235 # Remember if the user had supplied a value through env var or cmd line
236 # A value from cmd line takes precedence of the shell environment
237 PREFIX_USER=${PREFIX:+yes}
238 EPREFIX_USER=${EPREFIX:+yes}
239 BINDIR_USER=${BINDIR:+yes}
240 DATAROOTDIR_USER=${DATAROOTDIR:+yes}
241 DATADIR_USER=${DATADIR:+yes}
242 LIBDIR_USER=${LIBDIR:+yes}
243 LOCALSTATEDIR_USER=${LOCALSTATEDIR:+yes}
245 # Assign a default value if no value was supplied by the user
246 PREFIX=${PREFIX:-/usr/local}
247 EPREFIX=${EPREFIX:-$PREFIX}
248 BINDIR=${BINDIR:-$EPREFIX/bin}
249 DATAROOTDIR=${DATAROOTDIR:-$PREFIX/share}
250 DATADIR=${DATADIR:-$DATAROOTDIR}
251 LIBDIR=${LIBDIR:-$EPREFIX/lib}
252 LOCALSTATEDIR=${LOCALSTATEDIR:-$PREFIX/var}
254 # Support previous usage of LIBDIR which was a subdir relative to PREFIX
255 # We use EPREFIX as this is what PREFIX really meant at the time
256 if [ X"$LIBDIR" != X ]; then
257 if [ X"`expr $LIBDIR : "\(.\)"`" != X/ ]; then
258 echo ""
259 echo "Warning: this usage of \$LIBDIR is deprecated. Use a full path name."
260 echo "The supplied value \"$LIBDIR\" has been replaced with $EPREFIX/$LIBDIR."
261 echo ""
262 LIBDIR=$EPREFIX/$LIBDIR
266 # All directories variables must be full path names
267 check_full_path $PREFIX PREFIX
268 check_full_path $EPREFIX EPREFIX
269 check_full_path $BINDIR BINDIR
270 check_full_path $DATAROOTDIR DATAROOTDIR
271 check_full_path $DATADIR DATADIR
272 check_full_path $LIBDIR LIBDIR
273 check_full_path $LOCALSTATEDIR LOCALSTATEDIR
275 # This will catch the case where user forgets to set PREFIX
276 # and does not have write permission in the /usr/local default location
277 check_writable_dir ${DESTDIR}${PREFIX} PREFIX
279 # Must create local aclocal dir or aclocal fails
280 ACLOCAL_LOCALDIR="${DESTDIR}${DATADIR}/aclocal"
281 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
283 # The following is required to make aclocal find our .m4 macros
284 ACLOCAL=${ACLOCAL:="aclocal"}
285 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
286 export ACLOCAL
288 # The following is required to make pkg-config find our .pc metadata files
289 PKG_CONFIG_PATH=${DESTDIR}${DATADIR}/pkgconfig:${DESTDIR}${LIBDIR}/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}
290 export PKG_CONFIG_PATH
292 # Set the library path so that locally built libs will be found by apps
293 LD_LIBRARY_PATH=${DESTDIR}${LIBDIR}${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
294 export LD_LIBRARY_PATH
296 # Set the path so that locally built apps will be found and used
297 PATH=${DESTDIR}${BINDIR}${PATH+:$PATH}
298 export PATH
300 # Choose which make program to use
301 MAKE=${MAKE:="make"}
303 # Create the log file directory
304 $SUDO mkdir -p ${DESTDIR}${LOCALSTATEDIR}/log
307 # explain where a failure occurred
308 # if you find this message in the build output it can help tell you where the failure occurred
309 # arguments:
310 # $1 - which command failed
311 # $2 - module
312 # $3 - component
313 # returns:
314 # (irrelevant)
315 failed() {
316 cmd=$1
317 module=$2
318 component=$3
319 echo "build.sh: \"$cmd\" failed on $module${component:+/}$component"
320 failed_components="$failed_components $module${component:+/}$component"
323 # print a pretty title to separate the processing of each module
324 # arguments:
325 # $1 - module
326 # $2 - component
327 # $3 - configuration options
328 # returns:
329 # (irrelevant)
330 module_title() {
331 module=$1
332 component=$2
333 confopts="$3"
334 # preconds
335 if [ X"$module" = X ]; then
336 return
339 echo ""
340 echo "======================================================================"
341 echo "== Processing: \"$module${component:+/}$component\""
342 echo "== configuration options: $CONFFLAGS $confopts"
345 # Search for tarballs in either cwd or under a module directory
346 # The tarball is always extracted in either one of these locations:
347 # - modules with components: under the module subdir (e.g lib/libX11-1.4.0)
348 # - modules without components: under cwd (e.g xserver-1.14.0)
349 # The tarballs are expected to be under one of the locations described above
350 # The location of the tarball does not dictate where it is extracted
351 # arguments:
352 # $1 - module
353 # $2 - component
354 # returns:
355 # 0 - good (either no tarballs or successful extract)
356 # 1 - bad
357 checkfortars() {
358 module=$1
359 component=$2
361 # The package stem is the part of the tar file name that identifies
362 # the git module archived source. Ex: xclock, pixman, libX11
363 # For modules without components, the module name is used by default.
364 pkg_stem=${component:-$module}
366 # Handle special cases where the module or component directory
367 # does not match the package name and/or the package root dir
368 case $module in
369 "data")
370 case $component in
371 "cursors") pkg_stem="xcursor-themes" ;;
372 "bitmaps") pkg_stem="xbitmaps" ;;
373 esac
375 "font")
376 if [ X"$component" != X"encodings" ]; then
377 pkg_stem="font-$component"
380 "lib")
381 case $component in
382 "libXRes") pkg_stem="libXres" ;;
383 "libxtrans") pkg_stem="xtrans" ;;
384 esac
386 "proto")
387 case $component in
388 "x11proto") pkg_stem="xproto" ;;
389 esac
391 "util")
392 case $component in
393 "cf") pkg_stem="xorg-cf-files" ;;
394 "macros") pkg_stem="util-macros" ;;
395 esac
397 "xcb")
398 case $component in
399 "proto")
400 pkg_stem="xcb-proto"
402 "pthread-stubs")
403 pkg_stem="libpthread-stubs"
405 "libxcb")
406 pkg_stem="libxcb"
408 util*)
409 pkg_stem="xcb-$component"
411 esac
413 "mesa")
414 case $component in
415 "drm")
416 pkg_stem="libdrm"
418 "mesa")
419 pkg_stem="MesaLib"
421 esac
423 "xserver")
424 pkg_stem="xorg-server"
426 esac
428 # Search for tarballs in both the module and the src top directory
429 for ii in $module .; do
430 for jj in bz2 gz xz; do
432 # Select from the list the last tarball with a specific pkg_stem
433 pkg_tarfile=`ls -1rt $ii/$pkg_stem-[0-9]*.tar.$jj 2> /dev/null | tail -n 1`
435 # Extract the tarball under the module directory
436 # For modules without components, extract in top level dir
437 if [ X"$pkg_tarfile" != X ]; then
439 # Get the package version and archived toplevel directory
440 pkg_version=`echo $pkg_tarfile | sed 's,.*'$pkg_stem'-\(.*\)\.tar\.'$jj',\1,'`
441 pkg_root_dir="$pkg_stem-$pkg_version"
442 pkg_root_dir=`echo $pkg_root_dir | sed 's,MesaLib,Mesa,'`
444 # Find where to extract the tar file
445 old_srcdir=$SRCDIR
446 if [ X"$component" = X ]; then
447 # For modules with no components (i.e xserver)
448 pkg_extract_dir="."
449 SRCDIR=$pkg_root_dir
450 else
451 # For modules with components (i.e xcb/proto or lib/libXi)
452 pkg_extract_dir=$module
453 SRCDIR=$module/$pkg_root_dir
456 if [ ! -d $SRCDIR ]; then
457 mkdir -p $module
458 case $jj in
459 "bz2")
460 pkg_tar_opts=xjf
462 "gz")
463 pkg_tar_opts=xzf
465 "xz")
466 pkg_tar_opts=xJf
468 esac
469 tar $pkg_tar_opts $pkg_tarfile -C $pkg_extract_dir
470 if [ $? -ne 0 ]; then
471 SRCDIR=${old_srcdir}
472 echo "Unable to extract $pkg_tarfile for $module module"
473 failed tar $module $component
474 return 1
477 return 0
479 done
480 done
482 return 0
485 # perform a clone of a git repository
486 # this function provides the mapping between module/component names
487 # and their location in the fd.o repository
488 # arguments:
489 # $1 - module
490 # $2 - component (optional)
491 # returns:
492 # 0 - good
493 # 1 - bad
494 clone() {
495 module=$1
496 component=$2
497 # preconds
498 if [ X"$module" = X ]; then
499 echo "clone() required first argument is missing"
500 return 1
503 case $module in
504 "pixman")
505 BASEDIR=""
507 "xcb")
508 BASEDIR=""
510 "mesa")
511 BASEDIR=""
513 "xkeyboard-config")
514 BASEDIR=""
516 "libevdev")
517 BASEDIR=""
520 BASEDIR="xorg/"
522 esac
524 DIR="$module${component:+/}$component"
525 GITROOT=${GITROOT:="git://anongit.freedesktop.org/git"}
527 if [ ! -d "$DIR" ]; then
528 git clone "$GITROOT/$BASEDIR$DIR" "$DIR"
529 if [ $? -ne 0 ]; then
530 echo "Failed to clone $module${component:+/}$component. Ignoring."
531 clonefailed_components="$clonefailed_components $module${component:+/}$component"
532 return 1
534 old_pwd=`pwd`
535 cd $DIR
536 if [ $? -ne 0 ]; then
537 echo "Failed to cd to $module${component:+/}$component. Ignoring."
538 clonefailed_components="$clonefailed_components $module${component:+/}$component"
539 return 1
540 return 1
542 git submodule init
543 if [ $? -ne 0 ]; then
544 echo "Failed to initialize $module${component:+/}$component submodule. Ignoring."
545 clonefailed_components="$clonefailed_components $module${component:+/}$component"
546 return 1
548 git submodule update
549 if [ $? -ne 0 ]; then
550 echo "Failed to update $module${component:+/}$component submodule. Ignoring."
551 clonefailed_components="$clonefailed_components $module${component:+/}$component"
552 return 1
554 cd ${old_pwd}
555 else
556 echo "git cannot clone into an existing directory $module${component:+/}$component"
557 return 1
560 return 0
563 # perform processing of each module/component
564 # arguments:
565 # $1 - module
566 # $2 - component
567 # $3 - configure options
568 # returns:
569 # 0 - good
570 # 1 - bad
571 process() {
572 needs_config=0
574 module=$1
575 component=$2
576 confopts="$3"
577 # preconds
578 if [ X"$module" = X ]; then
579 echo "process() required first argument is missing"
580 return 1
583 module_title $module "$component" "$confopts"
585 SRCDIR=""
586 CONFCMD=""
587 if [ -f $module${component:+/}$component/autogen.sh ]; then
588 SRCDIR="$module${component:+/}$component"
589 CONFCMD="autogen.sh"
590 elif [ X"$CLONE" != X ]; then
591 clone $module $component
592 if [ $? -eq 0 ]; then
593 SRCDIR="$module${component:+/}$component"
594 CONFCMD="autogen.sh"
596 needs_config=1
597 else
598 checkfortars $module $component
599 if [ $? -eq 0 ]; then
600 if [ X"$SRCDIR" = X ]; then
601 echo "$module${component:+/}$component does not exist, skipping."
602 nonexistent_components="$nonexistent_components $module${component:+/}$component"
603 return 0
605 CONFCMD="configure"
606 else
607 return 1
611 old_pwd=`pwd`
612 cd $SRCDIR
613 if [ $? -ne 0 ]; then
614 failed cd1 $module $component
615 return 1
618 if [ X"$GITCMD" != X ]; then
619 $GITCMD
620 rtn=$?
621 cd $old_pwd
623 if [ $rtn -ne 0 ]; then
624 failed "$GITCMD" $module $component
625 return 1
627 return 0
630 if [ X"$PULL" != X ]; then
631 git pull --rebase
632 if [ $? -ne 0 ]; then
633 failed "git pull" $module $component
634 cd $old_pwd
635 return 1
637 # The parent module knows which commit the submodule should be at
638 git submodule update
639 if [ $? -ne 0 ]; then
640 failed "git submodule update" $module $component
641 return 1
645 # Build outside source directory
646 if [ X"$DIR_ARCH" != X ] ; then
647 mkdir -p "$DIR_ARCH"
648 if [ $? -ne 0 ]; then
649 failed mkdir $module $component
650 cd $old_pwd
651 return 1
653 cd "$DIR_ARCH"
654 if [ $? -ne 0 ]; then
655 failed cd2 $module $component
656 cd ${old_pwd}
657 return 1
661 # Use "sh autogen.sh" since some scripts are not executable in CVS
662 if [ $needs_config -eq 1 ] || [ X"$NOAUTOGEN" = X ]; then
663 sh ${DIR_CONFIG}/${CONFCMD} \
664 ${PREFIX_USER:+--prefix="$PREFIX"} \
665 ${EPREFIX_USER:+--exec-prefix="$EPREFIX"} \
666 ${BINDIR_USER:+--bindir="$BINDIR"} \
667 ${DATAROOTDIR_USER:+--datarootdir="$DATAROOTDIR"} \
668 ${DATADIR_USER:+--datadir="$DATADIR"} \
669 ${LIBDIR_USER:+--libdir="$LIBDIR"} \
670 ${LOCALSTATEDIR_USER:+--localstatedir="$LOCALSTATEDIR"} \
671 ${QUIET:+--quiet} \
672 ${CONFFLAGS} $confopts \
673 ${CC:+CC="$CC"} \
674 ${CPP:+CPP="$CPP"} \
675 ${CPPFLAGS:+CPPFLAGS="$CPPFLAGS"} \
676 ${CFLAGS:+CFLAGS="$CFLAGS"} \
677 ${LDFLAGS:+LDFLAGS="$LDFLAGS"}
678 if [ $? -ne 0 ]; then
679 failed ${CONFCMD} $module $component
680 cd $old_pwd
681 return 1
685 # A custom 'make' target list was supplied through --cmd option
686 if [ X"$MAKECMD" != X ]; then
687 ${MAKE} $MAKEFLAGS $MAKECMD
688 rtn=$?
689 cd $old_pwd
691 if [ $rtn -ne 0 ]; then
692 failed "$MAKE $MAKEFLAGS $MAKECMD" $module $component
693 return 1
695 return 0
698 ${MAKE} $MAKEFLAGS
699 if [ $? -ne 0 ]; then
700 # Rerun with Automake silent rules disabled to see failing gcc statement
701 if [ X"$RETRY_VERBOSE" != X ]; then
702 echo ""
703 echo "build.sh: Rebuilding $component with Automake silent rules disabled"
704 ${MAKE} $MAKEFLAGS V=1
706 failed "$MAKE $MAKEFLAGS" $module $component
707 cd $old_pwd
708 return 1
711 if [ X"$CHECK" != X ]; then
712 ${MAKE} $MAKEFLAGS check
713 if [ $? -ne 0 ]; then
714 failed "$MAKE $MAKEFLAGS check" $module $component
715 cd $old_pwd
716 return 1
720 if [ X"$CLEAN" != X ]; then
721 ${MAKE} $MAKEFLAGS clean
722 if [ $? -ne 0 ]; then
723 failed "$MAKE $MAKEFLAGS clean" $module $component
724 cd $old_pwd
725 return 1
729 if [ X"$DIST" != X ]; then
730 ${MAKE} $MAKEFLAGS dist
731 if [ $? -ne 0 ]; then
732 failed "$MAKE $MAKEFLAGS dist" $module $component
733 cd $old_pwd
734 return 1
738 if [ X"$DISTCHECK" != X ]; then
739 ${MAKE} $MAKEFLAGS distcheck
740 if [ $? -ne 0 ]; then
741 failed "$MAKE $MAKEFLAGS distcheck" $module $component
742 cd $old_pwd
743 return 1
747 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS install
748 if [ $? -ne 0 ]; then
749 failed "$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH $MAKE $MAKEFLAGS install" $module $component
750 cd $old_pwd
751 return 1
754 cd ${old_pwd}
756 return 0
759 # process each module/component and handle:
760 # LISTONLY, RESUME, NOQUIT, and BUILD_ONE
761 # arguments:
762 # $1 - module
763 # $2 - component
764 # $3 - configure options
765 # returns:
766 # 0 - good
767 # 1 - bad
768 build() {
769 module=$1
770 component=$2
771 confopts="$3"
772 if [ X"$LISTONLY" != X ]; then
773 echo "$module${component:+/}$component"
774 return 0
777 if [ X"$RESUME" != X ]; then
778 if [ X"$RESUME" = X"$module${component:+/}$component" ]; then
779 unset RESUME
780 # Resume build at this module
781 else
782 echo "Skipping $module${component:+/}$component..."
783 return 0
787 process $module "$component" "$confopts"
788 process_rtn=$?
789 if [ X"$BUILT_MODULES_FILE" != X ]; then
790 if [ $process_rtn -ne 0 ]; then
791 echo "FAIL: $module${component:+/}$component" >> $BUILT_MODULES_FILE
792 else
793 echo "PASS: $module${component:+/}$component" >> $BUILT_MODULES_FILE
797 if [ $process_rtn -ne 0 ]; then
798 echo "build.sh: error processing: \"$module${component:+/}$component\""
799 if [ X"$NOQUIT" = X ]; then
800 exit 1
802 return $process_rtn
805 if [ X"$BUILD_ONE" != X ]; then
806 echo "Single-component build complete"
807 exit 0
811 # protocol headers have no build order dependencies
812 build_proto() {
813 case $HOST_OS in
814 Darwin)
815 build proto applewmproto
817 CYGWIN*)
818 build proto windowswmproto
820 esac
821 build proto bigreqsproto
822 build proto compositeproto
823 build proto damageproto
824 build proto dmxproto
825 build proto dri2proto
826 build proto dri3proto
827 build proto fixesproto
828 build proto fontsproto
829 build proto glproto
830 build proto inputproto
831 build proto kbproto
832 build proto presentproto
833 build proto randrproto
834 build proto recordproto
835 build proto renderproto
836 build proto resourceproto
837 build proto scrnsaverproto
838 build proto videoproto
839 build proto x11proto
840 build proto xcmiscproto
841 build proto xextproto
842 build proto xf86bigfontproto
843 build proto xf86dgaproto
844 build proto xf86driproto
845 build proto xf86vidmodeproto
846 build proto xineramaproto
847 build xcb proto
850 # bitmaps is needed for building apps, so has to be done separately first
851 # cursors depends on apps/xcursorgen
852 # xkbdata is obsolete - use xkbdesc from xkeyboard-config instead
853 build_data() {
854 # build data bitmaps
855 build data cursors
858 # All protocol modules must be installed before the libs (okay, that's an
859 # overstatement, but all protocol modules should be installed anyway)
861 # the libraries have a dependency order:
862 # xtrans, Xau, Xdmcp before anything else
863 # fontenc before Xfont
864 # ICE before SM
865 # X11 before Xext
866 # (X11 and SM) before Xt
867 # Xt before Xmu and Xpm
868 # Xext before any other extension library
869 # Xfixes before Xcomposite
870 # Xp before XprintUtil before XprintAppUtil
872 build_lib() {
873 build lib libxtrans
874 build lib libXau
875 build lib libXdmcp
876 build xcb pthread-stubs
877 build xcb libxcb
878 build xcb util
879 build xcb util-image
880 build xcb util-keysyms
881 build xcb util-renderutil
882 build xcb util-wm
883 build lib libX11
884 build lib libXext
885 case $HOST_OS in
886 Darwin)
887 build lib libAppleWM
889 CYGWIN*)
890 build lib libWindowsWM
892 esac
893 build lib libdmx
894 build lib libfontenc
895 build lib libFS
896 build lib libICE
897 build lib libSM
898 build lib libXt
899 build lib libXmu
900 build lib libXpm
901 build lib libXaw
902 build lib libXaw3d
903 build lib libXfixes
904 build lib libXcomposite
905 build lib libXrender
906 build lib libXdamage
907 build lib libXcursor
908 build lib libXfont
909 build lib libXft
910 build lib libXi
911 build lib libXinerama
912 build lib libxkbfile
913 build lib libXrandr
914 build lib libXRes
915 build lib libXScrnSaver
916 case $HOST_OS in
917 Linux)
918 build lib libxshmfence
920 esac
921 build lib libXtst
922 build lib libXv
923 build lib libXvMC
924 build lib libXxf86dga
925 build lib libXxf86vm
926 build lib libpciaccess
927 build pixman ""
930 # Most apps depend at least on libX11.
932 # bdftopcf depends on libXfont
933 # mkfontscale depends on libfontenc and libfreetype
934 # mkfontdir depends on mkfontscale
936 # TODO: detailed breakdown of which apps require which libs
937 build_app() {
938 build app appres
939 build app bdftopcf
940 build app beforelight
941 build app bitmap
942 build app editres
943 build app fonttosfnt
944 build app fslsfonts
945 build app fstobdf
946 build app iceauth
947 build app ico
948 build app listres
949 build app luit
950 build app mkcomposecache
951 build app mkfontdir
952 build app mkfontscale
953 build app oclock
954 build app rgb
955 build app rendercheck
956 build app rstart
957 build app scripts
958 build app sessreg
959 build app setxkbmap
960 build app showfont
961 build app smproxy
962 build app twm
963 build app viewres
964 build app x11perf
965 build app xauth
966 build app xbacklight
967 build app xbiff
968 build app xcalc
969 build app xclipboard
970 build app xclock
971 build app xcmsdb
972 build app xconsole
973 build app xcursorgen
974 build app xdbedizzy
975 build app xditview
976 build app xdm
977 build app xdpyinfo
978 build app xdriinfo
979 build app xedit
980 build app xev
981 build app xeyes
982 build app xf86dga
983 build app xfd
984 build app xfontsel
985 build app xfs
986 build app xfsinfo
987 build app xgamma
988 build app xgc
989 build app xhost
990 build app xinit
991 build app xinput
992 build app xkbcomp
993 build app xkbevd
994 build app xkbprint
995 build app xkbutils
996 build app xkill
997 build app xload
998 build app xlogo
999 build app xlsatoms
1000 build app xlsclients
1001 build app xlsfonts
1002 build app xmag
1003 build app xman
1004 build app xmessage
1005 build app xmh
1006 build app xmodmap
1007 build app xmore
1008 build app xprop
1009 build app xrandr
1010 build app xrdb
1011 build app xrefresh
1012 build app xscope
1013 build app xset
1014 build app xsetmode
1015 build app xsetroot
1016 build app xsm
1017 build app xstdcmap
1018 build app xvidtune
1019 build app xvinfo
1020 build app xwd
1021 build app xwininfo
1022 build app xwud
1025 build_mesa() {
1026 build mesa drm
1027 build mesa mesa
1030 # The server requires at least the following libraries:
1031 # Xfont, Xau, Xdmcp, pciaccess
1032 build_xserver() {
1033 build xserver ""
1036 build_driver_input() {
1037 # Some drivers are only buildable on some OS'es
1038 case $HOST_OS in
1039 Linux)
1040 build driver xf86-input-evdev
1041 build driver xf86-input-joystick
1043 FreeBSD | NetBSD | OpenBSD | Dragonfly | GNU/kFreeBSD)
1044 build driver xf86-input-joystick
1046 esac
1048 # And some drivers are only buildable on some CPUs.
1049 case $HOST_CPU in
1050 i*86 | amd64 | x86_64 | i86pc)
1051 build driver xf86-input-vmmouse
1053 esac
1055 build driver xf86-input-keyboard
1056 build driver xf86-input-mouse
1057 build driver xf86-input-synaptics
1058 build driver xf86-input-void
1061 build_driver_video() {
1062 # Some drivers are only buildable on some OS'es
1063 case $HOST_OS in
1064 FreeBSD)
1065 case $HOST_CPU in
1066 sparc64)
1067 build driver xf86-video-sunffb
1069 esac
1071 NetBSD | OpenBSD)
1072 build driver xf86-video-wsfb
1073 build driver xf86-video-sunffb
1075 Linux)
1076 build driver xf86-video-sisusb
1077 build driver xf86-video-sunffb
1078 build driver xf86-video-v4l
1079 build driver xf86-video-xgixp
1080 case $HOST_CPU in
1081 i*86)
1082 # AMD Geode CPU. Driver contains 32 bit assembler code
1083 build driver xf86-video-geode
1085 esac
1087 esac
1089 # Some drivers are only buildable on some architectures
1090 case $HOST_CPU in
1091 sparc | sparc64)
1092 build driver xf86-video-suncg14
1093 build driver xf86-video-suncg3
1094 build driver xf86-video-suncg6
1095 build driver xf86-video-sunleo
1096 build driver xf86-video-suntcx
1098 i*86 | amd64 | x86_64 | i86pc)
1099 build driver xf86-video-i740
1100 build driver xf86-video-intel
1102 esac
1104 build driver xf86-video-apm
1105 build driver xf86-video-ark
1106 build driver xf86-video-ast
1107 build driver xf86-video-ati
1108 build driver xf86-video-chips
1109 build driver xf86-video-cirrus
1110 build driver xf86-video-dummy
1111 build driver xf86-video-fbdev
1112 # build driver xf86-video-glide
1113 build driver xf86-video-glint
1114 build driver xf86-video-i128
1115 build driver xf86-video-mach64
1116 build driver xf86-video-mga
1117 build driver xf86-video-modesetting
1118 build driver xf86-video-neomagic
1119 build driver xf86-video-nv
1120 build driver xf86-video-rendition
1121 build driver xf86-video-r128
1122 build driver xf86-video-s3
1123 build driver xf86-video-s3virge
1124 build driver xf86-video-savage
1125 build driver xf86-video-siliconmotion
1126 build driver xf86-video-sis
1127 build driver xf86-video-tdfx
1128 build driver xf86-video-tga
1129 build driver xf86-video-trident
1130 build driver xf86-video-tseng
1131 build driver xf86-video-vesa
1132 build driver xf86-video-vmware
1133 build driver xf86-video-voodoo
1136 # The server must be built before the drivers
1137 build_driver() {
1138 # XQuartz doesn't need these...
1139 case $HOST_OS in
1140 Darwin) return 0 ;;
1141 esac
1143 # Build the Wrapper library for evdev devices
1144 case $HOST_OS in
1145 Linux)
1146 build libevdev ""
1148 esac
1149 build_driver_input
1150 build_driver_video
1153 # All fonts require mkfontscale and mkfontdir to be available
1155 # The following fonts require bdftopcf to be available:
1156 # adobe-100dpi, adobe-75dpi, adobe-utopia-100dpi, adobe-utopia-75dpi,
1157 # arabic-misc, bh-100dpi, bh-75dpi, bh-lucidatypewriter-100dpi,
1158 # bh-lucidatypewriter-75dpi, bitstream-100dpi, bitstream-75dpi,
1159 # cronyx-cyrillic, cursor-misc, daewoo-misc, dec-misc, isas-misc,
1160 # jis-misc, micro-misc, misc-cyrillic, misc-misc, mutt-misc,
1161 # schumacher-misc, screen-cyrillic, sony-misc, sun-misc and
1162 # winitzki-cyrillic
1164 # The font util component must be built before any of the fonts, since they
1165 # use the fontutil.m4 installed by it. (As do several other modules, such
1166 # as libfontenc and app/xfs, which is why it is moved up to the top.)
1168 # The alias component is recommended to be installed after the other fonts
1169 # since the fonts.alias files reference specific fonts installed from the
1170 # other font components
1171 build_font() {
1172 build font encodings
1173 build font adobe-100dpi
1174 build font adobe-75dpi
1175 build font adobe-utopia-100dpi
1176 build font adobe-utopia-75dpi
1177 build font adobe-utopia-type1
1178 build font arabic-misc
1179 build font bh-100dpi
1180 build font bh-75dpi
1181 build font bh-lucidatypewriter-100dpi
1182 build font bh-lucidatypewriter-75dpi
1183 build font bh-ttf
1184 build font bh-type1
1185 build font bitstream-100dpi
1186 build font bitstream-75dpi
1187 build font bitstream-type1
1188 build font cronyx-cyrillic
1189 build font cursor-misc
1190 build font daewoo-misc
1191 build font dec-misc
1192 build font ibm-type1
1193 build font isas-misc
1194 build font jis-misc
1195 build font micro-misc
1196 build font misc-cyrillic
1197 build font misc-ethiopic
1198 build font misc-meltho
1199 build font misc-misc
1200 build font mutt-misc
1201 build font schumacher-misc
1202 build font screen-cyrillic
1203 build font sony-misc
1204 build font sun-misc
1205 build font winitzki-cyrillic
1206 build font xfree86-type1
1207 build font alias
1210 # makedepend requires xproto
1211 build_util() {
1212 build util cf
1213 build util imake
1214 build util gccmakedep
1215 build util lndir
1217 build xkeyboard-config ""
1220 # xorg-docs requires xorg-sgml-doctools
1221 build_doc() {
1222 build doc xorg-sgml-doctools
1223 build doc xorg-docs
1226 # just process the sub-projects supplied in the given file ($MODFILE)
1227 # in the order in which they are found in the list
1228 # (prerequisites and ordering are the responsibility of the user)
1229 # globals used:
1230 # $MODFILE - readable file containing list of modules to process
1231 # and their optional configuration options
1232 # arguments:
1233 # (none)
1234 # returns:
1235 # 0 - good
1236 # 1 - bad
1237 process_module_file() {
1238 # preconds
1239 if [ X"$MODFILE" = X ]; then
1240 echo "internal process_module_file() error, \$MODFILE is empty"
1241 return 1
1243 if [ ! -r "$MODFILE" ]; then
1244 echo "module file '$MODFILE' is not readable or does not exist"
1245 return 1
1248 # read from input file, skipping blank and comment lines
1249 while read line; do
1250 # skip blank lines
1251 if [ X"$line" = X ]; then
1252 continue
1255 # skip comment lines
1256 echo "$line" | grep "^#" > /dev/null
1257 if [ $? -eq 0 ]; then
1258 continue
1261 # parse each line to extract module, component and options name
1262 field1=`echo $line | cut -d' ' -f1`
1263 module=`echo $field1 | cut -d'/' -f1`
1264 component=`echo $field1 | cut -d'/' -s -f2`
1265 confopts=`echo $line | cut -d' ' -s -f2-`
1267 build $module "$component" "$confopts"
1269 done <"$MODFILE"
1271 return 0
1274 usage() {
1275 basename="`expr "//$0" : '.*/\([^/]*\)'`"
1276 echo "Usage: $basename [options] [prefix]"
1277 echo "Options:"
1278 echo " -a Do NOT run auto config tools (autogen.sh, configure)"
1279 echo " -b Use .build.unknown build directory"
1280 echo " -c Run make clean in addition to \"all install\""
1281 echo " -D Run make dist in addition to \"all install\""
1282 echo " -d Run make distcheck in addition \"all install\""
1283 echo " -g Compile and link with debug information"
1284 echo " -h, --help Display this help and exit successfully"
1285 echo " -n Do not quit after error; just print error message"
1286 echo " -o module/component"
1287 echo " Build just this module/component"
1288 echo " -p Update source code before building (git pull --rebase)"
1289 echo " -s sudo The command name providing superuser privilege"
1290 echo " --autoresume resumefile"
1291 echo " Append module being built to, and autoresume from, <file>"
1292 echo " --check Run make check in addition \"all install\""
1293 echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
1294 echo " --cmd command"
1295 echo " Execute arbitrary git, gmake, or make command"
1296 echo " --confflags options"
1297 echo " Pass options to autgen.sh/configure of all modules"
1298 echo " --modfile modulefile"
1299 echo " Only process the module/components specified in modulefile"
1300 echo " Any text after, and on the same line as, the module/component"
1301 echo " is assumed to be configuration options for the configuration"
1302 echo " of each module/component specifically"
1303 echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
1304 echo ""
1305 echo "Usage: $basename -L"
1306 echo " -L Just list modules to build"
1307 echo ""
1308 envoptions
1311 # Ensure the named variable value contains a full path name
1312 # arguments:
1313 # $1 - the variable value (the path to examine)
1314 # $2 - the name of the variable
1315 # returns:
1316 # returns nothing or exit on error with message
1317 check_full_path () {
1318 path=$1
1319 varname=$2
1320 if [ X"`expr $path : "\(.\)"`" != X/ ]; then
1321 echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
1322 echo ""
1323 usage
1324 exit 1
1328 # Ensure the named variable value contains a writable directory
1329 # arguments:
1330 # $1 - the variable value (the path to examine)
1331 # $2 - the name of the variable
1332 # returns:
1333 # returns nothing or exit on error with message
1334 check_writable_dir () {
1335 path=$1
1336 varname=$2
1337 if [ X"$SUDO" = X ]; then
1338 if [ ! -d "$path" ] || [ ! -w "$path" ]; then
1339 echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
1340 echo ""
1341 usage
1342 exit 1
1347 # perform sanity checks on cmdline args which require arguments
1348 # arguments:
1349 # $1 - the option being examined
1350 # $2 - the argument to the option
1351 # returns:
1352 # if it returns, everything is good
1353 # otherwise it exit's
1354 required_arg() {
1355 option=$1
1356 arg=$2
1357 # preconds
1358 if [ X"$option" = X ]; then
1359 echo "internal required_arg() error, missing first argument"
1360 exit 1
1363 # check for an argument
1364 if [ X"$arg" = X ]; then
1365 echo "the '$option' option is missing its required argument"
1366 echo ""
1367 usage
1368 exit 1
1371 # does the argument look like an option?
1372 echo $arg | grep "^-" > /dev/null
1373 if [ $? -eq 0 ]; then
1374 echo "the argument '$arg' of option '$option' looks like an option itself"
1375 echo ""
1376 usage
1377 exit 1
1381 #------------------------------------------------------------------------------
1382 # Script main line
1383 #------------------------------------------------------------------------------
1385 # Initialize variables controlling end of run reports
1386 failed_components=""
1387 nonexistent_components=""
1388 clonefailed_components=""
1390 # Set variables supporting multiple binaries for a single source tree
1391 HAVE_ARCH="`uname -i`"
1392 DIR_ARCH=""
1393 DIR_CONFIG="."
1395 # Set variables for conditionally building some components
1396 HOST_OS=`uname -s`
1397 export HOST_OS
1398 HOST_CPU=`uname -m`
1399 export HOST_CPU
1401 # Process command line args
1402 while [ $# != 0 ]
1404 case $1 in
1406 NOAUTOGEN=1
1409 DIR_ARCH=".build.$HAVE_ARCH"
1410 DIR_CONFIG=".."
1413 CLEAN=1
1416 DIST=1
1419 DISTCHECK=1
1422 CFLAGS="${CFLAGS} -g3 -O0"
1424 -h|--help)
1425 usage
1426 exit 0
1429 LISTONLY=1
1432 NOQUIT=1
1435 if [ -n "$BUILT_MODULES_FILE" ]; then
1436 echo "The '-o' and '--autoresume' options are mutually exclusive."
1437 usage
1438 exit 1
1440 required_arg $1 $2
1441 shift
1442 RESUME=`echo $1 | sed "s,/$,,"`
1443 BUILD_ONE=1
1446 PULL=1
1449 required_arg $1 $2
1450 shift
1451 SUDO=$1
1453 --autoresume)
1454 if [ -n "$BUILD_ONE" ]; then
1455 echo "The '-o' and '--autoresume' options are mutually exclusive."
1456 usage
1457 exit 1
1459 required_arg $1 $2
1460 shift
1461 BUILT_MODULES_FILE=$1
1463 --check)
1464 CHECK=1
1466 --clone)
1467 CLONE=1
1469 --cmd)
1470 required_arg $1 $2
1471 shift
1472 cmd1=`echo $1 | cut -d' ' -f1`
1473 cmd2=`echo $1 | cut -d' ' -f2`
1475 # verify the command exists
1476 which $cmd1 > /dev/null 2>&1
1477 if [ $? -ne 0 ]; then
1478 echo "The specified command '$cmd1' does not appear to exist"
1479 echo ""
1480 usage
1481 exit 1
1484 case X"$cmd1" in
1485 X"git")
1486 GITCMD=$1
1488 X"make" | X"gmake")
1489 MAKECMD=$cmd2
1492 echo "The script can only process 'make', 'gmake', or 'git' commands"
1493 echo "It can't process '$cmd1' commands"
1494 echo ""
1495 usage
1496 exit 1
1498 esac
1500 --confflags)
1501 shift
1502 CONFFLAGS=$1
1504 --modfile)
1505 required_arg $1 $2
1506 shift
1507 if [ ! -r "$1" ]; then
1508 echo "can't find/read file '$1'"
1509 exit 1
1511 MODFILE=$1
1513 --retry-v1)
1514 RETRY_VERBOSE=1
1517 if [ X"$too_many" = Xyes ]; then
1518 echo "unrecognized and/or too many command-line arguments"
1519 echo " PREFIX: $PREFIX"
1520 echo " Extra arguments: $1"
1521 echo ""
1522 usage
1523 exit 1
1526 # check that 'prefix' doesn't look like an option
1527 echo $1 | grep "^-" > /dev/null
1528 if [ $? -eq 0 ]; then
1529 echo "'prefix' appears to be an option"
1530 echo ""
1531 usage
1532 exit 1
1535 PREFIX=$1
1536 too_many=yes
1538 esac
1540 shift
1541 done
1543 # All user input has been obtained, set-up the user shell variables
1544 if [ X"$LISTONLY" = X ]; then
1545 setup_buildenv
1546 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
1547 date
1550 # if there is a BUILT_MODULES_FILE
1551 # then start off by checking for and trying to build any modules which failed
1552 # and aren't the last line
1553 if [ X"$BUILT_MODULES_FILE" != X -a -r "$BUILT_MODULES_FILE" ]; then
1554 built_lines=`cat $BUILT_MODULES_FILE | wc -l | sed 's:^ *::'`
1555 built_lines_m1=`expr $built_lines - 1`
1556 orig_BUILT_MODULES_FILE=$BUILT_MODULES_FILE
1557 unset BUILT_MODULES_FILE
1558 curline=1
1559 while read line; do
1560 built_status=`echo $line | cut -c-6`
1561 if [ X"$built_status" = X"FAIL: " ]; then
1562 line=`echo $line | cut -c7-`
1563 field1=`echo $line | cut -d' ' -f1`
1564 module=`echo $field1 | cut -d'/' -f1`
1565 component=`echo $field1 | cut -d'/' -s -f2`
1566 confopts=`echo $line | cut -d' ' -s -f2-`
1568 build_ret=""
1570 # quick check for the module in $MODFILE (if present)
1571 if [ X"$MODFILE" = X ]; then
1572 build $module "$component" "$confopts"
1573 if [ $? -eq 0 ]; then
1574 build_ret="PASS"
1576 else
1577 cat $MODFILE | grep "$module${component:+/}$component" > /dev/null
1578 if [ $? -eq 0 ]; then
1579 build $module "$component" "$confopts"
1580 if [ $? -eq 0 ]; then
1581 build_ret="PASS"
1586 if [ X"$build_ret" = X"PASS" ]; then
1587 built_temp=`mktemp`
1588 if [ $? -ne 0 ]; then
1589 echo "can't create tmp file, $orig_BUILT_MODULES_FILE not modified"
1590 else
1591 head -n `expr $curline - 1` $orig_BUILT_MODULES_FILE > $built_temp
1592 echo "PASS: $module${component:+/}$component" >> $built_temp
1593 tail -n `expr $built_lines - $curline` $orig_BUILT_MODULES_FILE >> $built_temp
1594 mv $built_temp $orig_BUILT_MODULES_FILE
1598 if [ $curline -eq $built_lines_m1 ]; then
1599 break
1601 curline=`expr $curline + 1`
1602 done <"$orig_BUILT_MODULES_FILE"
1604 BUILT_MODULES_FILE=$orig_BUILT_MODULES_FILE
1605 RESUME=`tail -n 1 $BUILT_MODULES_FILE | cut -c7-`
1607 # remove last line of $BUILT_MODULES_FILE
1608 # to avoid a duplicate entry
1609 built_temp=`mktemp`
1610 if [ $? -ne 0 ]; then
1611 echo "can't create tmp file, last built item will be duplicated"
1612 else
1613 head -n $built_lines_m1 $BUILT_MODULES_FILE > $built_temp
1614 mv $built_temp $BUILT_MODULES_FILE
1618 if [ X"$MODFILE" = X ]; then
1619 # We must install the global macros before anything else
1620 build util macros
1621 build font util
1623 build_doc
1624 build_proto
1625 # Required by mesa and depends on xproto
1626 build util makedepend
1627 build_lib
1628 build_mesa
1630 build data bitmaps
1631 build_app
1632 build_xserver
1633 build_driver
1634 build_data
1635 build_font
1636 build_util
1637 else
1638 process_module_file
1641 if [ X"$LISTONLY" != X ]; then
1642 exit 0
1645 # Print the end date/time to compare with the start date/time
1646 date
1648 # Report about components that failed for one reason or another
1649 if [ X"$nonexistent_components" != X ]; then
1650 echo ""
1651 echo "***** Skipped components (not available) *****"
1652 echo "Could neither find a git repository (at the <module/component> paths)"
1653 echo "or a tarball (at the <module/> paths or ./) for:"
1654 echo " <module/component>"
1655 for mod in $nonexistent_components; do
1656 echo " $mod"
1657 done
1658 echo "You may want to provide the --clone option to build.sh"
1659 echo "to automatically git-clone the missing components"
1660 echo ""
1663 if [ X"$failed_components" != X ]; then
1664 echo ""
1665 echo "***** Failed components *****"
1666 for mod in $failed_components; do
1667 echo " $mod"
1668 done
1669 echo ""
1672 if [ X"$CLONE" != X ] && [ X"$clonefailed_components" != X ]; then
1673 echo ""
1674 echo "***** Components failed to clone *****"
1675 for mod in $clonefailed_components; do
1676 echo " $mod"
1677 done
1678 echo ""