build.sh: add initial support for meson
[xorg-util-modular.git] / build.sh
blob18971236b8948c129e152077b71dbc3195dd8106
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 # -m Do NOT run any of the make targets
80 # -h, --help Display this help and exit successfully
81 # -n Do not quit after error; just print error message
82 # -o module/component
83 # Build just this module/component
84 # -p Update source code before building (git pull --rebase)
85 # -s sudo The command name providing superuser privilege
86 # --autoresume resumefile
87 # Append module being built to, and autoresume from, resumefile
88 # --check Run make check in addition "all install"
89 # --clone Clone non-existing repositories (uses \$GITROOT if set)
90 # --cmd command
91 # Execute arbitrary git, gmake, or make command
92 # --confflags options
93 # Pass options to autgen.sh/configure of all modules
94 # --modfile modulesfile
95 # Only process the module/components specified in modulesfile
96 # Any text after, and on the same line as, the module/component
97 # is assumed to be configuration options for the configuration
98 # of each module/component specifically
99 # --retry-v1 Remake 'all' on failure with Automake silent rules disabled
101 # PREFIX
102 # An absolute filename where GNU "make" will install binaries, libraries and
103 # other installable files. The value is passed to Autoconf through the
104 # --prefix option.
106 # FILES
107 # resumefile
108 # When using --autoresume, the script reads and skips modules tagged with
109 # "PASS" and resume building at the module tagged with "FAIL". The resumefile
110 # file is not intended to be user edited.
112 # modulesfile
113 # When using --modfile, the script replaces its internal modules list with
114 # the list contained in the file. This allows you to build only the modules
115 # you care about and to add third party modules or modules you create.
116 # It is helpful to initialized the file using the -L option.#
118 # ENVIRONMENT
119 # Environment variables specific to build.sh:
121 # PREFIX Install architecture-independent files in PREFIX [/usr/local]
122 # Each module/components is invoked with --prefix
123 # EPREFIX Install architecture-dependent files in EPREFIX [PREFIX]
124 # Each module/components is invoked with --exec-prefix
125 # BINDIR Install user executables [EPREFIX/bin]
126 # Each module/components is invoked with --bindir
127 # DATAROOTDIR Install read-only arch-independent data root [PREFIX/share]
128 # Each module/components is invoked with --datarootdir
129 # DATADIR Install read-only architecture-independent data [DATAROOTDIR]
130 # Each module/components is invoked with --datadir
131 # LIBDIR Install object code libraries [EPREFIX/lib]
132 # Each module/components is invoked with --libdir
133 # LOCALSTATEDIR
134 # Modifiable single-machine data [PREFIX/var]
135 # Each module/components is invoked with --localstatedir
136 # QUIET Do not print messages saying which checks are being made
137 # Each module/components is invoked with --quite
138 # GITROOT Source code repository path [git://anongit.freedesktop.org/git]
139 # Optional when using --clone to update source code before building
140 # GITCLONEOPTS Options passed to git clone.
141 # Optional when using --clone to update source code before building
142 # CONFFLAGS Configure options to pass to all Autoconf configure scripts
143 # Refer to 'configure --help' from any module/components
145 # Environment variables defined by the GNU Build System:
147 # ACLOCAL The aclocal cmd name [aclocal -I ${DESTDIR}/${DATADIR}/aclocal]
148 # DESTDIR Path to the staging area where installed objects are relocated
149 # MAKE The name of the make command [make]
150 # MAKEFLAGS Options to pass to all $(MAKE) invocations
151 # CC C compiler command
152 # CFLAGS C compiler flags
153 # LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
154 # nonstandard directory <lib dir>
155 # CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
156 # you have headers in a nonstandard directory <include dir>
157 # CPP C preprocessor
159 # Environment variables defined by the shell:
160 # PATH List of directories that the shell searches for commands
161 # $DESTDIR/$BINDIR is prepended
163 # Environment variables defined by the dynamic linker:
164 # LD_LIBRARY_PATH
165 # List directories that the linker searches for shared objects
166 # $DESTDIR/$LIBDIR is prepended
168 # Environment variables defined by the pkg-config system:
170 # PKG_CONFIG_PATH
171 # List directories that pkg-config searches for libraries
172 # $DESTDIR/$DATADIR/pkgconfig and
173 # $DESTDIR/$LIBDIR/pkgconfig are prepended
175 # PORTABILITY
176 # This script is intended to run on any platform supported by X.Org.
177 # The script must be able to run in a Bourne shell.
179 # ===========================================================================
181 envoptions() {
182 cat << EOF
183 Environment variables specific to build.sh:
184 PREFIX Install architecture-independent files in PREFIX [/usr/local]
185 Each module/components is invoked with --prefix
186 EPREFIX Install architecture-dependent files in EPREFIX [PREFIX]
187 Each module/components is invoked with --exec-prefix
188 BINDIR Install user executables [EPREFIX/bin]
189 Each module/components is invoked with --bindir
190 DATAROOTDIR Install read-only arch-independent data root [PREFIX/share]
191 Each module/components is invoked with --datarootdir
192 DATADIR Install read-only architecture-independent data [DATAROOTDIR]
193 Each module/components is invoked with --datadir
194 LIBDIR Install object code libraries [EPREFIX/lib]
195 Each module/components is invoked with --libdir
196 LOCALSTATEDIR
197 Modifiable single-machine data [PREFIX/var]
198 Each module/components is invoked with --localstatedir
199 QUIET Do not print messages saying which checks are being made
200 Each module/components is invoked with --quite
201 GITROOT Source code repository path [git://anongit.freedesktop.org/git]
202 Optional when using --clone to update source code before building
203 CONFFLAGS Configure options to pass to all Autoconf configure scripts
204 Refer to 'configure --help' from any module/components
206 Environment variables defined by the GNU Build System:
207 ACLOCAL The aclocal cmd name [aclocal -I \${DESTDIR}/\${DATADIR}/aclocal]
208 DESTDIR Path to the staging area where installed objects are relocated
209 MAKE The name of the make command [make]
210 MAKEFLAGS Options to pass to all \$(MAKE) invocations
211 CC C compiler command
212 CFLAGS C compiler flags
213 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
214 nonstandard directory <lib dir>
215 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
216 you have headers in a nonstandard directory <include dir>
217 CPP C preprocessor
219 Environment variables defined by the shell:
220 PATH List of directories that the shell searches for commands
221 \$DESTDIR/\$BINDIR is prepended
223 Environment variables defined by the dynamic linker:
224 LD_LIBRARY_PATH
225 List directories that the linker searches for shared objects
226 \$DESTDIR/\$LIBDIR is prepended
228 Environment variables defined by the pkg-config system:
229 PKG_CONFIG_PATH
230 List directories that pkg-config searches for libraries
231 \$DESTDIR/\$DATADIR/pkgconfig and
232 \$DESTDIR/\$LIBDIR/pkgconfig are prepended
236 setup_buildenv() {
238 # Remember if the user had supplied a value through env var or cmd line
239 # A value from cmd line takes precedence of the shell environment
240 PREFIX_USER=${PREFIX:+yes}
241 EPREFIX_USER=${EPREFIX:+yes}
242 BINDIR_USER=${BINDIR:+yes}
243 DATAROOTDIR_USER=${DATAROOTDIR:+yes}
244 DATADIR_USER=${DATADIR:+yes}
245 LIBDIR_USER=${LIBDIR:+yes}
246 LOCALSTATEDIR_USER=${LOCALSTATEDIR:+yes}
248 # Assign a default value if no value was supplied by the user
249 PREFIX=${PREFIX:-/usr/local}
250 EPREFIX=${EPREFIX:-$PREFIX}
251 BINDIR=${BINDIR:-$EPREFIX/bin}
252 DATAROOTDIR=${DATAROOTDIR:-$PREFIX/share}
253 DATADIR=${DATADIR:-$DATAROOTDIR}
254 LIBDIR=${LIBDIR:-$EPREFIX/lib}
255 LOCALSTATEDIR=${LOCALSTATEDIR:-$PREFIX/var}
257 # Support previous usage of LIBDIR which was a subdir relative to PREFIX
258 # We use EPREFIX as this is what PREFIX really meant at the time
259 if [ X"$LIBDIR" != X ]; then
260 if [ X"`expr $LIBDIR : "\(.\)"`" != X/ ]; then
261 echo ""
262 echo "Warning: this usage of \$LIBDIR is deprecated. Use a full path name."
263 echo "The supplied value \"$LIBDIR\" has been replaced with $EPREFIX/$LIBDIR."
264 echo ""
265 LIBDIR=$EPREFIX/$LIBDIR
269 # All directories variables must be full path names
270 check_full_path $PREFIX PREFIX
271 check_full_path $EPREFIX EPREFIX
272 check_full_path $BINDIR BINDIR
273 check_full_path $DATAROOTDIR DATAROOTDIR
274 check_full_path $DATADIR DATADIR
275 check_full_path $LIBDIR LIBDIR
276 check_full_path $LOCALSTATEDIR LOCALSTATEDIR
278 # This will catch the case where user forgets to set PREFIX
279 # and does not have write permission in the /usr/local default location
280 check_writable_dir ${DESTDIR}${PREFIX} PREFIX
282 # Must create local aclocal dir or aclocal fails
283 ACLOCAL_LOCALDIR="${DESTDIR}${DATADIR}/aclocal"
284 $SUDO mkdir -p ${ACLOCAL_LOCALDIR}
286 # The following is required to make aclocal find our .m4 macros
287 ACLOCAL=${ACLOCAL:="aclocal"}
288 ACLOCAL="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
289 export ACLOCAL
291 # The following is required to make pkg-config find our .pc metadata files
292 PKG_CONFIG_PATH=${DESTDIR}${DATADIR}/pkgconfig:${DESTDIR}${LIBDIR}/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}
293 export PKG_CONFIG_PATH
295 # Set the library path so that locally built libs will be found by apps
296 LD_LIBRARY_PATH=${DESTDIR}${LIBDIR}${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
297 export LD_LIBRARY_PATH
299 # Set the path so that locally built apps will be found and used
300 PATH=${DESTDIR}${BINDIR}${PATH+:$PATH}
301 export PATH
303 # Choose which make program to use
304 MAKE=${MAKE:="make"}
306 # Create the log file directory
307 $SUDO mkdir -p ${DESTDIR}${LOCALSTATEDIR}/log
310 # explain where a failure occurred
311 # if you find this message in the build output it can help tell you where the failure occurred
312 # arguments:
313 # $1 - which command failed
314 # $2 - module
315 # $3 - component
316 # returns:
317 # (irrelevant)
318 failed() {
319 cmd=$1
320 module=$2
321 component=$3
322 echo "build.sh: \"$cmd\" failed on $module${component:+/}$component"
323 failed_components="$failed_components $module${component:+/}$component"
326 # print a pretty title to separate the processing of each module
327 # arguments:
328 # $1 - module
329 # $2 - component
330 # $3 - configuration options
331 # returns:
332 # (irrelevant)
333 module_title() {
334 module=$1
335 component=$2
336 confopts="$3"
337 # preconds
338 if [ X"$module" = X ]; then
339 return
342 echo ""
343 echo "======================================================================"
344 echo "== Processing: \"$module${component:+/}$component\""
345 echo "== configuration options: $CONFFLAGS $confopts"
348 # Search for tarballs in either cwd or under a module directory
349 # The tarball is always extracted in either one of these locations:
350 # - modules with components: under the module subdir (e.g lib/libX11-1.4.0)
351 # - modules without components: under cwd (e.g xserver-1.14.0)
352 # The tarballs are expected to be under one of the locations described above
353 # The location of the tarball does not dictate where it is extracted
354 # arguments:
355 # $1 - module
356 # $2 - component
357 # returns:
358 # 0 - good (either no tarballs or successful extract)
359 # 1 - bad
360 checkfortars() {
361 module=$1
362 component=$2
364 # The package stem is the part of the tar file name that identifies
365 # the git module archived source. Ex: xclock, pixman, libX11
366 # For modules without components, the module name is used by default.
367 pkg_stem=${component:-$module}
369 # Handle special cases where the module or component directory
370 # does not match the package name and/or the package root dir
371 case $module in
372 "data")
373 case $component in
374 "cursors") pkg_stem="xcursor-themes" ;;
375 "bitmaps") pkg_stem="xbitmaps" ;;
376 esac
378 "font")
379 if [ X"$component" != X"encodings" ]; then
380 pkg_stem="font-$component"
383 "lib")
384 case $component in
385 "libXRes") pkg_stem="libXres" ;;
386 "libxtrans") pkg_stem="xtrans" ;;
387 esac
389 "proto")
390 case $component in
391 "x11proto") pkg_stem="xproto" ;;
392 esac
394 "util")
395 case $component in
396 "cf") pkg_stem="xorg-cf-files" ;;
397 "macros") pkg_stem="util-macros" ;;
398 esac
400 "xcb")
401 case $component in
402 "proto")
403 pkg_stem="xcb-proto"
405 "pthread-stubs")
406 pkg_stem="libpthread-stubs"
408 "libxcb")
409 pkg_stem="libxcb"
411 util*)
412 pkg_stem="xcb-$component"
414 esac
416 "mesa")
417 case $component in
418 "drm")
419 pkg_stem="libdrm"
421 "mesa")
422 pkg_stem="MesaLib"
424 esac
426 "xserver")
427 pkg_stem="xorg-server"
429 esac
431 # Search for tarballs in both the module and the src top directory
432 for ii in $module .; do
433 for jj in bz2 gz xz; do
435 # Select from the list the last tarball with a specific pkg_stem
436 pkg_tarfile=`ls -1rt $ii/$pkg_stem-[0-9]*.tar.$jj 2> /dev/null | tail -n 1`
438 # Extract the tarball under the module directory
439 # For modules without components, extract in top level dir
440 if [ X"$pkg_tarfile" != X ]; then
442 # Get the package version and archived toplevel directory
443 pkg_version=`echo $pkg_tarfile | sed 's,.*'$pkg_stem'-\(.*\)\.tar\.'$jj',\1,'`
444 pkg_root_dir="$pkg_stem-$pkg_version"
445 pkg_root_dir=`echo $pkg_root_dir | sed 's,MesaLib,Mesa,'`
447 # Find where to extract the tar file
448 old_srcdir=$SRCDIR
449 if [ X"$component" = X ]; then
450 # For modules with no components (i.e xserver)
451 pkg_extract_dir="."
452 SRCDIR=$pkg_root_dir
453 else
454 # For modules with components (i.e xcb/proto or lib/libXi)
455 pkg_extract_dir=$module
456 SRCDIR=$module/$pkg_root_dir
459 if [ ! -d $SRCDIR ]; then
460 mkdir -p $module
461 case $jj in
462 "bz2")
463 pkg_tar_opts=xjf
465 "gz")
466 pkg_tar_opts=xzf
468 "xz")
469 pkg_tar_opts=xJf
471 esac
472 tar $pkg_tar_opts $pkg_tarfile -C $pkg_extract_dir
473 if [ $? -ne 0 ]; then
474 SRCDIR=${old_srcdir}
475 echo "Unable to extract $pkg_tarfile for $module module"
476 failed tar $module $component
477 return 1
480 return 0
482 done
483 done
485 return 0
488 # perform a clone of a git repository
489 # this function provides the mapping between module/component names
490 # and their location in the fd.o repository
491 # arguments:
492 # $1 - module
493 # $2 - component (optional)
494 # returns:
495 # 0 - good
496 # 1 - bad
497 clone() {
498 module=$1
499 component=$2
500 # preconds
501 if [ X"$module" = X ]; then
502 echo "clone() required first argument is missing"
503 return 1
506 case $module in
507 "pixman")
508 BASEDIR=""
510 "xcb")
511 BASEDIR=""
513 "mesa")
514 BASEDIR=""
516 "xkeyboard-config")
517 BASEDIR=""
519 "libevdev")
520 BASEDIR=""
522 "libinput")
523 BASEDIR="wayland/"
526 BASEDIR="xorg/"
528 esac
530 DIR="$module${component:+/}$component"
531 GITROOT=${GITROOT:="git://anongit.freedesktop.org/git"}
533 if [ ! -d "$DIR" ]; then
534 git clone $GITCLONEOPTS "$GITROOT/$BASEDIR$DIR" "$DIR"
535 if [ $? -ne 0 ]; then
536 echo "Failed to clone $module${component:+/}$component. Ignoring."
537 clonefailed_components="$clonefailed_components $module${component:+/}$component"
538 return 1
540 old_pwd=`pwd`
541 cd $DIR
542 if [ $? -ne 0 ]; then
543 echo "Failed to cd to $module${component:+/}$component. Ignoring."
544 clonefailed_components="$clonefailed_components $module${component:+/}$component"
545 return 1
546 return 1
548 git submodule init
549 if [ $? -ne 0 ]; then
550 echo "Failed to initialize $module${component:+/}$component submodule. Ignoring."
551 clonefailed_components="$clonefailed_components $module${component:+/}$component"
552 return 1
554 git submodule update
555 if [ $? -ne 0 ]; then
556 echo "Failed to update $module${component:+/}$component submodule. Ignoring."
557 clonefailed_components="$clonefailed_components $module${component:+/}$component"
558 return 1
560 cd ${old_pwd}
561 else
562 echo "git cannot clone into an existing directory $module${component:+/}$component"
563 return 1
566 return 0
569 # perform processing of each module/component
570 # arguments:
571 # $1 - module
572 # $2 - component
573 # $3 - configure options
574 # returns:
575 # 0 - good
576 # 1 - bad
577 process() {
578 module=$1
579 component=$2
580 confopts="$3"
581 # preconds
582 if [ X"$module" = X ]; then
583 echo "process() required first argument is missing"
584 return 1
587 module_title $module "$component" "$confopts"
589 local use_autogen=0
590 local use_configure=0
591 local use_meson=0
593 SRCDIR=""
594 CONFCMD=""
595 if [ -f $module${component:+/}$component/autogen.sh ]; then
596 SRCDIR="$module${component:+/}$component"
597 use_autogen=1
598 elif [ -f $module${component:+/}$component/meson.build ]; then
599 SRCDIR="$module${component:+/}$component"
600 use_meson=1
601 elif [ X"$CLONE" != X ]; then
602 clone $module $component
603 if [ $? -eq 0 ]; then
604 SRCDIR="$module${component:+/}$component"
605 if [ -f $module${component:+/}$component/autogen.sh ]; then
606 use_autogen=1
607 elif [ -f $module${component:+/}$component/meson.build ]; then
608 use_meson=1
609 else
610 echo "Cannot find autogen.sh or meson.build"
611 return 1
614 else
615 checkfortars $module $component
616 if [ $? -eq 0 ]; then
617 if [ X"$SRCDIR" = X ]; then
618 echo "$module${component:+/}$component does not exist, skipping."
619 nonexistent_components="$nonexistent_components $module${component:+/}$component"
620 return 0
622 use_configure=1
623 else
624 return 1
628 if [ $use_autogen != 0 ]; then
629 CONFCMD="${DIR_CONFIG}/autogen.sh"
630 elif [ $use_configure != 0 ]; then
631 CONFCMD="${DIR_CONFIG}/configure"
632 elif [ $use_meson != 0 ]; then
633 CONFCMD="meson"
634 confopts="$confopts builddir"
637 old_pwd=`pwd`
638 cd $SRCDIR
639 if [ $? -ne 0 ]; then
640 failed cd1 $module $component
641 return 1
644 if [ X"$GITCMD" != X ]; then
645 $GITCMD
646 rtn=$?
647 cd $old_pwd
649 if [ $rtn -ne 0 ]; then
650 failed "$GITCMD" $module $component
651 return 1
653 return 0
656 if [ X"$PULL" != X ]; then
657 git pull --rebase
658 if [ $? -ne 0 ]; then
659 failed "git pull" $module $component
660 cd $old_pwd
661 return 1
663 # The parent module knows which commit the submodule should be at
664 git submodule update
665 if [ $? -ne 0 ]; then
666 failed "git submodule update" $module $component
667 return 1
671 # Build outside source directory
672 if [ X"$DIR_ARCH" != X ] ; then
673 mkdir -p "$DIR_ARCH"
674 if [ $? -ne 0 ]; then
675 failed mkdir $module $component
676 cd $old_pwd
677 return 1
679 cd "$DIR_ARCH"
680 if [ $? -ne 0 ]; then
681 failed cd2 $module $component
682 cd ${old_pwd}
683 return 1
687 # If the builddir already exists, just run ninja, not meson
688 if [ $use_meson != 0 ] && [ -e ${DIR_CONFIG}/builddir ]; then
690 elif [ X"$NOAUTOGEN" = X ]; then
691 ${CONFCMD} \
692 ${PREFIX_USER:+--prefix="$PREFIX"} \
693 ${EPREFIX_USER:+--exec-prefix="$EPREFIX"} \
694 ${BINDIR_USER:+--bindir="$BINDIR"} \
695 ${DATAROOTDIR_USER:+--datarootdir="$DATAROOTDIR"} \
696 ${DATADIR_USER:+--datadir="$DATADIR"} \
697 ${LIBDIR_USER:+--libdir="$LIBDIR"} \
698 ${LOCALSTATEDIR_USER:+--localstatedir="$LOCALSTATEDIR"} \
699 ${QUIET:+--quiet} \
700 ${CONFFLAGS} $confopts
701 if [ $? -ne 0 ]; then
702 failed ${CONFCMD} $module $component
703 cd $old_pwd
704 return 1
706 else
707 echo "build.sh: Skipping autogen/configure"
710 # A custom 'make' target list was supplied through --cmd option
711 # This does not work for ninja atm
712 if [ X"$MAKECMD" != X ]; then
713 ${MAKE} $MAKEFLAGS $MAKECMD
714 rtn=$?
715 cd $old_pwd
717 if [ $rtn -ne 0 ]; then
718 failed "$MAKE $MAKEFLAGS $MAKECMD" $module $component
719 return 1
721 return 0
724 if [ X"$NOMAKE" != X ]; then
725 echo "build.sh: Skipping make targets"
726 cd $old_pwd
727 return 0
731 if [ $use_autogen != 0 ] || [ $use_configure != 0]; then
732 BUILDCMD="${MAKE} $MAKEFLAGS"
733 BUILDCMD_VERBOSE="${BUILDCMD} V=1"
734 BUILDCMD_CHECK="${BUILDCMD} check"
735 BUILDCMD_CLEAN="${BUILDCMD} clean"
736 BUILDCMD_DIST="${BUILDCMD} dist"
737 BUILDCMD_DISTCHECK="${BUILDCMD} distcheck"
738 BUILDCMD_INSTALL="${BUILDCMD} install"
739 else
740 BUILDCMD="ninja -C builddir"
741 BUILDCMD_VERBOSE="${BUILDCMD_VERBOSE} -v"
742 BUILDCMD_CHECK="${BUILDCMD} test"
743 BUILDCMD_CLEAN="${BUILDCMD} clean"
744 BUILDCMD_DIST="${BUILDCMD} dist"
745 BUILDCMD_DISTCHECK="${BUILDCMD} distcheck"
746 BUILDCMD_INSTALL="${BUILDCMD} install"
750 $BUILDCMD
751 if [ $? -ne 0 ]; then
752 # Rerun with Automake silent rules disabled to see failing gcc statement
753 if [ X"$RETRY_VERBOSE" != X ]; then
754 echo ""
755 echo "build.sh: Rebuilding $component with Automake silent rules disabled"
756 $BUILDCMD_VERBOSE
758 failed "$BUILDCMD" $module $component
759 cd $old_pwd
760 return 1
763 if [ X"$CHECK" != X ]; then
764 $BUILDCMD_CHECK
765 if [ $? -ne 0 ]; then
766 failed "$BUILDCMD_CHECK" $module $component
767 cd $old_pwd
768 return 1
772 if [ X"$CLEAN" != X ]; then
773 $BUILDCMD_CLEAN
774 if [ $? -ne 0 ]; then
775 failed "$BUILDCMD_CLEAN" $module $component
776 cd $old_pwd
777 return 1
781 if [ X"$DIST" != X ]; then
782 $BUILDCMD_DIST
783 if [ $? -ne 0 ]; then
784 failed "$BUILDCMD_DIST" $module $component
785 cd $old_pwd
786 return 1
790 if [ X"$DISTCHECK" != X ]; then
791 $BUILDCMD_DISTCHECK
792 if [ $? -ne 0 ]; then
793 failed "$BUILDCMD_DISTCHECK" $module $component
794 cd $old_pwd
795 return 1
799 $SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH $BUILDCMD_INSTALL
800 if [ $? -ne 0 ]; then
801 failed "$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH $BUILDCMD_INSTALL" $module $component
802 cd $old_pwd
803 return 1
806 cd ${old_pwd}
808 return 0
811 # process each module/component and handle:
812 # LISTONLY, RESUME, NOQUIT, and BUILD_ONE
813 # arguments:
814 # $1 - module
815 # $2 - component
816 # $3 - configure options
817 # returns:
818 # 0 - good
819 # 1 - bad
820 build() {
821 module=$1
822 component=$2
823 confopts="$3"
824 if [ X"$LISTONLY" != X ]; then
825 echo "$module${component:+/}$component"
826 return 0
829 if [ X"$RESUME" != X ]; then
830 if [ X"$RESUME" = X"$module${component:+/}$component" ]; then
831 unset RESUME
832 # Resume build at this module
833 else
834 echo "Skipping $module${component:+/}$component..."
835 return 0
839 process $module "$component" "$confopts"
840 process_rtn=$?
841 if [ X"$BUILT_MODULES_FILE" != X ]; then
842 if [ $process_rtn -ne 0 ]; then
843 echo "FAIL: $module${component:+/}$component" >> $BUILT_MODULES_FILE
844 else
845 echo "PASS: $module${component:+/}$component" >> $BUILT_MODULES_FILE
849 if [ $process_rtn -ne 0 ]; then
850 echo "build.sh: error processing: \"$module${component:+/}$component\""
851 if [ X"$NOQUIT" = X ]; then
852 exit 1
854 return $process_rtn
857 if [ X"$BUILD_ONE" != X ]; then
858 echo "Single-component build complete"
859 exit 0
864 # just process the sub-projects supplied in the given file ($MODFILE)
865 # in the order in which they are found in the list
866 # (prerequisites and ordering are the responsibility of the user)
867 # globals used:
868 # $MODFILE - readable file containing list of modules to process
869 # and their optional configuration options
870 # arguments:
871 # (none)
872 # returns:
873 # 0 - good
874 # 1 - bad
875 process_module_file() {
876 # preconds
877 if [ X"$MODFILE" = X ]; then
878 echo "internal process_module_file() error, \$MODFILE is empty"
879 return 1
881 if [ ! -r "$MODFILE" ]; then
882 echo "module file '$MODFILE' is not readable or does not exist"
883 return 1
886 # read from input file, skipping blank and comment lines
887 while read line; do
888 # skip blank lines
889 if [ X"$line" = X ]; then
890 continue
893 # skip comment lines
894 echo "$line" | grep "^#" > /dev/null
895 if [ $? -eq 0 ]; then
896 continue
899 # parse each line to extract module, component and options name
900 field1=`echo $line | cut -d' ' -f1`
901 module=`echo $field1 | cut -d'/' -f1`
902 component=`echo $field1 | cut -d'/' -s -f2`
903 confopts=`echo $line | cut -d' ' -s -f2-`
905 build $module "$component" "$confopts"
907 done <"$MODFILE"
909 return 0
912 usage() {
913 basename="`expr "//$0" : '.*/\([^/]*\)'`"
914 echo "Usage: $basename [options] [prefix]"
915 echo "Options:"
916 echo " -a Do NOT run auto config tools (autogen.sh, configure)"
917 echo " -b Use .build.unknown build directory"
918 echo " -c Run make clean in addition to \"all install\""
919 echo " -D Run make dist in addition to \"all install\""
920 echo " -d Run make distcheck in addition \"all install\""
921 echo " -g Compile and link with debug information"
922 echo " -h, --help Display this help and exit successfully"
923 echo " -m Do NOT run any of the make targets"
924 echo " -n Do not quit after error; just print error message"
925 echo " -o module/component"
926 echo " Build just this module/component"
927 echo " -p Update source code before building (git pull --rebase)"
928 echo " -s sudo The command name providing superuser privilege"
929 echo " --autoresume resumefile"
930 echo " Append module being built to, and autoresume from, <file>"
931 echo " --check Run make check in addition \"all install\""
932 echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
933 echo " --cmd command"
934 echo " Execute arbitrary git, gmake, or make command"
935 echo " --confflags options"
936 echo " Pass options to autogen.sh/configure of all modules"
937 echo " --modfile modulefile"
938 echo " Only process the module/components specified in modulefile"
939 echo " Any text after, and on the same line as, the module/component"
940 echo " is assumed to be configuration options for the configuration"
941 echo " of each module/component specifically"
942 echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
943 echo ""
944 echo "Usage: $basename -L"
945 echo " -L Just list modules to build"
946 echo ""
947 envoptions
950 # Ensure the named variable value contains a full path name
951 # arguments:
952 # $1 - the variable value (the path to examine)
953 # $2 - the name of the variable
954 # returns:
955 # returns nothing or exit on error with message
956 check_full_path () {
957 path=$1
958 varname=$2
959 if [ X"`expr $path : "\(.\)"`" != X/ ]; then
960 echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
961 echo ""
962 usage
963 exit 1
967 # Ensure the named variable value contains a writable directory
968 # arguments:
969 # $1 - the variable value (the path to examine)
970 # $2 - the name of the variable
971 # returns:
972 # returns nothing or exit on error with message
973 check_writable_dir () {
974 path=$1
975 varname=$2
976 if [ X"$SUDO" = X ]; then
977 if [ ! -d "$path" ] || [ ! -w "$path" ]; then
978 echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
979 echo ""
980 usage
981 exit 1
986 # perform sanity checks on cmdline args which require arguments
987 # arguments:
988 # $1 - the option being examined
989 # $2 - the argument to the option
990 # returns:
991 # if it returns, everything is good
992 # otherwise it exit's
993 required_arg() {
994 option=$1
995 arg=$2
996 # preconds
997 if [ X"$option" = X ]; then
998 echo "internal required_arg() error, missing first argument"
999 exit 1
1002 # check for an argument
1003 if [ X"$arg" = X ]; then
1004 echo "the '$option' option is missing its required argument"
1005 echo ""
1006 usage
1007 exit 1
1010 # does the argument look like an option?
1011 echo $arg | grep "^-" > /dev/null
1012 if [ $? -eq 0 ]; then
1013 echo "the argument '$arg' of option '$option' looks like an option itself"
1014 echo ""
1015 usage
1016 exit 1
1020 #==============================================================================
1021 # Build All Modules
1022 # Globals:
1023 # HOST_OS HOST_CPU
1024 # Arguments:
1025 # None
1026 # Returns:
1027 # None
1028 #==============================================================================
1029 build_all_modules() {
1031 build util macros
1032 build font util
1033 build doc xorg-sgml-doctools
1034 build doc xorg-docs
1035 case $HOST_OS in
1036 Darwin) build proto applewmproto;;
1037 CYGWIN*) build proto windowswmproto;;
1038 esac
1039 build proto bigreqsproto
1040 build proto compositeproto
1041 build proto damageproto
1042 build proto dmxproto
1043 build proto dri2proto
1044 build proto dri3proto
1045 build proto fixesproto
1046 build proto fontsproto
1047 build proto glproto
1048 build proto inputproto
1049 build proto kbproto
1050 build proto presentproto
1051 build proto randrproto
1052 build proto recordproto
1053 build proto renderproto
1054 build proto resourceproto
1055 build proto scrnsaverproto
1056 build proto videoproto
1057 build proto x11proto
1058 build proto xcmiscproto
1059 build proto xextproto
1060 build proto xf86bigfontproto
1061 build proto xf86dgaproto
1062 build proto xf86driproto
1063 build proto xf86vidmodeproto
1064 build proto xineramaproto
1065 build xcb proto
1066 # Required by mesa and depends on xproto
1067 build util makedepend
1068 build lib libxtrans
1069 build lib libXau
1070 build lib libXdmcp
1071 build xcb pthread-stubs
1072 build xcb libxcb
1073 build xcb util
1074 build xcb util-image
1075 build xcb util-keysyms
1076 build xcb util-renderutil
1077 build xcb util-wm
1078 build lib libX11
1079 build lib libXext
1080 case $HOST_OS in
1081 Darwin) build lib libAppleWM;;
1082 CYGWIN*) build lib libWindowsWM;;
1083 esac
1084 build lib libdmx
1085 build lib libfontenc
1086 build lib libFS
1087 build lib libICE
1088 build lib libSM
1089 build lib libXt
1090 build lib libXmu
1091 build lib libXpm
1092 build lib libXaw
1093 build lib libXaw3d
1094 build lib libXfixes
1095 build lib libXcomposite
1096 build lib libXrender
1097 build lib libXdamage
1098 build lib libXcursor
1099 build lib libXfont
1100 build lib libXft
1101 build lib libXi
1102 build lib libXinerama
1103 build lib libxkbfile
1104 build lib libXrandr
1105 build lib libXRes
1106 build lib libXScrnSaver
1107 case $HOST_OS in
1108 Linux)
1109 build lib libxshmfence
1111 esac
1112 build lib libXtst
1113 build lib libXv
1114 build lib libXvMC
1115 build lib libXxf86dga
1116 build lib libXxf86vm
1117 build lib libpciaccess
1118 build pixman ""
1119 build mesa drm
1120 build mesa mesa
1121 build data bitmaps
1122 build app appres
1123 build app bdftopcf
1124 build app beforelight
1125 build app bitmap
1126 build app editres
1127 build app fonttosfnt
1128 build app fslsfonts
1129 build app fstobdf
1130 build app iceauth
1131 build app ico
1132 build app listres
1133 build app luit
1134 build app mkcomposecache
1135 build app mkfontdir
1136 build app mkfontscale
1137 build app oclock
1138 build app rgb
1139 build app rendercheck
1140 build app rstart
1141 build app scripts
1142 build app sessreg
1143 build app setxkbmap
1144 build app showfont
1145 build app smproxy
1146 build app twm
1147 build app viewres
1148 build app x11perf
1149 build app xauth
1150 build app xbacklight
1151 build app xbiff
1152 build app xcalc
1153 build app xclipboard
1154 build app xclock
1155 build app xcmsdb
1156 build app xconsole
1157 build app xcursorgen
1158 build app xdbedizzy
1159 build app xditview
1160 build app xdm
1161 build app xdpyinfo
1162 build app xdriinfo
1163 build app xedit
1164 build app xev
1165 build app xeyes
1166 build app xf86dga
1167 build app xfd
1168 build app xfontsel
1169 build app xfs
1170 build app xfsinfo
1171 build app xgamma
1172 build app xgc
1173 build app xhost
1174 build app xinit
1175 build app xinput
1176 build app xkbcomp
1177 build app xkbevd
1178 build app xkbprint
1179 build app xkbutils
1180 build app xkill
1181 build app xload
1182 build app xlogo
1183 build app xlsatoms
1184 build app xlsclients
1185 build app xlsfonts
1186 build app xmag
1187 build app xman
1188 build app xmessage
1189 build app xmh
1190 build app xmodmap
1191 build app xmore
1192 build app xpr
1193 build app xprop
1194 build app xrandr
1195 build app xrdb
1196 build app xrefresh
1197 build app xscope
1198 build app xset
1199 build app xsetmode
1200 build app xsetroot
1201 build app xsm
1202 build app xstdcmap
1203 build app xvidtune
1204 build app xvinfo
1205 build app xwd
1206 build app xwininfo
1207 build app xwud
1208 build xserver ""
1209 case $HOST_OS in
1210 Linux)
1211 build libevdev ""
1212 build libinput ""
1214 esac
1215 case $HOST_OS in
1216 Linux)
1217 build driver xf86-input-evdev
1218 build driver xf86-input-joystick
1219 build driver xf86-input-libinput
1221 FreeBSD | NetBSD | OpenBSD | Dragonfly | GNU/kFreeBSD)
1222 build driver xf86-input-joystick
1224 esac
1225 case $HOST_CPU in
1226 i*86 | amd64 | x86_64 | i86pc)
1227 build driver xf86-input-vmmouse
1229 esac
1230 case $HOST_OS in
1231 Darwin)
1234 build driver xf86-input-keyboard
1235 build driver xf86-input-mouse
1236 build driver xf86-input-synaptics
1237 build driver xf86-input-void
1238 case $HOST_OS in
1239 FreeBSD)
1240 case $HOST_CPU in
1241 sparc64)
1242 build driver xf86-video-sunffb
1244 esac
1246 NetBSD | OpenBSD)
1247 build driver xf86-video-wsfb
1248 build driver xf86-video-sunffb
1250 Linux)
1251 build driver xf86-video-sisusb
1252 build driver xf86-video-sunffb
1253 build driver xf86-video-v4l
1254 build driver xf86-video-xgixp
1255 case $HOST_CPU in
1256 i*86)
1257 # AMD Geode CPU. Driver contains 32 bit assembler code
1258 build driver xf86-video-geode
1260 esac
1262 esac
1263 case $HOST_CPU in
1264 sparc | sparc64)
1265 build driver xf86-video-suncg14
1266 build driver xf86-video-suncg3
1267 build driver xf86-video-suncg6
1268 build driver xf86-video-sunleo
1269 build driver xf86-video-suntcx
1271 i*86 | amd64 | x86_64 | i86pc)
1272 build driver xf86-video-i740
1273 build driver xf86-video-intel
1275 esac
1276 build driver xf86-video-amdgpu
1277 build driver xf86-video-apm
1278 build driver xf86-video-ark
1279 build driver xf86-video-ast
1280 build driver xf86-video-ati
1281 build driver xf86-video-chips
1282 build driver xf86-video-cirrus
1283 build driver xf86-video-dummy
1284 build driver xf86-video-fbdev
1285 build driver xf86-video-glint
1286 build driver xf86-video-i128
1287 build driver xf86-video-mach64
1288 build driver xf86-video-mga
1289 build driver xf86-video-neomagic
1290 build driver xf86-video-nested
1291 build driver xf86-video-nv
1292 build driver xf86-video-rendition
1293 build driver xf86-video-r128
1294 build driver xf86-video-s3
1295 build driver xf86-video-s3virge
1296 build driver xf86-video-savage
1297 build driver xf86-video-siliconmotion
1298 build driver xf86-video-sis
1299 build driver xf86-video-tdfx
1300 build driver xf86-video-tga
1301 build driver xf86-video-trident
1302 build driver xf86-video-tseng
1303 build driver xf86-video-vesa
1304 build driver xf86-video-vmware
1305 build driver xf86-video-voodoo
1307 esac
1308 build data cursors
1309 build font encodings
1310 build font adobe-100dpi
1311 build font adobe-75dpi
1312 build font adobe-utopia-100dpi
1313 build font adobe-utopia-75dpi
1314 build font adobe-utopia-type1
1315 build font arabic-misc
1316 build font bh-100dpi
1317 build font bh-75dpi
1318 build font bh-lucidatypewriter-100dpi
1319 build font bh-lucidatypewriter-75dpi
1320 build font bh-ttf
1321 build font bh-type1
1322 build font bitstream-100dpi
1323 build font bitstream-75dpi
1324 build font bitstream-type1
1325 build font cronyx-cyrillic
1326 build font cursor-misc
1327 build font daewoo-misc
1328 build font dec-misc
1329 build font ibm-type1
1330 build font isas-misc
1331 build font jis-misc
1332 build font micro-misc
1333 build font misc-cyrillic
1334 build font misc-ethiopic
1335 build font misc-meltho
1336 build font misc-misc
1337 build font mutt-misc
1338 build font schumacher-misc
1339 build font screen-cyrillic
1340 build font sony-misc
1341 build font sun-misc
1342 build font winitzki-cyrillic
1343 build font xfree86-type1
1344 build font alias
1345 build util cf
1346 build util imake
1347 build util gccmakedep
1348 build util lndir
1349 build xkeyboard-config ""
1350 return 0
1354 #------------------------------------------------------------------------------
1355 # Script main line
1356 #------------------------------------------------------------------------------
1358 # Initialize variables controlling end of run reports
1359 failed_components=""
1360 nonexistent_components=""
1361 clonefailed_components=""
1363 # Set variables supporting multiple binaries for a single source tree
1364 HAVE_ARCH="`uname -i`"
1365 DIR_ARCH=""
1366 DIR_CONFIG="."
1368 # Set variables for conditionally building some components
1369 HOST_OS=`uname -s`
1370 export HOST_OS
1371 HOST_CPU=`uname -m`
1372 export HOST_CPU
1374 # Process command line args
1375 while [ $# != 0 ]
1377 case $1 in
1379 NOAUTOGEN=1
1382 DIR_ARCH=".build.$HAVE_ARCH"
1383 DIR_CONFIG=".."
1386 CLEAN=1
1389 DIST=1
1392 DISTCHECK=1
1395 CFLAGS="${CFLAGS} -g3 -O0"
1396 export CFLAGS
1398 -h|--help)
1399 usage
1400 exit 0
1403 LISTONLY=1
1406 NOMAKE=1
1409 NOQUIT=1
1412 if [ -n "$BUILT_MODULES_FILE" ]; then
1413 echo "The '-o' and '--autoresume' options are mutually exclusive."
1414 usage
1415 exit 1
1417 required_arg $1 $2
1418 shift
1419 RESUME=`echo $1 | sed "s,/$,,"`
1420 BUILD_ONE=1
1423 PULL=1
1426 required_arg $1 $2
1427 shift
1428 SUDO=$1
1430 --autoresume)
1431 if [ -n "$BUILD_ONE" ]; then
1432 echo "The '-o' and '--autoresume' options are mutually exclusive."
1433 usage
1434 exit 1
1436 required_arg $1 $2
1437 shift
1438 BUILT_MODULES_FILE=$1
1440 --check)
1441 CHECK=1
1443 --clone)
1444 CLONE=1
1446 --cmd)
1447 required_arg $1 $2
1448 shift
1449 cmd1=`echo $1 | cut -d' ' -f1`
1450 cmd2=`echo $1 | cut -d' ' -f2`
1452 # verify the command exists
1453 which $cmd1 > /dev/null 2>&1
1454 if [ $? -ne 0 ]; then
1455 echo "The specified command '$cmd1' does not appear to exist"
1456 echo ""
1457 usage
1458 exit 1
1461 case X"$cmd1" in
1462 X"git")
1463 GITCMD=$1
1465 X"make" | X"gmake")
1466 MAKECMD=$cmd2
1469 echo "The script can only process 'make', 'gmake', or 'git' commands"
1470 echo "It can't process '$cmd1' commands"
1471 echo ""
1472 usage
1473 exit 1
1475 esac
1477 --confflags)
1478 shift
1479 CONFFLAGS=$1
1481 --modfile)
1482 required_arg $1 $2
1483 shift
1484 if [ ! -r "$1" ]; then
1485 echo "can't find/read file '$1'"
1486 exit 1
1488 MODFILE=$1
1490 --retry-v1)
1491 RETRY_VERBOSE=1
1494 if [ X"$too_many" = Xyes ]; then
1495 echo "unrecognized and/or too many command-line arguments"
1496 echo " PREFIX: $PREFIX"
1497 echo " Extra arguments: $1"
1498 echo ""
1499 usage
1500 exit 1
1503 # check that 'prefix' doesn't look like an option
1504 echo $1 | grep "^-" > /dev/null
1505 if [ $? -eq 0 ]; then
1506 echo "'prefix' appears to be an option"
1507 echo ""
1508 usage
1509 exit 1
1512 PREFIX=$1
1513 too_many=yes
1515 esac
1517 shift
1518 done
1520 # All user input has been obtained, set-up the user shell variables
1521 if [ X"$LISTONLY" = X ]; then
1522 setup_buildenv
1523 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
1524 date
1527 # if there is a BUILT_MODULES_FILE
1528 # then start off by checking for and trying to build any modules which failed
1529 # and aren't the last line
1530 if [ X"$BUILT_MODULES_FILE" != X -a -r "$BUILT_MODULES_FILE" ]; then
1531 built_lines=`cat $BUILT_MODULES_FILE | wc -l | sed 's:^ *::'`
1532 built_lines_m1=`expr $built_lines - 1`
1533 orig_BUILT_MODULES_FILE=$BUILT_MODULES_FILE
1534 unset BUILT_MODULES_FILE
1535 curline=1
1536 while read line; do
1537 built_status=`echo $line | cut -c-6`
1538 if [ X"$built_status" = X"FAIL: " ]; then
1539 line=`echo $line | cut -c7-`
1540 field1=`echo $line | cut -d' ' -f1`
1541 module=`echo $field1 | cut -d'/' -f1`
1542 component=`echo $field1 | cut -d'/' -s -f2`
1543 confopts=`echo $line | cut -d' ' -s -f2-`
1545 build_ret=""
1547 # quick check for the module in $MODFILE (if present)
1548 if [ X"$MODFILE" = X ]; then
1549 build $module "$component" "$confopts"
1550 if [ $? -eq 0 ]; then
1551 build_ret="PASS"
1553 else
1554 cat $MODFILE | grep "$module${component:+/}$component" > /dev/null
1555 if [ $? -eq 0 ]; then
1556 build $module "$component" "$confopts"
1557 if [ $? -eq 0 ]; then
1558 build_ret="PASS"
1563 if [ X"$build_ret" = X"PASS" ]; then
1564 built_temp=`mktemp`
1565 if [ $? -ne 0 ]; then
1566 echo "can't create tmp file, $orig_BUILT_MODULES_FILE not modified"
1567 else
1568 head -n `expr $curline - 1` $orig_BUILT_MODULES_FILE > $built_temp
1569 echo "PASS: $module${component:+/}$component" >> $built_temp
1570 tail -n `expr $built_lines - $curline` $orig_BUILT_MODULES_FILE >> $built_temp
1571 mv $built_temp $orig_BUILT_MODULES_FILE
1575 if [ $curline -eq $built_lines_m1 ]; then
1576 break
1578 curline=`expr $curline + 1`
1579 done <"$orig_BUILT_MODULES_FILE"
1581 BUILT_MODULES_FILE=$orig_BUILT_MODULES_FILE
1582 RESUME=`tail -n 1 $BUILT_MODULES_FILE | cut -c7-`
1584 # remove last line of $BUILT_MODULES_FILE
1585 # to avoid a duplicate entry
1586 built_temp=`mktemp`
1587 if [ $? -ne 0 ]; then
1588 echo "can't create tmp file, last built item will be duplicated"
1589 else
1590 head -n $built_lines_m1 $BUILT_MODULES_FILE > $built_temp
1591 mv $built_temp $BUILT_MODULES_FILE
1595 if [ X"$MODFILE" = X ]; then
1596 build_all_modules
1597 else
1598 process_module_file
1601 if [ X"$LISTONLY" != X ]; then
1602 exit 0
1605 # Print the end date/time to compare with the start date/time
1606 date
1608 # Report about components that failed for one reason or another
1609 if [ X"$nonexistent_components" != X ]; then
1610 echo ""
1611 echo "***** Skipped components (not available) *****"
1612 echo "Could neither find a git repository (at the <module/component> paths)"
1613 echo "or a tarball (at the <module/> paths or ./) for:"
1614 echo " <module/component>"
1615 for mod in $nonexistent_components; do
1616 echo " $mod"
1617 done
1618 echo "You may want to provide the --clone option to build.sh"
1619 echo "to automatically git-clone the missing components"
1620 echo ""
1623 if [ X"$failed_components" != X ]; then
1624 echo ""
1625 echo "***** Failed components *****"
1626 for mod in $failed_components; do
1627 echo " $mod"
1628 done
1629 echo ""
1632 if [ X"$CLONE" != X ] && [ X"$clonefailed_components" != X ]; then
1633 echo ""
1634 echo "***** Components failed to clone *****"
1635 for mod in $clonefailed_components; do
1636 echo " $mod"
1637 done
1638 echo ""