2 # ===========================================================================
5 # build.sh - extract, configure, build and install the X Window System
8 # build.sh [options] [prefix]
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.
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
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.
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
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)
91 # Execute arbitrary git, gmake, or make command
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
102 # An absolute filename where GNU "make" will install binaries, libraries and
103 # other installable files. The value is passed to Autoconf through the
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.
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.#
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
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 [https://gitlab.freedesktop.org/]
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>
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:
165 # List directories that the linker searches for shared objects
166 # $DESTDIR/$LIBDIR is prepended
168 # Environment variables defined by the pkg-config system:
171 # List directories that pkg-config searches for libraries
172 # $DESTDIR/$DATADIR/pkgconfig and
173 # $DESTDIR/$LIBDIR/pkgconfig are prepended
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 # ===========================================================================
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
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 GITCLONEOPTS Options passed to git clone.
204 Optional when using --clone to update source code before building
205 CONFFLAGS Configure options to pass to all Autoconf configure scripts
206 Refer to 'configure --help' from any module/components
208 Environment variables defined by the GNU Build System:
209 ACLOCAL The aclocal cmd name [aclocal -I \${DESTDIR}/\${DATADIR}/aclocal]
210 DESTDIR Path to the staging area where installed objects are relocated
211 MAKE The name of the make command [make]
212 MAKEFLAGS Options to pass to all \$(MAKE) invocations
213 CC C compiler command
214 CFLAGS C compiler flags
215 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
216 nonstandard directory <lib dir>
217 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
218 you have headers in a nonstandard directory <include dir>
221 Environment variables defined by the shell:
222 PATH List of directories that the shell searches for commands
223 \$DESTDIR/\$BINDIR is prepended
225 Environment variables defined by the dynamic linker:
227 List directories that the linker searches for shared objects
228 \$DESTDIR/\$LIBDIR is prepended
230 Environment variables defined by the pkg-config system:
232 List directories that pkg-config searches for libraries
233 \$DESTDIR/\$DATADIR/pkgconfig and
234 \$DESTDIR/\$LIBDIR/pkgconfig are prepended
240 # Remember if the user had supplied a value through env var or cmd line
241 # A value from cmd line takes precedence of the shell environment
242 PREFIX_USER
=${PREFIX:+yes}
243 EPREFIX_USER
=${EPREFIX:+yes}
244 BINDIR_USER
=${BINDIR:+yes}
245 DATAROOTDIR_USER
=${DATAROOTDIR:+yes}
246 DATADIR_USER
=${DATADIR:+yes}
247 LIBDIR_USER
=${LIBDIR:+yes}
248 LOCALSTATEDIR_USER
=${LOCALSTATEDIR:+yes}
250 # Assign a default value if no value was supplied by the user
251 PREFIX
=${PREFIX:-/usr/local}
252 EPREFIX
=${EPREFIX:-$PREFIX}
253 BINDIR
=${BINDIR:-$EPREFIX/bin}
254 DATAROOTDIR
=${DATAROOTDIR:-$PREFIX/share}
255 DATADIR
=${DATADIR:-$DATAROOTDIR}
256 LIBDIR
=${LIBDIR:-$EPREFIX/lib}
257 LOCALSTATEDIR
=${LOCALSTATEDIR:-$PREFIX/var}
259 # Support previous usage of LIBDIR which was a subdir relative to PREFIX
260 # We use EPREFIX as this is what PREFIX really meant at the time
261 if [ X
"$LIBDIR" != X
]; then
262 if [ X
"`expr $LIBDIR : "\
(.\
)"`" != X
/ ]; then
264 echo "Warning: this usage of \$LIBDIR is deprecated. Use a full path name."
265 echo "The supplied value \"$LIBDIR\" has been replaced with $EPREFIX/$LIBDIR."
267 LIBDIR
=$EPREFIX/$LIBDIR
271 # All directories variables must be full path names
272 check_full_path
$PREFIX PREFIX
273 check_full_path
$EPREFIX EPREFIX
274 check_full_path
$BINDIR BINDIR
275 check_full_path
$DATAROOTDIR DATAROOTDIR
276 check_full_path
$DATADIR DATADIR
277 check_full_path
$LIBDIR LIBDIR
278 check_full_path
$LOCALSTATEDIR LOCALSTATEDIR
280 # This will catch the case where user forgets to set PREFIX
281 # and does not have write permission in the /usr/local default location
282 check_writable_dir
${DESTDIR}${PREFIX} PREFIX
284 # Must create local aclocal dir or aclocal fails
285 ACLOCAL_LOCALDIR
="${DESTDIR}${DATADIR}/aclocal"
286 $SUDO mkdir
-p ${ACLOCAL_LOCALDIR}
288 # The following is required to make aclocal find our .m4 macros
289 ACLOCAL
=${ACLOCAL:="aclocal"}
290 ACLOCAL
="${ACLOCAL} -I ${ACLOCAL_LOCALDIR}"
293 # The following is required to make pkg-config find our .pc metadata files
294 PKG_CONFIG_PATH
=${DESTDIR}${DATADIR}/pkgconfig:${DESTDIR}${LIBDIR}/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}
295 export PKG_CONFIG_PATH
297 # Set the library path so that locally built libs will be found by apps
298 LD_LIBRARY_PATH
=${DESTDIR}${LIBDIR}${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
299 export LD_LIBRARY_PATH
301 # Set the path so that locally built apps will be found and used
302 PATH
=${DESTDIR}${BINDIR}${PATH+:$PATH}
305 # Choose which make program to use
308 # Create the log file directory
309 $SUDO mkdir
-p ${DESTDIR}${LOCALSTATEDIR}/log
312 # explain where a failure occurred
313 # if you find this message in the build output it can help tell you where the failure occurred
315 # $1 - which command failed
324 echo "build.sh: \"$cmd\" failed on $module${component:+/}$component"
325 failed_components
="$failed_components $module${component:+/}$component"
328 # print a pretty title to separate the processing of each module
332 # $3 - configuration options
340 if [ X
"$module" = X
]; then
345 echo "======================================================================"
346 echo "== Processing: \"$module${component:+/}$component\""
347 echo "== configuration options: $CONFFLAGS $confopts"
350 # Search for tarballs in either cwd or under a module directory
351 # The tarball is always extracted in either one of these locations:
352 # - modules with components: under the module subdir (e.g lib/libX11-1.4.0)
353 # - modules without components: under cwd (e.g xserver-1.14.0)
354 # The tarballs are expected to be under one of the locations described above
355 # The location of the tarball does not dictate where it is extracted
360 # 0 - good (either no tarballs or successful extract)
366 # The package stem is the part of the tar file name that identifies
367 # the git module archived source. Ex: xclock, pixman, libX11
368 # For modules without components, the module name is used by default.
369 pkg_stem
=${component:-$module}
371 # Handle special cases where the module or component directory
372 # does not match the package name and/or the package root dir
376 "cursors") pkg_stem
="xcursor-themes" ;;
377 "bitmaps") pkg_stem
="xbitmaps" ;;
381 if [ X
"$component" != X
"encodings" ]; then
382 pkg_stem
="font-$component"
387 "libXRes") pkg_stem
="libXres" ;;
388 "libxtrans") pkg_stem
="xtrans" ;;
393 "x11proto") pkg_stem
="xproto" ;;
398 "cf") pkg_stem
="xorg-cf-files" ;;
399 "macros") pkg_stem
="util-macros" ;;
408 pkg_stem
="libpthread-stubs"
414 pkg_stem
="xcb-$component"
429 pkg_stem
="xorg-server"
433 # Search for tarballs in both the module and the src top directory
434 for ii
in $module .
; do
435 for jj
in bz2 gz xz
; do
437 # Select from the list the last tarball with a specific pkg_stem
438 pkg_tarfile
=`ls -1rt $ii/$pkg_stem-[0-9]*.tar.$jj 2> /dev/null | tail -n 1`
440 # Extract the tarball under the module directory
441 # For modules without components, extract in top level dir
442 if [ X
"$pkg_tarfile" != X
]; then
444 # Get the package version and archived toplevel directory
445 pkg_version
=`echo $pkg_tarfile | sed 's,.*'$pkg_stem'-\(.*\)\.tar\.'$jj',\1,'`
446 pkg_root_dir
="$pkg_stem-$pkg_version"
447 pkg_root_dir
=`echo $pkg_root_dir | sed 's,MesaLib,Mesa,'`
449 # Find where to extract the tar file
451 if [ X
"$component" = X
]; then
452 # For modules with no components (i.e xserver)
456 # For modules with components (i.e xcb/proto or lib/libXi)
457 pkg_extract_dir
=$module
458 SRCDIR
=$module/$pkg_root_dir
461 if [ ! -d $SRCDIR ]; then
474 tar $pkg_tar_opts $pkg_tarfile -C $pkg_extract_dir
475 if [ $?
-ne 0 ]; then
477 echo "Unable to extract $pkg_tarfile for $module module"
478 failed
tar $module $component
490 # perform a clone of a git repository
491 # this function provides the mapping between module/component names
492 # and their location in the fd.o repository
495 # $2 - component (optional)
503 if [ X
"$module" = X
]; then
504 echo "clone() required first argument is missing"
532 DIR
="$module${component:+/}$component"
533 GITROOT
=${GITROOT:="https://gitlab.freedesktop.org/"}
535 if [ ! -d "$DIR" ]; then
536 git clone
$GITCLONEOPTS "$GITROOT/$BASEDIR$DIR" "$DIR"
537 if [ $?
-ne 0 ]; then
538 echo "Failed to clone $module${component:+/}$component. Ignoring."
539 clonefailed_components
="$clonefailed_components $module${component:+/}$component"
544 if [ $?
-ne 0 ]; then
545 echo "Failed to cd to $module${component:+/}$component. Ignoring."
546 clonefailed_components
="$clonefailed_components $module${component:+/}$component"
551 if [ $?
-ne 0 ]; then
552 echo "Failed to initialize $module${component:+/}$component submodule. Ignoring."
553 clonefailed_components
="$clonefailed_components $module${component:+/}$component"
557 if [ $?
-ne 0 ]; then
558 echo "Failed to update $module${component:+/}$component submodule. Ignoring."
559 clonefailed_components
="$clonefailed_components $module${component:+/}$component"
564 echo "git cannot clone into an existing directory $module${component:+/}$component"
571 # perform processing of each module/component
575 # $3 - configure options
584 if [ X
"$module" = X
]; then
585 echo "process() required first argument is missing"
589 module_title
$module "$component" "$confopts"
592 local use_configure
=0
597 if [ -f $module${component:+/}$component/autogen.sh
]; then
598 SRCDIR
="$module${component:+/}$component"
600 elif [ -f $module${component:+/}$component/meson.build
]; then
601 SRCDIR
="$module${component:+/}$component"
603 elif [ X
"$CLONE" != X
]; then
604 clone
$module $component
605 if [ $?
-eq 0 ]; then
606 SRCDIR
="$module${component:+/}$component"
607 if [ -f $module${component:+/}$component/autogen.sh
]; then
609 elif [ -f $module${component:+/}$component/meson.build
]; then
612 echo "Cannot find autogen.sh or meson.build"
617 checkfortars
$module $component
618 if [ $?
-eq 0 ]; then
619 if [ X
"$SRCDIR" = X
]; then
620 echo "$module${component:+/}$component does not exist, skipping."
621 nonexistent_components
="$nonexistent_components $module${component:+/}$component"
630 if [ $use_autogen != 0 ]; then
631 CONFCMD
="${DIR_CONFIG}/autogen.sh"
632 elif [ $use_configure != 0 ]; then
633 CONFCMD
="${DIR_CONFIG}/configure"
634 elif [ $use_meson != 0 ]; then
636 confopts
="$confopts builddir"
641 if [ $?
-ne 0 ]; then
642 failed cd1
$module $component
646 if [ X
"$GITCMD" != X
]; then
651 if [ $rtn -ne 0 ]; then
652 failed
"$GITCMD" $module $component
658 if [ X
"$PULL" != X
]; then
660 if [ $?
-ne 0 ]; then
661 failed
"git pull" $module $component
665 # The parent module knows which commit the submodule should be at
667 if [ $?
-ne 0 ]; then
668 failed
"git submodule update" $module $component
673 # Build outside source directory
674 if [ X
"$DIR_ARCH" != X
] ; then
676 if [ $?
-ne 0 ]; then
677 failed mkdir
$module $component
682 if [ $?
-ne 0 ]; then
683 failed cd2
$module $component
689 # If the builddir already exists, just run ninja, not meson
690 if [ $use_meson != 0 ] && [ -e ${DIR_CONFIG}/builddir
]; then
692 elif [ X
"$NOAUTOGEN" = X
]; then
694 ${PREFIX_USER:+--prefix="$PREFIX"} \
695 ${EPREFIX_USER:+--exec-prefix="$EPREFIX"} \
696 ${BINDIR_USER:+--bindir="$BINDIR"} \
697 ${DATAROOTDIR_USER:+--datarootdir="$DATAROOTDIR"} \
698 ${DATADIR_USER:+--datadir="$DATADIR"} \
699 ${LIBDIR_USER:+--libdir="$LIBDIR"} \
700 ${LOCALSTATEDIR_USER:+--localstatedir="$LOCALSTATEDIR"} \
702 ${CONFFLAGS} $confopts
703 if [ $?
-ne 0 ]; then
704 failed
${CONFCMD} $module $component
709 echo "build.sh: Skipping autogen/configure"
712 # A custom 'make' target list was supplied through --cmd option
713 # This does not work for ninja atm
714 if [ X
"$MAKECMD" != X
]; then
715 ${MAKE} $MAKEFLAGS $MAKECMD
719 if [ $rtn -ne 0 ]; then
720 failed
"$MAKE $MAKEFLAGS $MAKECMD" $module $component
726 if [ X
"$NOMAKE" != X
]; then
727 echo "build.sh: Skipping make targets"
733 if [ $use_autogen != 0 ] ||
[ $use_configure != 0 ]; then
734 BUILDCMD
="${MAKE} $MAKEFLAGS"
735 BUILDCMD_VERBOSE
="${BUILDCMD} V=1"
736 BUILDCMD_CHECK
="${BUILDCMD} check"
737 BUILDCMD_CLEAN
="${BUILDCMD} clean"
738 BUILDCMD_DIST
="${BUILDCMD} dist"
739 BUILDCMD_DISTCHECK
="${BUILDCMD} distcheck"
740 BUILDCMD_INSTALL
="${BUILDCMD} install"
742 BUILDCMD
="ninja -C builddir"
743 BUILDCMD_VERBOSE
="${BUILDCMD_VERBOSE} -v"
744 BUILDCMD_CHECK
="${BUILDCMD} test"
745 BUILDCMD_CLEAN
="${BUILDCMD} clean"
746 BUILDCMD_DIST
="${BUILDCMD} dist"
747 BUILDCMD_DISTCHECK
="${BUILDCMD} distcheck"
748 BUILDCMD_INSTALL
="${BUILDCMD} install"
753 if [ $?
-ne 0 ]; then
754 # Rerun with Automake silent rules disabled to see failing gcc statement
755 if [ X
"$RETRY_VERBOSE" != X
]; then
757 echo "build.sh: Rebuilding $component with Automake silent rules disabled"
760 failed
"$BUILDCMD" $module $component
765 if [ X
"$CHECK" != X
]; then
767 if [ $?
-ne 0 ]; then
768 failed
"$BUILDCMD_CHECK" $module $component
774 if [ X
"$CLEAN" != X
]; then
776 if [ $?
-ne 0 ]; then
777 failed
"$BUILDCMD_CLEAN" $module $component
783 if [ X
"$DIST" != X
]; then
785 if [ $?
-ne 0 ]; then
786 failed
"$BUILDCMD_DIST" $module $component
792 if [ X
"$DISTCHECK" != X
]; then
794 if [ $?
-ne 0 ]; then
795 failed
"$BUILDCMD_DISTCHECK" $module $component
801 $SUDO env LD_LIBRARY_PATH
=$LD_LIBRARY_PATH $BUILDCMD_INSTALL
802 if [ $?
-ne 0 ]; then
803 failed
"$SUDO env LD_LIBRARY_PATH=$LD_LIBRARY_PATH $BUILDCMD_INSTALL" $module $component
813 # process each module/component and handle:
814 # LISTONLY, RESUME, NOQUIT, and BUILD_ONE
818 # $3 - configure options
826 if [ X
"$LISTONLY" != X
]; then
827 echo "$module${component:+/}$component"
831 if [ X
"$RESUME" != X
]; then
832 if [ X
"$RESUME" = X
"$module${component:+/}$component" ]; then
834 # Resume build at this module
836 echo "Skipping $module${component:+/}$component..."
841 process
$module "$component" "$confopts"
843 if [ X
"$BUILT_MODULES_FILE" != X
]; then
844 if [ $process_rtn -ne 0 ]; then
845 echo "FAIL: $module${component:+/}$component" >> $BUILT_MODULES_FILE
847 echo "PASS: $module${component:+/}$component" >> $BUILT_MODULES_FILE
851 if [ $process_rtn -ne 0 ]; then
852 echo "build.sh: error processing: \"$module${component:+/}$component\""
853 if [ X
"$NOQUIT" = X
]; then
859 if [ X
"$BUILD_ONE" != X
]; then
860 echo "Single-component build complete"
866 # just process the sub-projects supplied in the given file ($MODFILE)
867 # in the order in which they are found in the list
868 # (prerequisites and ordering are the responsibility of the user)
870 # $MODFILE - readable file containing list of modules to process
871 # and their optional configuration options
877 process_module_file
() {
879 if [ X
"$MODFILE" = X
]; then
880 echo "internal process_module_file() error, \$MODFILE is empty"
883 if [ ! -r "$MODFILE" ]; then
884 echo "module file '$MODFILE' is not readable or does not exist"
888 # read from input file, skipping blank and comment lines
891 if [ X
"$line" = X
]; then
896 echo "$line" |
grep "^#" > /dev
/null
897 if [ $?
-eq 0 ]; then
901 # parse each line to extract module, component and options name
902 field1
=`echo $line | cut -d' ' -f1`
903 module
=`echo $field1 | cut -d'/' -f1`
904 component
=`echo $field1 | cut -d'/' -s -f2`
905 confopts
=`echo $line | cut -d' ' -s -f2-`
907 build
$module "$component" "$confopts"
915 basename="`expr "//$0" : '.*/\([^/]*\)'`"
916 echo "Usage: $basename [options] [prefix]"
918 echo " -a Do NOT run auto config tools (autogen.sh, configure)"
919 echo " -b Use .build.unknown build directory"
920 echo " -c Run make clean in addition to \"all install\""
921 echo " -D Run make dist in addition to \"all install\""
922 echo " -d Run make distcheck in addition \"all install\""
923 echo " -g Compile and link with debug information"
924 echo " -h, --help Display this help and exit successfully"
925 echo " -m Do NOT run any of the make targets"
926 echo " -n Do not quit after error; just print error message"
927 echo " -o module/component"
928 echo " Build just this module/component"
929 echo " -p Update source code before building (git pull --rebase)"
930 echo " -s sudo The command name providing superuser privilege"
931 echo " --autoresume resumefile"
932 echo " Append module being built to, and autoresume from, <file>"
933 echo " --check Run make check in addition \"all install\""
934 echo " --clone Clone non-existing repositories (uses \$GITROOT if set)"
935 echo " --cmd command"
936 echo " Execute arbitrary git, gmake, or make command"
937 echo " --confflags options"
938 echo " Pass options to autogen.sh/configure of all modules"
939 echo " --modfile modulefile"
940 echo " Only process the module/components specified in modulefile"
941 echo " Any text after, and on the same line as, the module/component"
942 echo " is assumed to be configuration options for the configuration"
943 echo " of each module/component specifically"
944 echo " --retry-v1 Remake 'all' on failure with Automake silent rules disabled"
946 echo "Usage: $basename -L"
947 echo " -L Just list modules to build"
952 # Ensure the named variable value contains a full path name
954 # $1 - the variable value (the path to examine)
955 # $2 - the name of the variable
957 # returns nothing or exit on error with message
961 if [ X
"`expr $path : "\
(.\
)"`" != X
/ ]; then
962 echo "The path \"$path\" supplied by \"$varname\" must be a full path name"
969 # Ensure the named variable value contains a writable directory
971 # $1 - the variable value (the path to examine)
972 # $2 - the name of the variable
974 # returns nothing or exit on error with message
975 check_writable_dir
() {
978 if [ X
"$SUDO" = X
]; then
979 if [ ! -d "$path" ] ||
[ ! -w "$path" ]; then
980 echo "The path \"$path\" supplied by \"$varname\" must be a writable directory"
988 # perform sanity checks on cmdline args which require arguments
990 # $1 - the option being examined
991 # $2 - the argument to the option
993 # if it returns, everything is good
994 # otherwise it exit's
999 if [ X
"$option" = X
]; then
1000 echo "internal required_arg() error, missing first argument"
1004 # check for an argument
1005 if [ X
"$arg" = X
]; then
1006 echo "the '$option' option is missing its required argument"
1012 # does the argument look like an option?
1013 echo $arg |
grep "^-" > /dev
/null
1014 if [ $?
-eq 0 ]; then
1015 echo "the argument '$arg' of option '$option' looks like an option itself"
1022 #==============================================================================
1030 #==============================================================================
1031 build_all_modules
() {
1035 build doc xorg-sgml-doctools
1037 build proto xorgproto
1038 build proto xcbproto
1043 build lib pthread-stubs
1045 build lib libxcb-util
1046 build lib libxcb-image
1047 build lib libxcb-keysyms
1048 build lib libxcb-render-util
1053 Darwin
) build lib libAppleWM
;;
1054 CYGWIN
*) build lib libWindowsWM
;;
1057 build lib libfontenc
1067 build lib libXcomposite
1068 build lib libXrender
1069 build lib libXdamage
1070 build lib libXcursor
1074 build lib libXinerama
1075 build lib libxkbfile
1077 build lib libXpresent
1079 build lib libXScrnSaver
1082 build lib libxshmfence
1088 build lib libXxf86dga
1089 build lib libXxf86vm
1090 build lib libpciaccess
1097 build app beforelight
1100 build app fonttosfnt
1107 build app mkcomposecache
1108 build app mkfontscale
1111 build
test rendercheck
1122 build app xbacklight
1125 build app xclipboard
1129 build app xcursorgen
1156 build app xlsclients
1183 build libevdev libevdev
1184 build libinput libinput
1189 build driver xf86-input-evdev
1190 build driver xf86-input-joystick
1191 build driver xf86-input-libinput
1193 FreeBSD | NetBSD | OpenBSD | Dragonfly | GNU
/kFreeBSD
)
1194 build driver xf86-input-joystick
1198 i
*86 | amd64 | x86_64 | i86pc
)
1199 build driver xf86-input-vmmouse
1206 build driver xf86-input-keyboard
1207 build driver xf86-input-mouse
1208 build driver xf86-input-synaptics
1209 build driver xf86-input-void
1214 build driver xf86-video-sunffb
1219 build driver xf86-video-wsfb
1220 build driver xf86-video-sunffb
1223 build driver xf86-video-sisusb
1224 build driver xf86-video-sunffb
1225 build driver xf86-video-v4l
1226 build driver xf86-video-xgixp
1229 # AMD Geode CPU. Driver contains 32 bit assembler code
1230 build driver xf86-video-geode
1237 build driver xf86-video-suncg14
1238 build driver xf86-video-suncg3
1239 build driver xf86-video-suncg6
1240 build driver xf86-video-sunleo
1241 build driver xf86-video-suntcx
1243 i
*86 | amd64 | x86_64 | i86pc
)
1244 build driver xf86-video-i740
1245 build driver xf86-video-intel
1248 build driver xf86-video-amdgpu
1249 build driver xf86-video-apm
1250 build driver xf86-video-ark
1251 build driver xf86-video-ast
1252 build driver xf86-video-ati
1253 build driver xf86-video-chips
1254 build driver xf86-video-cirrus
1255 build driver xf86-video-dummy
1256 build driver xf86-video-fbdev
1257 build driver xf86-video-glint
1258 build driver xf86-video-i128
1259 build driver xf86-video-mach64
1260 build driver xf86-video-mga
1261 build driver xf86-video-neomagic
1262 build driver xf86-video-nested
1263 build driver xf86-video-nv
1264 build driver xf86-video-rendition
1265 build driver xf86-video-r128
1266 build driver xf86-video-s3
1267 build driver xf86-video-s3virge
1268 build driver xf86-video-savage
1269 build driver xf86-video-siliconmotion
1270 build driver xf86-video-sis
1271 build driver xf86-video-tdfx
1272 build driver xf86-video-tga
1273 build driver xf86-video-trident
1274 build driver xf86-video-tseng
1275 build driver xf86-video-vesa
1276 build driver xf86-video-vmware
1277 build driver xf86-video-voodoo
1281 build font encodings
1282 build font adobe-100dpi
1283 build font adobe-75dpi
1284 build font adobe-utopia-100dpi
1285 build font adobe-utopia-75dpi
1286 build font adobe-utopia-type1
1287 build font arabic-misc
1288 build font bh-100dpi
1290 build font bh-lucidatypewriter-100dpi
1291 build font bh-lucidatypewriter-75dpi
1294 build font bitstream-100dpi
1295 build font bitstream-75dpi
1296 build font bitstream-type1
1297 build font cronyx-cyrillic
1298 build font cursor-misc
1299 build font daewoo-misc
1301 build font ibm-type1
1302 build font isas-misc
1304 build font micro-misc
1305 build font misc-cyrillic
1306 build font misc-ethiopic
1307 build font misc-meltho
1308 build font misc-misc
1309 build font mutt-misc
1310 build font schumacher-misc
1311 build font screen-cyrillic
1312 build font sony-misc
1314 build font winitzki-cyrillic
1315 build font xfree86-type1
1319 build util gccmakedep
1321 build util makedepend
1322 build xkeyboard-config xkeyboard-config
1327 #------------------------------------------------------------------------------
1329 #------------------------------------------------------------------------------
1331 # Initialize variables controlling end of run reports
1332 failed_components
=""
1333 nonexistent_components
=""
1334 clonefailed_components
=""
1336 # Set variables supporting multiple binaries for a single source tree
1337 HAVE_ARCH
="`uname -i`"
1341 # Set variables for conditionally building some components
1347 # Process command line args
1355 DIR_ARCH
=".build.$HAVE_ARCH"
1368 CFLAGS
="${CFLAGS} -g3 -O0"
1385 if [ -n "$BUILT_MODULES_FILE" ]; then
1386 echo "The '-o' and '--autoresume' options are mutually exclusive."
1392 RESUME
=`echo $1 | sed "s,/$,,"`
1404 if [ -n "$BUILD_ONE" ]; then
1405 echo "The '-o' and '--autoresume' options are mutually exclusive."
1411 BUILT_MODULES_FILE
=$1
1422 cmd1
=`echo $1 | cut -d' ' -f1`
1423 cmd2
=`echo $1 | cut -d' ' -f2`
1425 # verify the command exists
1426 which $cmd1 > /dev
/null
2>&1
1427 if [ $?
-ne 0 ]; then
1428 echo "The specified command '$cmd1' does not appear to exist"
1442 echo "The script can only process 'make', 'gmake', or 'git' commands"
1443 echo "It can't process '$cmd1' commands"
1457 if [ ! -r "$1" ]; then
1458 echo "can't find/read file '$1'"
1467 if [ X
"$too_many" = Xyes
]; then
1468 echo "unrecognized and/or too many command-line arguments"
1469 echo " PREFIX: $PREFIX"
1470 echo " Extra arguments: $1"
1476 # check that 'prefix' doesn't look like an option
1477 echo $1 |
grep "^-" > /dev
/null
1478 if [ $?
-eq 0 ]; then
1479 echo "'prefix' appears to be an option"
1493 # All user input has been obtained, set-up the user shell variables
1494 if [ X
"$LISTONLY" = X
]; then
1496 echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
1500 # if there is a BUILT_MODULES_FILE
1501 # then start off by checking for and trying to build any modules which failed
1502 # and aren't the last line
1503 if [ X
"$BUILT_MODULES_FILE" != X
-a -r "$BUILT_MODULES_FILE" ]; then
1504 built_lines
=`cat $BUILT_MODULES_FILE | wc -l | sed 's:^ *::'`
1505 built_lines_m1
=`expr $built_lines - 1`
1506 orig_BUILT_MODULES_FILE
=$BUILT_MODULES_FILE
1507 unset BUILT_MODULES_FILE
1510 built_status
=`echo $line | cut -c-6`
1511 if [ X
"$built_status" = X
"FAIL: " ]; then
1512 line
=`echo $line | cut -c7-`
1513 field1
=`echo $line | cut -d' ' -f1`
1514 module
=`echo $field1 | cut -d'/' -f1`
1515 component
=`echo $field1 | cut -d'/' -s -f2`
1516 confopts
=`echo $line | cut -d' ' -s -f2-`
1520 # quick check for the module in $MODFILE (if present)
1521 if [ X
"$MODFILE" = X
]; then
1522 build
$module "$component" "$confopts"
1523 if [ $?
-eq 0 ]; then
1527 cat $MODFILE |
grep "$module${component:+/}$component" > /dev
/null
1528 if [ $?
-eq 0 ]; then
1529 build
$module "$component" "$confopts"
1530 if [ $?
-eq 0 ]; then
1536 if [ X
"$build_ret" = X
"PASS" ]; then
1538 if [ $?
-ne 0 ]; then
1539 echo "can't create tmp file, $orig_BUILT_MODULES_FILE not modified"
1541 head -n `expr $curline - 1` $orig_BUILT_MODULES_FILE > $built_temp
1542 echo "PASS: $module${component:+/}$component" >> $built_temp
1543 tail -n `expr $built_lines - $curline` $orig_BUILT_MODULES_FILE >> $built_temp
1544 mv $built_temp $orig_BUILT_MODULES_FILE
1548 if [ $curline -eq $built_lines_m1 ]; then
1551 curline
=`expr $curline + 1`
1552 done <"$orig_BUILT_MODULES_FILE"
1554 BUILT_MODULES_FILE
=$orig_BUILT_MODULES_FILE
1555 RESUME
=`tail -n 1 $BUILT_MODULES_FILE | cut -c7-`
1557 # remove last line of $BUILT_MODULES_FILE
1558 # to avoid a duplicate entry
1560 if [ $?
-ne 0 ]; then
1561 echo "can't create tmp file, last built item will be duplicated"
1563 head -n $built_lines_m1 $BUILT_MODULES_FILE > $built_temp
1564 mv $built_temp $BUILT_MODULES_FILE
1568 if [ X
"$MODFILE" = X
]; then
1574 if [ X
"$LISTONLY" != X
]; then
1578 # Print the end date/time to compare with the start date/time
1581 # Report about components that failed for one reason or another
1582 if [ X
"$nonexistent_components" != X
]; then
1584 echo "***** Skipped components (not available) *****"
1585 echo "Could neither find a git repository (at the <module/component> paths)"
1586 echo "or a tarball (at the <module/> paths or ./) for:"
1587 echo " <module/component>"
1588 for mod
in $nonexistent_components; do
1591 echo "You may want to provide the --clone option to build.sh"
1592 echo "to automatically git-clone the missing components"
1596 if [ X
"$failed_components" != X
]; then
1598 echo "***** Failed components *****"
1599 for mod
in $failed_components; do
1605 if [ X
"$CLONE" != X
] && [ X
"$clonefailed_components" != X
]; then
1607 echo "***** Components failed to clone *****"
1608 for mod
in $clonefailed_components; do