(91) 350-9520 support@omarine.org M-F: 7 AM - 7 PM; Weekends: 9 AM - 5 PM

Phần mềm gbuild chúc mừng năm mới

Mùng 1 Tết
Trong không khí chung năm mới, tôi gửi đến mọi người một bài viết. Đây là một chương trình
viết bằng “Shell script”, sử dụng để cấu hình, xây dựng và cài đặt tự động các “module”
dành cho hệ thống hệ điều hành kiểu Unix. Tôi đã dùng nó để hỗ trợ xây dựng một hệ điều hành
mà tôi đang sử dụng để gửi bài này, trong đó là toàn bộ hệ thống X window system (Xorg) bao
gồm các “proto”, thư viện, phần mềm ứng dụng, drivers, Xserver và các tiện ích.
Tarball đầy đủ của chương trình này là file gbuild-1.0.0.tar.gz trong tab “phần mềm” của trang này.

#!/bin/sh
# ===========================================================================
#   Copyright (C) 2014 Pham Thanh Tuyen <phamtyn@gmail.com>

#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.

#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see http://www.gnu.org/licenses

#   This file has been copied code partly from a script named build.sh of
#   X Window System:
#   Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.

#   Permission is hereby granted, free of charge, to any person obtaining a
#   copy of this software and associated documentation files (the “Software”),
#   to deal in the Software without restriction, including without limitation
#   the rights to use, copy, modify, merge, publish, distribute, sublicense,
#   and/or sell copies of the Software, and to permit persons to whom the
#   Software is furnished to do so, subject to the following conditions:

#   The above copyright notice and this permission notice (including the next
#   paragraph) shall be included in all copies or substantial portions of the
#   Software.

#   THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
#   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
#   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
#   DEALINGS IN THE SOFTWARE.

# NAME
#   gbuild.sh – build and install modules for Unix-like based OS
#
# SYNOPSIS
#   gbuild.sh [options]
#
# DESCRIPTION
#
#   The script goal is to build modules from the list. It downloads modules
#   or gets tar files on disk which listed to build.
#
#   Auto resume
#   During building through the list, if any break occurs, this script will
#   mark to resume. This saves a lot of build time due to skipping modules
#   which already passed.
#
#   Custom Modules List File
#   You can modify pre-list of the script or create new one based on it.
#   Each module is on one line of the list file. If need, you can add any
#   configuration options at the end of line.
#   For instance –enable-silent-rules –with-xmlto …
#   Amount of options depends each module and you.
#
#   Update the list
#   The list can be entered automatically for tar files by using option of
#   –updatelist, “tardirectory” is the place contained tar files.
#   For help information please copy this script file into your home
#   directory and type ./gbuild.sh -h (or sh ./gbuild.sh -h)
#
#   Select several modules to build
#   With option of -o, you can select to build only one or several modules:
#   ./gbuild.sh -o module [ module2 … ] [ other-option … ]
#
#   Auto Configure Command
#   Auto switch between configure/autogen.sh commands to configure flexibly
#
#   Multi sources
#   Source of module items maybe come from git, ftp, http or files on disk
#
#   Install schema
#   With option of –installroot=auto, modules are built and installed follows
#   module list and are in areas under current directory(usually is home tree)
#   This lets you make binary packages for each module later. By default and
#   for beginning, Installroot is no set. The Prefix which you set will conduct
#   modules to be installing based on the configuration, example:
#   ./gbuild.sh –prefix= /usr -o sed grep wget
#   (You type –prefix= /usr , –prefix=/usr , –prefix = /usr , –prefix /usr
#   are same meaning) You can add –installroot=<dir> option also on demand
#
#   Custom Build Commands
#   You can provide commands of make or git your own for some custom tasks.
# ===========================================================================

getopts(){
line=$1
option=
opts=
option=`expr “$line” : “.*\(–.*\)” | sed ‘s,  *$,,’`
while [ X”$option” != X ]; do
opts=”${opts}${option} “
line=`expr “$line” : “\(.*\)” | sed ‘s,’$option’,,’ | sed ‘s,  *$,,’`
option=`expr “$line” : “.*\(–.*\)” | sed ‘s,  *$,,’`
done
echo $opts
}
required_arg() {
option=$1
arg=$2
# preconds
if [ X”$option” = X ]; then
echo “internal required_arg() error, missing first argument”
exit 1
fi

# check for an argument
if [ X”$arg” = X ]; then
echo “the ‘$option’ option is missing its required argument”
echo “”
usage
exit 1
fi

# does the argument look like an option?
echo $arg | grep “^-” > /dev/null
if [ $? -eq 0 ]; then
echo “the argument ‘$arg’ of option ‘$option’ looks like an option itself”
echo “”
usage
exit 1
fi
}
failed() {
cmd=$1
module=$2
echo “gbuild.sh: \”$cmd\” failed on $module”
}
check_writable_dir () {
path=$1
varname=$2
if [ X”$SUDO” = X ]; then
if [ ! -d “$path” ] || [ ! -w “$path” ]; then
echo “The path \”$path\” supplied by \”$varname\” must be a writable directory”
echo “”
usage
exit 1
fi
fi
}
getfullpath(){
oldpwd=`pwd`
cd $1 2>/dev/null
if [ $? -ne 0 ]; then
echo “\”$1\” is not valid path”
exit 1
fi
echo `pwd`
cd $oldpwd
}
getrelativepath(){
relpath=$1
curdir=`pwd`
relpath=`getfullpath $relpath`
relpath=`echo $relpath | sed ‘s,’$curdir’,\.,’`
echo $relpath
}
required_arg2() {
option=$1
tardir=$2
listfile=$3
# check for an argument

if [ X”$tardir” = X ]; then
echo “the ‘$option’ option is missing its required argument”
echo “”
usage
exit 1
fi

if [ ! -d $tardir ] || [ ! -w $tardir ]; then
echo “The path \”$tardir\” is not a writable directory”
echo “”
usage
exit 1
fi

curdir=`pwd`
tardir=`getfullpath $tardir`
if [ `expr “$tardir/” : “$curdir/”` = 0 ]; then
echo “The path \”$tardir\” is not in \”`pwd`\” tree, the path must belong to this tree”
echo “”

exit 1
fi
if [ X”$listfile” != X ] && [ `expr “$listfile” : “^-“` -eq 0 ]; then
if [ ! -f $listfile ] || [ ! -w $listfile ]; then
echo “the path \”$listfile\” is not writable file”
exit 1
fi
FILE_TO_BUILD=$listfile
fi
}
getleaf(){
echo $1 | sed ‘s,.*/\([^/]*\),\1,’
}

getparent(){
path=$1
path=`expr “$path” : “\(.*\)/[^/]*.$”`
if [ X”$path” = X ]; then
path=”.”
fi
echo $path
}

updatemodfile(){
ii=
tardir=$1
tardir=`getrelativepath $tardir`
iupdate=0
iflag=0
badname=
badnames=
echo “Checking…”
for ii in gz bz2 xz; do
count=`ls -1 $tardir/*.tar.$ii 2>/dev/null | wc -l`
i=1
if [ $count -ge 1 ]; then
while [ $i -le $count ]; do
tarpath=`ls -1 $tardir/*.tar.$ii | head -n$i | tail -n1`
tarpath=`echo $tarpath | sed ‘s,\.\/,,’`
tarfile=`getleaf $tarpath`
if expr “$tarfile” : “.*-[0-9]*\.\?[0-9]*\.\?[0-9]*\.\?[0-9]*\.tar\.$ii” 1>/dev/null; then
grep $tarfile $FILE_TO_BUILD &>/dev/null
if [ $? -ne 0 ]; then
tarsrcdir=`echo $tarpath | sed ‘s,\(.*\)\.tar\..*,\1,’`
line=”INIT: $tarsrcdir                                                                   “
line=`expr substr “$line” 1 60`
if [ $iflag -eq 0 ]; then
echo “Updating…”
iflag=1
fi
expr “$line$tarpath” : “\(.*\)” >> $FILE_TO_BUILD
echo “Appended \”$tarpath\””
iupdate=`expr $iupdate + 1`
fi
else
badnames=”$badnames $tarfile”
fi
i=`expr $i + 1`
done
fi
done
if [ $iupdate -ne 0 ]; then
if [ $iupdate -gt 1 ]; then
echo “”
echo “The file \”$FILE_TO_BUILD\” has been updated: $iupdate module items appended.”
else
echo “”
echo “The file \”$FILE_TO_BUILD\” has been updated: $iupdate module item appended.”
fi
else
echo “No newfound.”
echo “Module list is UP-TO-DATE!”
fi
if [ -n “$badnames” ]; then
echo “Warning: you have some tar files is not in standard name”
echo “Please rename them into form such as \”package-version.tar.gz\””
echo “They are:”
for badname in $badnames; do
echo ”    $badname”
done
fi
}

envoptions() {
cat << EOF
Environment variables specific to gbuild.sh:
PREFIX      Install architecture-independent files in PREFIX [/usr/local]
Each module/components is invoked with –prefix
EPREFIX     Install architecture-dependent files in EPREFIX [PREFIX]
Each module/components is invoked with –exec-prefix
BINDIR      Install user executables [EPREFIX/bin]
Each module/components is invoked with –bindir
DATAROOTDIR Install read-only arch-independent data root [PREFIX/share]
Each module/components is invoked with –datarootdir
DATADIR     Install read-only architecture-independent data [DATAROOTDIR]
Each module/components is invoked with –datadir
LIBDIR      Install object code libraries [EPREFIX/lib]
Each module/components is invoked with –libdir
LOCALSTATEDIR
Modifiable single-machine data [PREFIX/var]
Each module/components is invoked with –localstatedir
QUIET       Do not print messages saying which checks are being made
Each module/components is invoked with –quite
CONFFLAGS   Configure options to pass to all Autoconf configure scripts
Type “./gbuild.sh –confighelp -o <module name>” for any modules
you need

Environment variables defined by the GNU Build System:
ACLOCAL     The aclocal cmd name [aclocal -I \${DESTDIR}/\${DATADIR}/aclocal]
DESTDIR     Path to the staging area where installed objects are relocated
MAKE        The name of the make command [make]
MAKEFLAGS   Options to pass to all \$(MAKE) invocations
CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP         C preprocessor

Environment variables defined by the shell:
PATH        List of directories that the shell searches for commands
\$DESTDIR/\$BINDIR is prepended

Environment variables defined by the dynamic linker:
LD_LIBRARY_PATH
List directories that the linker searches for shared objects
\$DESTDIR/\$LIBDIR is prepended

Environment variables defined by the pkg-config system:
PKG_CONFIG_PATH
List directories that pkg-config searches for libraries
\$DESTDIR/\$DATADIR/pkgconfig and
\$DESTDIR/\$LIBDIR/pkgconfig are prepended
EOF
}

usage() {
basename=”`expr “//$0″ : ‘.*/\([^/]*\)’`”
echo “Usage: $basename [options]”
echo “Options:”
echo ”  -A, –all   Build all modules including also passed ones”
echo ”  -a          Do NOT run auto config tools (autogen.sh, configure)”
echo ”  -b          Some packages requires to build in separate build directory, then you”
echo ”              choose this option”
echo ”  -C          Use \”configure\” forced (in rarely case)”
echo ”  -c          Run make clean”
echo ”  –confighelp”
echo ”              Display configure help”
echo ”  -D          Run make dist for distribution”
echo ”  -d          Run make distcheck”
echo ”  –env NAME=VALUE [ NAME2=VALUE2 …]”
echo ”              Set additional enviroment variables for ‘make install'”
echo ”  -g          Compile and link with debug information”
echo ”  -h, –help  Display this help and exit”
echo ”  -n          Do not quit after error; just print error message, continue for next module”
echo ”  -o <module> [ <module2> … ]”
echo ”              Build one or several modules as you type”
echo ”              Full name of module in general is no need”
echo ”              For example you type \”./gbuild.sh -o macros inputpro xcb/util -g\” is ok”
echo ”  -s <sudo>   The command name providing superuser privilege”
echo ”  –check     Run make check”
echo ”  –cmd <command>”
echo ”              Execute arbitrary git, gmake, or make command”
echo ”              For instance ./gbuild.sh –cmd make clean -o mesa/mesa”
echo ”  –configflags <options>”
echo ”              Pass options to autogen.sh/configure of all modules”
echo ”  –modfile <modulelistfile>”
echo ”              Process the modules specified in custom modulelistfile of yours”
echo ”              instead of prefixed list of the script”
echo ”  -U, –update”
echo ”              Update source code before building (git pull)”
echo ”  -u, –updatelist <tardirectory> [ <modulelistfile> ]”
echo ”              Update modulelistfile in addition from tar files on disk”
echo ”  –retry     Remake which on failure with Automake silent rules disabled”
echo ”              also try update source code”
echo ”  –prefix=<prefix>”
echo ”              Set prefix to install”
echo ”  –installroot=<dir|auto>”
echo ”              Set <dir> directory for install to”
echo ”              With \”–installroot=auto\” modules will be installed based the tree schema”
echo ”              separately”
echo “”
echo “Usage: $basename -L”
echo ”  -L          Just list modules to build”
echo “”
envoptions
}

echo2(){
echo “INIT: $1”
}

modlistdisplay(){
while read line; do
if [ X”$line” = X ]; then
continue
fi
# skip comment lines
echo “$line” | grep “^#” > /dev/null
if [ $? -eq 0 ]; then
continue
fi
amod=`echo $line | cut -d’ ‘ -f2`
echo $amod
done < $FILE_TO_BUILD
}

parseautogen(){
x=`cat $1 | grep “/configure” | sed ‘s,^.*\(/configure.*\”\$\@\”\).*,\1,’ | \
sed ‘s,–[^ ]*,,’ | sed ‘s,  *,,’ | sed ‘s,\”,,g’`
if [ X”$x” = X/configure’$@’ ]; then
return 0
fi
return 1
}
check_full_path () {
path=$1
varname=$2
if [ X”`expr $path : “\(.\)”`” != X/ ]; then
echo “The path \”$path\” supplied by \”$varname\” must be a full path name”
echo “”
usage
exit 1
fi
}
setup_buildenv_user(){

PREFIX_USER=${PREFIX}
EPREFIX_USER=${EPREFIX}
BINDIR_USER=${BINDIR}
DATAROOTDIR_USER=${DATAROOTDIR}
DATADIR_USER=${DATADIR}
LIBDIR_USER=${LIBDIR}
LOCALSTATEDIR_USER=${LOCALSTATEDIR}

# Choose which make program to use
MAKE=${MAKE:=”make”}

# Assign a default value if no value was supplied by the user
PREFIX=${PREFIX:-/usr/local}
EPREFIX=${EPREFIX:-$PREFIX}
BINDIR=${BINDIR:-$EPREFIX/bin}
DATAROOTDIR=${DATAROOTDIR:-$PREFIX/share}
DATADIR=${DATADIR:-$DATAROOTDIR}
LIBDIR=${LIBDIR:-$EPREFIX/lib}
LOCALSTATEDIR=${LOCALSTATEDIR:-$PREFIX/var}

# Support previous usage of LIBDIR which was a subdir relative to PREFIX
# We use EPREFIX as this is what PREFIX really meant at the time
if [ X”$LIBDIR” != X ]; then
if [ X”`expr $LIBDIR : “\(.\)”`” != X/ ]; then
echo “”
echo “Warning: this usage of \$LIBDIR is deprecated. Use a full path name.”
echo “The supplied value \”$LIBDIR\” has been replaced with $EPREFIX/$LIBDIR.”
echo “”
LIBDIR=$EPREFIX/$LIBDIR
fi
fi
# All directories variables must be full path names
check_full_path $PREFIX PREFIX
check_full_path $EPREFIX EPREFIX
check_full_path $BINDIR BINDIR
check_full_path $DATAROOTDIR DATAROOTDIR
check_full_path $DATADIR DATADIR
check_full_path $LIBDIR LIBDIR
check_full_path $LOCALSTATEDIR LOCALSTATEDIR
}
setup_buildenv() {

check_writable_dir ${DestDirectory}${PREFIX} PREFIX

# Must create local aclocal dir or aclocal fails
ACLOCAL_LOCALDIR=”${DestDirectory}${DATADIR}/aclocal”
$SUDO mkdir -p ${ACLOCAL_LOCALDIR}

# The following is required to make aclocal find our .m4 macros
ACLOCAL=${ACLOCAL:=”aclocal”}
ACLOCAL=”${ACLOCAL} -I ${ACLOCAL_LOCALDIR}”
export ACLOCAL

# The following is required to make pkg-config find our .pc metadata files
PKG_CONFIG_PATH=${DestDirectory}${DATADIR}/pkgconfig:${DestDirectory}${LIBDIR}/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
export PKG_CONFIG_PATH

# Set the library path so that locally built libs will be found by apps
LD_LIBRARY_PATH=${DestDirectory}${LIBDIR}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH

# Set the path so that locally built apps will be found and used
PATH=${DestDirectory}${BINDIR}${PATH:+:$PATH}
export PATH

# Create the log file directory
$SUDO mkdir -p ${DestDirectory}${LOCALSTATEDIR}/log
}

buildgeneral(){
pass=
SRCDIR=
urlstr=
line=
linecount=`cat $FILE_TO_BUILD | wc -l`
i=1
imodcount=0
isucceeded=0
ifailed=0
iskip=0
buildret=
failarr=
confopts=
rtn=
setup_buildenv_user
FILE_TO_BUILD_TMP=`mktemp`
cat $FILE_TO_BUILD > $FILE_TO_BUILD_TMP
while read line; do
# skip blank lines
if [ X”$line” = X ]; then
i=`expr $i + 1`
continue
fi
# skip comment lines
echo “$line” | grep “^#” > /dev/null
if [ $? -eq 0 ]; then
i=`expr $i + 1`
continue
fi

pass=`echo $line | cut -d’ ‘ -f1`
SRCDIR=`echo $line | cut -d’ ‘ -f2`
urlstr=`echo $line | cut -d’ ‘ -f3`
confopts=`getopts “$line”`
if [ X”$pass” = X”PASS:” ] && [ X”$ALLMOD” = X ]; then
echo “Skipping $SRCDIR …”
iskip=`expr $iskip + 1`
else
build $SRCDIR $urlstr “$confopts”
rtn=$?
if [ $rtn -eq 1 ]; then
buildret=”FAIL”
failarr=”$failarr $i”
ifailed=`expr $ifailed + 1`
elif [ $rtn -eq 0 ]; then
buildret=”PASS”
isucceeded=`expr $isucceeded + 1`
elif [ $rtn -eq 3 ]; then
failarr=”$failarr $i”
ifailed=`expr $ifailed + 1`
i=`expr $i + 1`
continue
else
isucceeded=`expr $isucceeded + 1`
i=`expr $i + 1`
continue
fi
tmpfile=`mktemp`
if [ $? -ne 0 ]; then
echo “can’t create tmp file, $FILE_TO_BUILD not modified”
else
head -n`expr $i – 1` $FILE_TO_BUILD > $tmpfile
head -n$i $FILE_TO_BUILD | tail -n1 | sed ‘s,….,’$buildret’,’ >> $tmpfile
tail -n`expr $linecount – $i` $FILE_TO_BUILD >> $tmpfile
mv $tmpfile $FILE_TO_BUILD
fi
if [ X”$buildret” = X”FAIL” ] && [ $NOQUIT -eq 0 ]; then
exit 1
fi
fi
i=`expr $i + 1`
done < $FILE_TO_BUILD_TMP

if [ -n “$GITCMD” ] || [ -n “$CONFIGHELP” ]; then
return 0
fi

imodcount=`expr $iskip + $isucceeded + $ifailed`
if [ $imodcount -gt 1 ];then
echo “”
echo “Total $imodcount modules”
else
echo “”
echo “Total $imodcount module”
fi
echo “$iskip skipped, $isucceeded succeeded, $ifailed failed.”
if [ $ifailed -gt 0 ]; then
echo “List of which failed:”
i=0
for index in $failarr; do
head -n$index $FILE_TO_BUILD | tail -n1 | sed ‘s,….,’`expr $i + 1`’,’
i=`expr $i + 1`
done
else
if [ $imodcount -gt 1 ] && [ -z “$MAKECMD” ];then
echo “”
echo “Congratulate! All $imodcount modules have been built successfully.”
fi
fi
}

build_onemod(){

SRCDIR=
urlstr=
line=
confopts=
modnames=$1
modname=
passmod=
failmod=
rtn=
linecount=`cat $FILE_TO_BUILD | wc -l`
setup_buildenv_user
for modname in $modnames; do
i=`cat $FILE_TO_BUILD | grep -n “$modname” | head -n1 | cut -d”:” -f1`

if [ -z “$i” ]; then
echo “Module \”$modname\” not found!”
continue
fi
buildret=

line=`cat $FILE_TO_BUILD | grep “$modname” | head -n1`

SRCDIR=`echo $line | cut -d’ ‘ -f2`
urlstr=`echo $line | cut -d’ ‘ -f3`

confopts=`getopts “$line”`

build $SRCDIR $urlstr “$confopts”
rtn=$?
if [ $rtn -eq 1 ]; then
buildret=”FAIL”
failmod=”$failmod $SRCDIR”
elif [ $rtn -eq 0 ]; then
buildret=”PASS”
passmod=”$passmod $SRCDIR”
else
continue
fi
tmpfile=`mktemp`
if [ $? -ne 0 ]; then
echo “can’t create tmp file, $FILE_TO_BUILD not modified”
else
head -n`expr $i – 1` $FILE_TO_BUILD > $tmpfile
head -n$i $FILE_TO_BUILD | tail -n1 | sed ‘s,….,’$buildret’,’ >> $tmpfile
tail -n`expr $linecount – $i` $FILE_TO_BUILD >> $tmpfile
mv $tmpfile $FILE_TO_BUILD
fi

done

if [ -n “$GITCMD” ] || [ -n “$CONFIGHELP” ]; then
return 0
fi

if [ -n “$failmod” ]; then
echo “”
echo “Failed:”
for modname in $failmod; do
echo ”    $modname”
done
fi
if [ -n “$passmod” ]; then
echo “”
echo “Completed:”
for modname in $passmod; do
echo ”    $modname”
done
fi

echo “”
}
clone() {
DIR=$1
urlstr=$2
urlf1=`echo $urlstr | cut -d’,’ -f1`
urlf2=`echo $urlstr | cut -d’,’ -f2`
urlf3=`echo $urlstr | cut -d’,’ -f3`
if [ ! -d “$DIR” ]; then
if [ “$urlf1” = hg ]; then
# verify the command exists
which hg > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo “Your system has no hg”
return 1
fi
echo “Starting hg clone ${urlf2:+-r $urlf2 }$urlf3 ${DIR} …”
hg clone ${urlf2:+-r $urlf2 }$urlf3 “$DIR”
if [ $? -ne 0 ]; then
echo “Failed to clone $DIR.”
return 1
fi
else
git clone “$urlstr” “$DIR”
if [ $? -ne 0 ]; then
echo “Failed to clone $DIR.”
return 1
fi
old_pwd=`pwd`
cd $DIR
if [ $? -ne 0 ]; then
echo “Failed to cd to $DIR.”
return 1
fi
git submodule init
if [ $? -ne 0 ]; then
echo “Failed to initialize $DIR submodule.”
return 1
fi
git submodule update
if [ $? -ne 0 ]; then
echo “Failed to update $DIR submodule.”
return 1
fi
cd ${old_pwd}
fi
else
echo “git cannot clone into an existing directory $DIR”
return 1
fi

return 0
}
build(){
needs_config=0
tarfile=
filetype=
pkg_tar_opts=
SourceDir=$1
urlstr=$2
confopts=$3
protocol=`echo $urlstr | cut -c-6`
SourceDirparent=`getparent $SourceDir`
builddir=”build/$SourceDir”

echo “”
echo “======================================================================”
echo “==  Processing:  \”$SourceDir\””
echo “==        configuration options: ${CONFFLAGS:+”$CONFFLAGS “}$confopts”

CONFCMD=
old_pwd=`pwd`
# A custom ‘make’ target list was supplied through –cmd option
if [ X”$MAKECMD” = Xclean ] || [ X”$MAKECMD” = Xdistclean ]; then
cd $SourceDir
${MAKE} $MAKEFLAGS $MAKECMD
rtn=$?
cd $old_pwd

if [ $rtn -ne 0 ]; then
failed “${MAKE}${MAKEFLAGS:+” $MAKEFLAGS”} $MAKECMD” $SourceDir
return 3
fi
echo “Command \”${MAKE}${MAKEFLAGS:+” $MAKEFLAGS”} $MAKECMD\” completed.”
return 2
fi

if [ X”$CONFIGHELP” != X ]; then
if [ ! -f “$SourceDir”/configure ]; then
echo “configure not found!”
return 3
fi
sh $SourceDir/configure –help
rtn=$?

if [ $rtn -ne 0 ]; then
failed “configure help” $SourceDir
return 3
fi
return 2
fi

if [ -z “${GITCMD}${CONFIGHELP}” ]; then
sleep 1
fi

if [ `expr “$SourceDir” : “xorg”` -ne 0 ]; then
builddir=”build/xorg”
fi

if [ -z “$ENV_ONCE” ] || [ X”$DESTDIRVAR” = Xauto ]; then
if [ X”$ISX” = X ] || [ `expr “$SourceDir” : “xorg”` -eq 0 ]; then
if [ X”$DESTDIRVAR” = Xauto ]; then
DestDirectory=$builddir
else
DestDirectory=${DESTDIRVAR:=$DESTDIR}
fi
if ! $SUDO mkdir -p ${DestDirectory}${PREFIX}; then
echo “”
usage
exit 1
fi
if [ -n “$DestDirectory” ]; then
DestDirectory=`getfullpath $DestDirectory`

fi
setup_buildenv
fi
if [ `expr “$SourceDir” : “xorg”` -ne 0 ]; then
ISX=1
fi
ENV_ONCE=1
fi

if [ ! -f “$SourceDir”/configure.ac ] && [ ! -f “$SourceDir”/autogen.sh ] && [ ! -f “$SourceDir”/configure ] && \
[ ! -f “$SourceDir”/bootstrap ] && [ ! -f “$SourceDir”/bootstrap.sh ]; then
if expr “$urlstr” : “.*\.tar\.gz$” 1>/dev/null || \
expr “$urlstr” : “.*\.tar\.xz$” 1>/dev/null || \
expr “$urlstr” : “.*\.tar\.bz2$” 1>/dev/null; then
case $protocol in
“ftp://” | “http:/”)
wget $urlstr -P $SourceDirparent
if [ $? -ne 0 ]; then
echo “Failed to download $SourceDir.”
return 1
fi
mkdir -p $SourceDirparent
tarfile=`getleaf $urlstr`
;;
*)
mkdir -p $SourceDirparent
tarfile=`getleaf $urlstr`
if [ ! -f $SourceDirparent/$tarfile ]; then
echo “File \”$tarfile\” not found in $SourceDirparent directory”
return 1
fi
;;
esac
filetype=`expr “$tarfile” : “.*\.\([^\.]*$\)”`
case $filetype in
“bz2”)
pkg_tar_opts=xjf
;;
“gz”)
pkg_tar_opts=xzf
;;
“xz”)
pkg_tar_opts=xJf
;;
esac
echo “”
echo “Extracting $tarfile…”
tar $pkg_tar_opts “$SourceDirparent”/”$tarfile” -C $SourceDirparent
if [ $? -ne 0 ]; then
echo “Unable to extract $tarfile!”
return 1
fi
else
clone $SourceDir $urlstr
if [ $? -ne 0 ]; then
return 1
fi
needs_config=1
fi

fi

if [ X”$GITCMD” != X ]; then
cd $SourceDir
$GITCMD
rtn=$?
cd $old_pwd

if [ $rtn -ne 0 ]; then
failed “$GITCMD” $SourceDir
return 3
fi
return 2
fi
if [ X”$PULL” != X ]; then
if expr “$urlstr” : “.*\.tar\.gz$” 1>/dev/null || \
expr “$urlstr” : “.*\.tar\.xz$” 1>/dev/null || \
expr “$urlstr” : “.*\.tar\.bz2$” 1>/dev/null; then
echo “Update is not using for tar files, but git only.”
echo “”
sleep 1
else
cd $SourceDir
echo “”
echo “Updating…”
git pull
if [ $? -ne 0 ]; then
failed “git pull” $SourceDir
cd $old_pwd
return 1
fi
# The parent module knows which commit the submodule should be at
git submodule update
if [ $? -ne 0 ]; then
failed “git submodule update” $SourceDir
return 1
fi
cd $old_pwd
fi
fi

if [ X”$CONFIGURECMD” = X ]; then
if [ ! -f “$SourceDir”/autogen.sh ] && [ ! -f “$SourceDir”/configure ] && \
[ ! -f “$SourceDir”/bootstrap ] && [ ! -f “$SourceDir”/bootstrap.sh ]; then
cd $SourceDir
autoreconf -vfi
if [ $? -ne 0 ]; then
echo “Failed autoreconf for $SourceDir.”
cd ${old_pwd}
return 1
fi
cd ${old_pwd}
CONFCMD=”configure”
elif [ -f “$SourceDir”/autogen.sh ]; then
parseautogen “$SourceDir”/autogen.sh
if [ $? -eq 0 ]; then
CONFCMD=”autogen.sh”
else
cd $SourceDir
echo “Run autogen.sh without arguments…”
echo “”
sh ./autogen.sh
if [ $? -ne 0 ]; then
echo “Failed autogen for $SourceDir.”
if [ ! -f “$SourceDir”/configure ]; then
cd ${old_pwd}
return 1
else
echo “Try run configure instead…”
fi
fi
cd ${old_pwd}
CONFCMD=”configure”
fi
elif [ -f “$SourceDir”/bootstrap.sh ]; then
cd $SourceDir
sh ./bootstrap.sh
if [ $? -ne 0 ]; then
echo “Failed bootstrap for $SourceDir.”
if [ ! -f “$SourceDir”/configure ]; then
cd ${old_pwd}
return 1
else
echo “Try run configure instead…”
fi
fi
cd ${old_pwd}
CONFCMD=”configure”
elif [ -f “$SourceDir”/bootstrap ]; then
cd $SourceDir
sh ./bootstrap
if [ $? -ne 0 ]; then
echo “Failed bootstrap for $SourceDir.”
if [ ! -f “$SourceDir”/configure ]; then
cd ${old_pwd}
return 1
else
echo “Try run configure instead…”
fi
fi
cd ${old_pwd}
CONFCMD=”configure”
else
CONFCMD=”configure”
fi
fi
if [ X”$CONFIGURECMD” != X ]; then
CONFCMD=”configure”
fi
cd $SourceDir
# Build outside source directory
if [ X”$DIR_ARCH” != X ] ; then
mkdir -p “$DIR_ARCH”
if [ $? -ne 0 ]; then
failed mkdir $SourceDir
cd $old_pwd
return 1
fi
cd “$DIR_ARCH”
if [ $? -ne 0 ]; then
failed cd $SourceDir
cd ${old_pwd}
return 1
fi
fi

# Use “sh autogen.sh” since some scripts are not executable in CVS
if [ $needs_config -eq 1 ] || [ X”$NOAUTOGEN” = X ]; then
sh ${DIR_CONFIG}/${CONFCMD} \
–prefix=”$PREFIX” \
${EPREFIX_USER:+–exec-prefix=”$EPREFIX”} \
${BINDIR_USER:+–bindir=”$BINDIR”} \
${DATAROOTDIR_USER:+–datarootdir=”$DATAROOTDIR”} \
${DATADIR_USER:+–datadir=”$DATADIR”} \
${LIBDIR_USER:+–libdir=”$LIBDIR”} \
${LOCALSTATEDIR_USER:+–localstatedir=”$LOCALSTATEDIR”} \
${QUIET:+–quiet} \
${CONFFLAGS} $confopts \
${CC:+CC=”$CC”} \
${CPP:+CPP=”$CPP”} \
${CPPFLAGS:+CPPFLAGS=”$CPPFLAGS”} \
${CFLAGS:+CFLAGS=”$CFLAGS”} \
${LDFLAGS:+LDFLAGS=”$LDFLAGS”}
if [ $? -ne 0 ]; then
failed ${CONFCMD} $SourceDir
cd $old_pwd
return 1
else
echo “Command \”${CONFCMD}\” completed.”
fi
fi

# A custom ‘make’ target list was supplied through –cmd option
if [ X”$MAKECMD” != X ]; then
if [ $MAKECMD = NONE ]; then
MAKECMD=””
fi
${MAKE} $MAKEFLAGS $MAKECMD
rtn=$?
cd $old_pwd

if [ $rtn -ne 0 ]; then
failed “${MAKE}${MAKEFLAGS:+” $MAKEFLAGS”}${MAKECMD:+ $MAKECMD}” $SourceDir
MAKECMD=${MAKECMD:=NONE}
return 3
fi
echo “Command \”${MAKE}${MAKEFLAGS:+” $MAKEFLAGS”}${MAKECMD:+ $MAKECMD}\” completed.”
MAKECMD=${MAKECMD:=NONE}
return 2
fi

${MAKE} $MAKEFLAGS
if [ $? -ne 0 ]; then
# Rerun with Automake silent rules disabled to see failing gcc statement
if [ X”$RETRY_VERBOSE” != X ]; then
echo “”
echo “gbuild.sh: Rebuilding $SourceDir with Automake silent rules disabled”
${MAKE} $MAKEFLAGS V=1
fi
failed $MAKE${MAKEFLAGS:+” $MAKEFLAGS”} $SourceDir
cd $old_pwd
return 1
fi
echo “Command \”${MAKE}\” completed.”

if [ X”$CHECK” != X ]; then
${MAKE} $MAKEFLAGS check
if [ $? -ne 0 ]; then
failed “$MAKE $MAKEFLAGS check” $SourceDir
cd $old_pwd
return 1
fi
fi

if [ X”$CLEAN” != X ]; then
${MAKE} $MAKEFLAGS clean
if [ $? -ne 0 ]; then
failed “$MAKE $MAKEFLAGS clean” $SourceDir
cd $old_pwd
return 1
fi
fi

if [ X”$DIST” != X ]; then
${MAKE} $MAKEFLAGS dist
if [ $? -ne 0 ]; then
failed “$MAKE $MAKEFLAGS dist” $SourceDir
cd $old_pwd
return 1
fi
fi

if [ X”$DISTCHECK” != X ]; then
${MAKE} $MAKEFLAGS distcheck
if [ $? -ne 0 ]; then
failed “$MAKE $MAKEFLAGS distcheck” $SourceDir
cd $old_pwd
return 1
fi
fi

$SUDO env ${ENV_SET:+”$ENV_SET” }LD_LIBRARY_PATH=$LD_LIBRARY_PATH ${MAKE} $MAKEFLAGS ${DestDirectory:+DESTDIR=”$DestDirectory”} install
if [ $? -ne 0 ]; then
failed “${SUDO:+$SUDO }env ${ENV_SET:+”$ENV_SET” }LD_LIBRARY_PATH=$LD_LIBRARY_PATH $MAKE ${MAKEFLAGS:+”$MAKEFLAGS” }${DestDirectory:+DESTDIR=”$DestDirectory”} install” $SourceDir
cd $old_pwd
return 1
fi
echo “${SUDO:+$SUDO }env ${ENV_SET:+”$ENV_SET” }LD_LIBRARY_PATH=$LD_LIBRARY_PATH $MAKE ${MAKEFLAGS:+”$MAKEFLAGS” }${DestDirectory:+DESTDIR=”$DestDirectory”} install”
echo “gbuild.sh: built \”$SourceDir\” successfully.”
echo “”
cd ${old_pwd}
return 0
}

mkmodlist(){
echo2 “xorg/util/macros                                      git://anongit.freedesktop.org/git/xorg/util/macros”
echo2 “xorg/font/util                                        git://anongit.freedesktop.org/git/xorg/font/util               –enable-silent-rules”
echo2 “xorg/doc/xorg-sgml-doctools                           git://anongit.freedesktop.org/git/xorg/doc/xorg-sgml-doctools”
echo2 “xorg/doc/xorg-docs                                    git://anongit.freedesktop.org/git/xorg/doc/xorg-docs”
case $HOST_OS in
Darwin)
echo2 “xorg/proto/applewmproto                               git://anongit.freedesktop.org/git/xorg/proto/applewmproto”
;;
CYGWIN*)
echo2 “xorg/proto/windowswmproto                             git://anongit.freedesktop.org/git/xorg/proto/windowswmproto”
;;
esac
echo2 “xorg/proto/bigreqsproto                               git://anongit.freedesktop.org/git/xorg/proto/bigreqsproto      –enable-silent-rules –with-xmlto”
echo2 “xorg/proto/compositeproto                             git://anongit.freedesktop.org/git/xorg/proto/compositeproto”
echo2 “xorg/proto/damageproto                                git://anongit.freedesktop.org/git/xorg/proto/damageproto”
echo2 “xorg/proto/dmxproto                                   git://anongit.freedesktop.org/git/xorg/proto/dmxproto”
echo2 “xorg/proto/dri2proto                                  git://anongit.freedesktop.org/git/xorg/proto/dri2proto”
echo2 “xorg/proto/dri3proto                                  git://anongit.freedesktop.org/git/xorg/proto/dri3proto”
echo2 “xorg/proto/fixesproto                                 git://anongit.freedesktop.org/git/xorg/proto/fixesproto”
echo2 “xorg/proto/fontsproto                                 git://anongit.freedesktop.org/git/xorg/proto/fontsproto”
echo2 “xorg/proto/glproto                                    git://anongit.freedesktop.org/git/xorg/proto/glproto”
echo2 “xorg/proto/inputproto                                 git://anongit.freedesktop.org/git/xorg/proto/inputproto”
echo2 “xorg/proto/kbproto                                    git://anongit.freedesktop.org/git/xorg/proto/kbproto”
echo2 “xorg/proto/presentproto                               git://anongit.freedesktop.org/git/xorg/proto/presentproto”
echo2 “xorg/proto/randrproto                                 git://anongit.freedesktop.org/git/xorg/proto/randrproto”
echo2 “xorg/proto/recordproto                                git://anongit.freedesktop.org/git/xorg/proto/recordproto”
echo2 “xorg/proto/renderproto                                git://anongit.freedesktop.org/git/xorg/proto/renderproto”
echo2 “xorg/proto/resourceproto                              git://anongit.freedesktop.org/git/xorg/proto/resourceproto”
echo2 “xorg/proto/scrnsaverproto                             git://anongit.freedesktop.org/git/xorg/proto/scrnsaverproto”
echo2 “xorg/proto/videoproto                                 git://anongit.freedesktop.org/git/xorg/proto/videoproto”
echo2 “xorg/proto/x11proto                                   git://anongit.freedesktop.org/git/xorg/proto/x11proto”
echo2 “xorg/proto/xcmiscproto                                git://anongit.freedesktop.org/git/xorg/proto/xcmiscproto”
echo2 “xorg/proto/xextproto                                  git://anongit.freedesktop.org/git/xorg/proto/xextproto”
echo2 “xorg/proto/xf86bigfontproto                           git://anongit.freedesktop.org/git/xorg/proto/xf86bigfontproto”
echo2 “xorg/proto/xf86dgaproto                               git://anongit.freedesktop.org/git/xorg/proto/xf86dgaproto”
echo2 “xorg/proto/xf86driproto                               git://anongit.freedesktop.org/git/xorg/proto/xf86driproto”
echo2 “xorg/proto/xf86vidmodeproto                           git://anongit.freedesktop.org/git/xorg/proto/xf86vidmodeproto”
echo2 “xorg/proto/xineramaproto                              git://anongit.freedesktop.org/git/xorg/proto/xineramaproto”
echo2 “xorg/xcb/proto                                        git://anongit.freedesktop.org/git/xcb/proto”
echo2 “xorg/util/makedepend                                  git://anongit.freedesktop.org/git/xorg/util/makedepend”
echo2 “xorg/lib/libxtrans                                    git://anongit.freedesktop.org/git/xorg/lib/libxtrans”
echo2 “xorg/lib/libXau                                       git://anongit.freedesktop.org/git/xorg/lib/libXau”
echo2 “xorg/lib/libXdmcp                                     git://anongit.freedesktop.org/git/xorg/lib/libXdmcp”
echo2 “xorg/xcb/pthread-stubs                                git://anongit.freedesktop.org/git/xcb/pthread-stubs”
echo2 “xorg/xcb/libxcb                                       git://anongit.freedesktop.org/git/xcb/libxcb”
echo2 “xorg/xcb/util                                         git://anongit.freedesktop.org/git/xcb/util”
echo2 “xorg/xcb/util-image                                   git://anongit.freedesktop.org/git/xcb/util-image”
echo2 “xorg/xcb/util-keysyms                                 git://anongit.freedesktop.org/git/xcb/util-keysyms”
echo2 “xorg/xcb/util-renderutil                              git://anongit.freedesktop.org/git/xcb/util-renderutil”
echo2 “xorg/xcb/util-wm                                      git://anongit.freedesktop.org/git/xcb/util-wm”
echo2 “xorg/lib/libX11                                       git://anongit.freedesktop.org/git/xorg/lib/libX11”
echo2 “xorg/lib/libXext                                      git://anongit.freedesktop.org/git/xorg/lib/libXext”
case $HOST_OS in
Darwin)
echo2 “xorg/lib/libAppleWM                                   git://anongit.freedesktop.org/git/xorg/lib/libAppleWM”
;;
CYGWIN*)
echo2 “xorg/lib/libWindowsWM                                 git://anongit.freedesktop.org/git/xorg/lib/libWindowsWM”
;;
esac
echo2 “xorg/lib/libdmx                                       git://anongit.freedesktop.org/git/xorg/lib/libdmx”
echo2 “xorg/lib/libfontenc                                   git://anongit.freedesktop.org/git/xorg/lib/libfontenc”
echo2 “xorg/lib/libFS                                        git://anongit.freedesktop.org/git/xorg/lib/libFS”
echo2 “xorg/lib/libICE                                       git://anongit.freedesktop.org/git/xorg/lib/libICE”
echo2 “xorg/lib/libSM                                        git://anongit.freedesktop.org/git/xorg/lib/libSM”
echo2 “xorg/lib/libXt                                        git://anongit.freedesktop.org/git/xorg/lib/libXt”
echo2 “xorg/lib/libXmu                                       git://anongit.freedesktop.org/git/xorg/lib/libXmu”
echo2 “xorg/lib/libXpm                                       git://anongit.freedesktop.org/git/xorg/lib/libXpm”
echo2 “xorg/lib/libXaw                                       git://anongit.freedesktop.org/git/xorg/lib/libXaw”
echo2 “xorg/lib/libXaw3d                                     git://anongit.freedesktop.org/git/xorg/lib/libXaw3d”
echo2 “xorg/lib/libXfixes                                    git://anongit.freedesktop.org/git/xorg/lib/libXfixes”
echo2 “xorg/lib/libXcomposite                                git://anongit.freedesktop.org/git/xorg/lib/libXcomposite”
echo2 “xorg/lib/libXrender                                   git://anongit.freedesktop.org/git/xorg/lib/libXrender”
echo2 “xorg/lib/libXdamage                                   git://anongit.freedesktop.org/git/xorg/lib/libXdamage”
echo2 “xorg/lib/libXcursor                                   git://anongit.freedesktop.org/git/xorg/lib/libXcursor”
echo2 “xorg/lib/libXfont                                     git://anongit.freedesktop.org/git/xorg/lib/libXfont”
echo2 “xorg/lib/libXft                                       git://anongit.freedesktop.org/git/xorg/lib/libXft”
echo2 “xorg/lib/libXi                                        git://anongit.freedesktop.org/git/xorg/lib/libXi”
echo2 “xorg/lib/libXinerama                                  git://anongit.freedesktop.org/git/xorg/lib/libXinerama”
echo2 “xorg/lib/libxkbfile                                   git://anongit.freedesktop.org/git/xorg/lib/libxkbfile”
echo2 “xorg/lib/libXrandr                                    git://anongit.freedesktop.org/git/xorg/lib/libXrandr”
echo2 “xorg/lib/libXRes                                      git://anongit.freedesktop.org/git/xorg/lib/libXRes”
echo2 “xorg/lib/libXScrnSaver                                git://anongit.freedesktop.org/git/xorg/lib/libXScrnSaver”
case $HOST_OS in
Linux)
echo2 “xorg/lib/libxshmfence                                 git://anongit.freedesktop.org/git/xorg/lib/libxshmfence”
;;
esac
echo2 “xorg/lib/libXtst                                      git://anongit.freedesktop.org/git/xorg/lib/libXtst”
echo2 “xorg/lib/libXv                                        git://anongit.freedesktop.org/git/xorg/lib/libXv”
echo2 “xorg/lib/libXvMC                                      git://anongit.freedesktop.org/git/xorg/lib/libXvMC”
echo2 “xorg/lib/libXxf86dga                                  git://anongit.freedesktop.org/git/xorg/lib/libXxf86dga”
echo2 “xorg/lib/libXxf86vm                                   git://anongit.freedesktop.org/git/xorg/lib/libXxf86vm”
echo2 “xorg/lib/libpciaccess                                 git://anongit.freedesktop.org/git/xorg/lib/libpciaccess”
echo2 “xorg/pixman                                           git://anongit.freedesktop.org/git/pixman”
echo2 “xorg/mesa/drm                                         git://anongit.freedesktop.org/git/mesa/drm”
echo2 “xorg/mesa/mesa                                        git://anongit.freedesktop.org/git/mesa/mesa”
echo2 “xorg/data/bitmaps                                     git://anongit.freedesktop.org/git/xorg/data/bitmaps”
echo2 “xorg/app/appres                                       git://anongit.freedesktop.org/git/xorg/app/appres”
echo2 “xorg/app/bdftopcf                                     git://anongit.freedesktop.org/git/xorg/app/bdftopcf”
echo2 “xorg/app/beforelight                                  git://anongit.freedesktop.org/git/xorg/app/beforelight”
echo2 “xorg/app/bitmap                                       git://anongit.freedesktop.org/git/xorg/app/bitmap”
echo2 “xorg/app/editres                                      git://anongit.freedesktop.org/git/xorg/app/editres”
echo2 “xorg/app/fonttosfnt                                   git://anongit.freedesktop.org/git/xorg/app/fonttosfnt”
echo2 “xorg/app/fslsfonts                                    git://anongit.freedesktop.org/git/xorg/app/fslsfonts”
echo2 “xorg/app/fstobdf                                      git://anongit.freedesktop.org/git/xorg/app/fstobdf”
echo2 “xorg/app/iceauth                                      git://anongit.freedesktop.org/git/xorg/app/iceauth”
echo2 “xorg/app/ico                                          git://anongit.freedesktop.org/git/xorg/app/ico”
echo2 “xorg/app/listres                                      git://anongit.freedesktop.org/git/xorg/app/listres”
echo2 “xorg/app/luit                                         git://anongit.freedesktop.org/git/xorg/app/luit”
echo2 “xorg/app/mkcomposecache                               git://anongit.freedesktop.org/git/xorg/app/mkcomposecache”
echo2 “xorg/app/mkfontdir                                    git://anongit.freedesktop.org/git/xorg/app/mkfontdir”
echo2 “xorg/app/mkfontscale                                  git://anongit.freedesktop.org/git/xorg/app/mkfontscale”
echo2 “xorg/app/oclock                                       git://anongit.freedesktop.org/git/xorg/app/oclock”
echo2 “xorg/app/rgb                                          git://anongit.freedesktop.org/git/xorg/app/rgb”
echo2 “xorg/app/rendercheck                                  git://anongit.freedesktop.org/git/xorg/app/rendercheck”
echo2 “xorg/app/rstart                                       git://anongit.freedesktop.org/git/xorg/app/rstart”
echo2 “xorg/app/scripts                                      git://anongit.freedesktop.org/git/xorg/app/scripts”
echo2 “xorg/app/sessreg                                      git://anongit.freedesktop.org/git/xorg/app/sessreg”
echo2 “xorg/app/setxkbmap                                    git://anongit.freedesktop.org/git/xorg/app/setxkbmap”
echo2 “xorg/app/showfont                                     git://anongit.freedesktop.org/git/xorg/app/showfont”
echo2 “xorg/app/smproxy                                      git://anongit.freedesktop.org/git/xorg/app/smproxy”
echo2 “xorg/app/twm                                          git://anongit.freedesktop.org/git/xorg/app/twm”
echo2 “xorg/app/viewres                                      git://anongit.freedesktop.org/git/xorg/app/viewres”
echo2 “xorg/app/x11perf                                      git://anongit.freedesktop.org/git/xorg/app/x11perf”
echo2 “xorg/app/xauth                                        git://anongit.freedesktop.org/git/xorg/app/xauth”
echo2 “xorg/app/xbacklight                                   git://anongit.freedesktop.org/git/xorg/app/xbacklight”
echo2 “xorg/app/xbiff                                        git://anongit.freedesktop.org/git/xorg/app/xbiff”
echo2 “xorg/app/xcalc                                        git://anongit.freedesktop.org/git/xorg/app/xcalc”
echo2 “xorg/app/xclipboard                                   git://anongit.freedesktop.org/git/xorg/app/xclipboard”
echo2 “xorg/app/xclock                                       git://anongit.freedesktop.org/git/xorg/app/xclock”
echo2 “xorg/app/xcmsdb                                       git://anongit.freedesktop.org/git/xorg/app/xcmsdb”
echo2 “xorg/app/xconsole                                     git://anongit.freedesktop.org/git/xorg/app/xconsole”
echo2 “xorg/app/xcursorgen                                   git://anongit.freedesktop.org/git/xorg/app/xcursorgen”
echo2 “xorg/app/xdbedizzy                                    git://anongit.freedesktop.org/git/xorg/app/xdbedizzy”
echo2 “xorg/app/xditview                                     git://anongit.freedesktop.org/git/xorg/app/xditview”
echo2 “xorg/app/xdm                                          git://anongit.freedesktop.org/git/xorg/app/xdm”
echo2 “xorg/app/xdpyinfo                                     git://anongit.freedesktop.org/git/xorg/app/xdpyinfo”
echo2 “xorg/app/xdriinfo                                     git://anongit.freedesktop.org/git/xorg/app/xdriinfo”
echo2 “xorg/app/xedit                                        git://anongit.freedesktop.org/git/xorg/app/xedit”
echo2 “xorg/app/xev                                          git://anongit.freedesktop.org/git/xorg/app/xev”
echo2 “xorg/app/xeyes                                        git://anongit.freedesktop.org/git/xorg/app/xeyes”
echo2 “xorg/app/xf86dga                                      git://anongit.freedesktop.org/git/xorg/app/xf86dga”
echo2 “xorg/app/xfd                                          git://anongit.freedesktop.org/git/xorg/app/xfd”
echo2 “xorg/app/xfontsel                                     git://anongit.freedesktop.org/git/xorg/app/xfontsel”
echo2 “xorg/app/xfs                                          git://anongit.freedesktop.org/git/xorg/app/xfs”
echo2 “xorg/app/xfsinfo                                      git://anongit.freedesktop.org/git/xorg/app/xfsinfo”
echo2 “xorg/app/xgamma                                       git://anongit.freedesktop.org/git/xorg/app/xgamma”
echo2 “xorg/app/xgc                                          git://anongit.freedesktop.org/git/xorg/app/xgc”
echo2 “xorg/app/xhost                                        git://anongit.freedesktop.org/git/xorg/app/xhost”
echo2 “xorg/app/xinit                                        git://anongit.freedesktop.org/git/xorg/app/xinit”
echo2 “xorg/app/xinput                                       git://anongit.freedesktop.org/git/xorg/app/xinput”
echo2 “xorg/app/xkbcomp                                      git://anongit.freedesktop.org/git/xorg/app/xkbcomp”
echo2 “xorg/app/xkbevd                                       git://anongit.freedesktop.org/git/xorg/app/xkbevd”
echo2 “xorg/app/xkbprint                                     git://anongit.freedesktop.org/git/xorg/app/xkbprint”
echo2 “xorg/app/xkbutils                                     git://anongit.freedesktop.org/git/xorg/app/xkbutils”
echo2 “xorg/app/xkill                                        git://anongit.freedesktop.org/git/xorg/app/xkill”
echo2 “xorg/app/xload                                        git://anongit.freedesktop.org/git/xorg/app/xload”
echo2 “xorg/app/xlogo                                        git://anongit.freedesktop.org/git/xorg/app/xlogo”
echo2 “xorg/app/xlsatoms                                     git://anongit.freedesktop.org/git/xorg/app/xlsatoms”
echo2 “xorg/app/xlsclients                                   git://anongit.freedesktop.org/git/xorg/app/xlsclients”
echo2 “xorg/app/xlsfonts                                     git://anongit.freedesktop.org/git/xorg/app/xlsfonts”
echo2 “xorg/app/xmag                                         git://anongit.freedesktop.org/git/xorg/app/xmag”
echo2 “xorg/app/xman                                         git://anongit.freedesktop.org/git/xorg/app/xman”
echo2 “xorg/app/xmessage                                     git://anongit.freedesktop.org/git/xorg/app/xmessage”
echo2 “xorg/app/xmh                                          git://anongit.freedesktop.org/git/xorg/app/xmh”
echo2 “xorg/app/xmodmap                                      git://anongit.freedesktop.org/git/xorg/app/xmodmap”
echo2 “xorg/app/xmore                                        git://anongit.freedesktop.org/git/xorg/app/xmore”
echo2 “xorg/app/xprop                                        git://anongit.freedesktop.org/git/xorg/app/xprop”
echo2 “xorg/app/xrandr                                       git://anongit.freedesktop.org/git/xorg/app/xrandr”
echo2 “xorg/app/xrdb                                         git://anongit.freedesktop.org/git/xorg/app/xrdb”
echo2 “xorg/app/xrefresh                                     git://anongit.freedesktop.org/git/xorg/app/xrefresh”
echo2 “xorg/app/xscope                                       git://anongit.freedesktop.org/git/xorg/app/xscope”
echo2 “xorg/app/xset                                         git://anongit.freedesktop.org/git/xorg/app/xset”
echo2 “xorg/app/xsetmode                                     git://anongit.freedesktop.org/git/xorg/app/xsetmode”
echo2 “xorg/app/xsetroot                                     git://anongit.freedesktop.org/git/xorg/app/xsetroot”
echo2 “xorg/app/xsm                                          git://anongit.freedesktop.org/git/xorg/app/xsm”
echo2 “xorg/app/xstdcmap                                     git://anongit.freedesktop.org/git/xorg/app/xstdcmap”
echo2 “xorg/app/xvidtune                                     git://anongit.freedesktop.org/git/xorg/app/xvidtune”
echo2 “xorg/app/xvinfo                                       git://anongit.freedesktop.org/git/xorg/app/xvinfo”
echo2 “xorg/app/xwd                                          git://anongit.freedesktop.org/git/xorg/app/xwd”
echo2 “xorg/app/xwininfo                                     git://anongit.freedesktop.org/git/xorg/app/xwininfo”
echo2 “xorg/app/xwud                                         git://anongit.freedesktop.org/git/xorg/app/xwud”
echo2 “xorg/xserver                                          git://anongit.freedesktop.org/git/xorg/xserver”
if [ X”$HOST_OS” != XDarwin ]; then
case $HOST_OS in
Linux)
echo2 “xorg/libevdev                                         git://anongit.freedesktop.org/git/libevdev”
echo2 “xorg/driver/xf86-input-evdev                          git://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdev”
echo2 “xorg/driver/xf86-input-joystick                       git://anongit.freedesktop.org/git/xorg/driver/xf86-input-joystick”
;;
FreeBSD | NetBSD | OpenBSD | Dragonfly | GNU/kFreeBSD)
echo2 “xorg/driver/xf86-input-joystick                       git://anongit.freedesktop.org/git/xorg/driver/xf86-input-joystick”
;;
esac

# And some drivers are only buildable on some CPUs.
case $HOST_CPU in
i*86 | amd64 | x86_64 | i86pc)
echo2 “xorg/driver/xf86-input-vmmouse                        git://anongit.freedesktop.org/git/xorg/driver/xf86-input-vmmouse”
;;
esac
echo2 “xorg/driver/xf86-input-keyboard                       git://anongit.freedesktop.org/git/xorg/driver/xf86-input-keyboard”
echo2 “xorg/driver/xf86-input-mouse                          git://anongit.freedesktop.org/git/xorg/driver/xf86-input-mouse”
echo2 “xorg/driver/xf86-input-synaptics                      git://anongit.freedesktop.org/git/xorg/driver/xf86-input-synaptics”
echo2 “xorg/driver/xf86-input-void                           git://anongit.freedesktop.org/git/xorg/driver/xf86-input-void”
case $HOST_OS in
FreeBSD)
case $HOST_CPU in
sparc64)
echo2 “xorg/driver xf86-video-sunffb                         git://anongit.freedesktop.org/git/xorg/driver”
;;
esac
;;
NetBSD | OpenBSD)
echo2 “xorg/driver/xf86-video-wsfb                           git://anongit.freedesktop.org/git/xorg/driver/xf86-video-wsfb”
echo2 “xorg/driver/xf86-video-sunffb                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-sunffb”
;;
Linux)
echo2 “xorg/driver/xf86-video-sisusb                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-sisusb”
echo2 “xorg/driver/xf86-video-sunffb                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-sunffb”
echo2 “xorg/driver/xf86-video-v4l                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-v4l”
echo2 “xorg/driver/xf86-video-xgixp                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-xgixp”
case $HOST_CPU in
i*86)
# AMD Geode CPU. Driver contains 32 bit assembler code
echo2 “xorg/driver/xf86-video-geode                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-geode”
;;
esac
;;
esac

# Some drivers are only buildable on some architectures
case $HOST_CPU in
sparc | sparc64)
echo2 “xorg/driver/xf86-video-suncg14                        git://anongit.freedesktop.org/git/xorg/driver/xf86-video-suncg14”
echo2 “xorg/driver/xf86-video-suncg3                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-suncg3”
echo2 “xorg/driver/xf86-video-suncg6                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-suncg6”
echo2 “xorg/driver/xf86-video-sunleo                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-sunleo”
echo2 “xorg/driver/xf86-video-suntcx                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-suntcx”
;;
i*86 | amd64 | x86_64 | i86pc)
echo2 “xorg/driver/xf86-video-i740                           git://anongit.freedesktop.org/git/xorg/driver/xf86-video-i740”
echo2 “xorg/driver/xf86-video-intel                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-intel”
;;
esac
echo2 “xorg/driver/xf86-video-apm                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-apm”
echo2 “xorg/driver/xf86-video-ark                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ark”
echo2 “xorg/driver/xf86-video-ast                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ast”

echo2 “xorg/driver/glamor                                    git://anongit.freedesktop.org/git/xorg/driver/glamor”

echo2 “xorg/driver/xf86-video-ati                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati”
echo2 “xorg/driver/xf86-video-chips                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-chips”
echo2 “xorg/driver/xf86-video-cirrus                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-cirrus”
echo2 “xorg/driver/xf86-video-dummy                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-dummy”
echo2 “xorg/driver/xf86-video-fbdev                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-fbdev”
echo2 “xorg/driver/xf86-video-glint                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-glint”
echo2 “xorg/driver/xf86-video-i128                           git://anongit.freedesktop.org/git/xorg/driver/xf86-video-i128”
echo2 “xorg/driver/xf86-video-mach64                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-mach64”
echo2 “xorg/driver/xf86-video-mga                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-mga”
echo2 “xorg/driver/xf86-video-modesetting                    git://anongit.freedesktop.org/git/xorg/driver/xf86-video-modesetting”
echo2 “xorg/driver/xf86-video-neomagic                       git://anongit.freedesktop.org/git/xorg/driver/xf86-video-neomagic”
echo2 “xorg/driver/xf86-video-nv                             git://anongit.freedesktop.org/git/xorg/driver/xf86-video-nv”
echo2 “xorg/driver/xf86-video-rendition                      git://anongit.freedesktop.org/git/xorg/driver/xf86-video-rendition”
echo2 “xorg/driver/xf86-video-r128                           git://anongit.freedesktop.org/git/xorg/driver/xf86-video-r128”
echo2 “xorg/driver/xf86-video-s3                             git://anongit.freedesktop.org/git/xorg/driver/xf86-video-s3”
echo2 “xorg/driver/xf86-video-s3virge                        git://anongit.freedesktop.org/git/xorg/driver/xf86-video-s3virge”
echo2 “xorg/driver/xf86-video-savage                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-savage”
echo2 “xorg/driver/xf86-video-siliconmotion                  git://anongit.freedesktop.org/git/xorg/driver/xf86-video-siliconmotion”
echo2 “xorg/driver/xf86-video-tdfx                           git://anongit.freedesktop.org/git/xorg/driver/xf86-video-tdfx”
echo2 “xorg/driver/xf86-video-tga                            git://anongit.freedesktop.org/git/xorg/driver/xf86-video-tga”
echo2 “xorg/driver/xf86-video-trident                        git://anongit.freedesktop.org/git/xorg/driver/xf86-video-trident”
echo2 “xorg/driver/xf86-video-tseng                          git://anongit.freedesktop.org/git/xorg/driver/xf86-video-tseng”
echo2 “xorg/driver/xf86-video-vesa                           git://anongit.freedesktop.org/git/xorg/driver/xf86-video-vesa”
echo2 “xorg/driver/xf86-video-vmware                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-vmware”
echo2 “xorg/driver/xf86-video-voodoo                         git://anongit.freedesktop.org/git/xorg/driver/xf86-video-voodoo”
fi
echo2 “xorg/data/cursors                                     git://anongit.freedesktop.org/git/xorg/data/cursors”

echo2 “xorg/freetype2                                        git://git.sv.gnu.org/freetype/freetype2.git”
echo2 “xorg/fontconfig                                       git://anongit.freedesktop.org/fontconfig”

echo2 “xorg/font/encodings                                   git://anongit.freedesktop.org/git/xorg/font/encodings”
echo2 “xorg/font/adobe-100dpi                                git://anongit.freedesktop.org/git/xorg/font/adobe-100dpi”
echo2 “xorg/font/adobe-75dpi                                 git://anongit.freedesktop.org/git/xorg/font/adobe-75dpi”
echo2 “xorg/font/adobe-utopia-100dpi                         git://anongit.freedesktop.org/git/xorg/font/adobe-utopia-100dpi”
echo2 “xorg/font/adobe-utopia-75dpi                          git://anongit.freedesktop.org/git/xorg/font/adobe-utopia-75dpi”
echo2 “xorg/font/adobe-utopia-type1                          git://anongit.freedesktop.org/git/xorg/font/adobe-utopia-type1”
echo2 “xorg/font/arabic-misc                                 git://anongit.freedesktop.org/git/xorg/font/arabic-misc”
echo2 “xorg/font/bh-100dpi                                   git://anongit.freedesktop.org/git/xorg/font/bh-100dpi”
echo2 “xorg/font/bh-75dpi                                    git://anongit.freedesktop.org/git/xorg/font/bh-75dpi”
echo2 “xorg/font/bh-lucidatypewriter-100dpi                  git://anongit.freedesktop.org/git/xorg/font/bh-lucidatypewriter-100dpi”
echo2 “xorg/font/bh-lucidatypewriter-75dpi                   git://anongit.freedesktop.org/git/xorg/font/bh-lucidatypewriter-75dpi”
echo2 “xorg/font/bh-ttf                                      git://anongit.freedesktop.org/git/xorg/font/bh-ttf”
echo2 “xorg/font/bh-type1                                    git://anongit.freedesktop.org/git/xorg/font/bh-type1”
echo2 “xorg/font/bitstream-100dpi                            git://anongit.freedesktop.org/git/xorg/font/bitstream-100dpi”
echo2 “xorg/font/bitstream-75dpi                             git://anongit.freedesktop.org/git/xorg/font/bitstream-75dpi”
echo2 “xorg/font/bitstream-type1                             git://anongit.freedesktop.org/git/xorg/font/bitstream-type1”
echo2 “xorg/font/cronyx-cyrillic                             git://anongit.freedesktop.org/git/xorg/font/cronyx-cyrillic”
echo2 “xorg/font/cursor-misc                                 git://anongit.freedesktop.org/git/xorg/font/cursor-misc”
echo2 “xorg/font/daewoo-misc                                 git://anongit.freedesktop.org/git/xorg/font/daewoo-misc”
echo2 “xorg/font/dec-misc                                    git://anongit.freedesktop.org/git/xorg/font/dec-misc”
echo2 “xorg/font/ibm-type1                                   git://anongit.freedesktop.org/git/xorg/font/ibm-type1”
echo2 “xorg/font/isas-misc                                   git://anongit.freedesktop.org/git/xorg/font/isas-misc”
echo2 “xorg/font/jis-misc                                    git://anongit.freedesktop.org/git/xorg/font/jis-misc”
echo2 “xorg/font/micro-misc                                  git://anongit.freedesktop.org/git/xorg/font/micro-misc”
echo2 “xorg/font/misc-cyrillic                               git://anongit.freedesktop.org/git/xorg/font/misc-cyrillic”
echo2 “xorg/font/misc-ethiopic                               git://anongit.freedesktop.org/git/xorg/font/misc-ethiopic”
echo2 “xorg/font/misc-meltho                                 git://anongit.freedesktop.org/git/xorg/font/misc-meltho”
echo2 “xorg/font/misc-misc                                   git://anongit.freedesktop.org/git/xorg/font/misc-misc”
echo2 “xorg/font/mutt-misc                                   git://anongit.freedesktop.org/git/xorg/font/mutt-misc”
echo2 “xorg/font/schumacher-misc                             git://anongit.freedesktop.org/git/xorg/font/schumacher-misc”
echo2 “xorg/font/screen-cyrillic                             git://anongit.freedesktop.org/git/xorg/font/screen-cyrillic”
echo2 “xorg/font/sony-misc                                   git://anongit.freedesktop.org/git/xorg/font/sony-misc”
echo2 “xorg/font/sun-misc                                    git://anongit.freedesktop.org/git/xorg/font/sun-misc”
echo2 “xorg/font/winitzki-cyrillic                           git://anongit.freedesktop.org/git/xorg/font/winitzki-cyrillic”
echo2 “xorg/font/xfree86-type1                               git://anongit.freedesktop.org/git/xorg/font/xfree86-type1”
echo2 “xorg/font/alias                                       git://anongit.freedesktop.org/git/xorg/font/alias”
echo2 “xorg/util/cf                                          git://anongit.freedesktop.org/git/xorg/util/cf”
echo2 “xorg/util/imake                                       git://anongit.freedesktop.org/git/xorg/util/imake”
echo2 “xorg/util/gccmakedep                                  git://anongit.freedesktop.org/git/xorg/util/gccmakedep”
echo2 “xorg/util/lndir                                       git://anongit.freedesktop.org/git/xorg/util/lndir”
echo2 “xorg/xkeyboard-config                                 git://anongit.freedesktop.org/git/xkeyboard-config”

echo2 “tool/automake-1.14.1                                  ftp://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.xz”
echo2 “tool/a2ps-4.14                                        ftp://ftp.gnu.org/gnu/a2ps/a2ps-4.14.tar.gz”
echo2 “core/e2fsprogs-1.42.8                                 core/e2fsprogs-1.42.8.tar.gz”
echo2 “core/acl                                              git://git.sv.gnu.org/acl”
echo2 “core/gawk                                             git://git.sv.gnu.org/gawk”
echo2 “tool/inetutils                                        git://git.sv.gnu.org/inetutils”
echo2 “tool/wget-1.14                                        tool/wget-1.14.tar.xz”
echo2 “tool/ConsoleKit                                       git://anongit.freedesktop.org/git/ConsoleKit.git \
–sysconfdir=/etc  –libdir=/lib64  –with-pam-module-dir=/lib64/security –localstatedir=/var \
–enable-udev-acl  –enable-pam-module”
}
#——————————————————————————
#                  Main script
#——————————————————————————

# Set variables supporting multiple binaries for a single source tree
HAVE_ARCH=”`uname -i`”
DIR_ARCH=””
DIR_CONFIG=”.”

# Set variables for conditionally building some components
HOST_OS=`uname -s`
export HOST_OS
HOST_CPU=`uname -m`
export HOST_CPU

if [ ! -r ./prelist ]; then
echo “Creating prelist of modules for first time use…”
echo “”
mkmodlist > ./prelist
fi

FILE_TO_BUILD=${FILE_TO_BUILD:=./prelist}
NOQUIT=0
BUILD_ONE=0
GITCMD=
CONFIGHELP=

# Process command line args
while [ $# != 0 ]
do
case $1 in
-A|–all)
ALLMOD=1
;;
-a)
NOAUTOGEN=1
;;
-b)
DIR_ARCH=”.build.$HAVE_ARCH”
DIR_CONFIG=”..”
;;
-C)
CONFIGURECMD=1
;;
-c)
CLEAN=1
;;
–confighelp)
CONFIGHELP=1
;;
-D)
DIST=1
;;
-d)
DISTCHECK=1
;;
–env)
required_arg $1 $2
shift
ENV_SET=`echo “$@” | sed ‘s, -.*,,’`
envnum=-1
for eachenv in $ENV_SET; do
envnum=`expr $envnum + 1`
done
shift $envnum
;;
-g)
CFLAGS=”${CFLAGS} -g3 -O0″
;;
-h|–help)
usage
exit 0
;;
-L)
LIST_ONLY=1
;;
-n)
NOQUIT=1
;;
-o)
required_arg $1 $2
shift
SINGLE_MOD=`echo “$@” | sed ‘s, -.*,,’`
modnum=-1
for modsingle in $SINGLE_MOD; do
modnum=`expr $modnum + 1`
done
shift $modnum
unset modnum
unset modsingle
BUILD_ONE=1
;;
-s)
required_arg $1 $2
shift
SUDO=$1
;;
–check)
CHECK=1
;;
–cmd)
required_arg $1 $2
shift
cmd1=`echo $1 | cut -d’ ‘ -f1`

# verify the command exists
which $cmd1 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo “The specified command ‘$cmd1’ does not appear to exist”
echo “”
usage
exit 1
fi

case X”$cmd1″ in
X”git”)
GITCMD=$1
;;
X”make” | X”gmake”)
if [ X”$2″ != X ] && [ `expr “$2” : “^-“` -eq 0 ]; then
MAKECMD=$2
shift
else
MAKECMD=`echo “$1” | sed ‘s,[^ ]*,,’ | sed ‘s,^ ,,’`
fi
if [ -z “$MAKECMD” ]; then
MAKECMD=NONE
fi
;;
*)
echo “The script can only process ‘make’, ‘gmake’, or ‘git’ commands”
echo “It can’t process ‘$cmd1’ commands”
echo “”
usage
exit 1
;;
esac
;;
–configflags)
shift
CONFFLAGS=$1
;;
–modfile)
required_arg $1 $2
shift
if [ ! -r “$1” ]; then
echo “can’t find/read file ‘$1′”
exit 1
fi
FILE_TO_BUILD=$1
;;
-U|–update)
PULL=1
;;
-u|–updatelist)
required_arg2 $1 $2 $3
updatemodfile $2
exit 0
;;
–retry)
RETRY_VERBOSE=1
PULL=1
;;
*)
PREFIX_ARG=`echo “$@”`
arg_code=0
if expr “$PREFIX_ARG” : “–prefix[= ].” 1>/dev/null; then
arg_code=1
fi
if expr “$PREFIX_ARG” : “–installroot[= ].” 1>/dev/null; then
arg_code=2
fi

case $arg_code in
1)
PREFIX=`echo “$PREFIX_ARG” | sed ‘s,–prefix \+=,–prefix=,’`
PREFIX=`echo “$PREFIX” | sed ‘s,–prefix= \+,–prefix=,’`
PREFIX=`echo “$PREFIX” | sed ‘s,=, ,’`
PREFIX=`echo “$PREFIX” | cut -d’ ‘ -f2`
if expr “$PREFIX” : “^-” 1>/dev/null; then
echo “‘prefix’ appears to be an option”
echo “”
usage
exit 1
fi

if expr “$PREFIX_ARG” : “–prefix \+=” 1>/dev/null; then
shift
fi
if expr “$PREFIX_ARG” : “–prefix *= \+” 1>/dev/null; then
shift
fi
if expr “$PREFIX_ARG” : “–prefix \+[^ =]” 1>/dev/null; then
shift
fi
;;
2)
DESTDIRVAR=`echo “$PREFIX_ARG” | sed ‘s,–installroot \+=,–installroot=,’`
DESTDIRVAR=`echo “$DESTDIRVAR” | sed ‘s,–installroot= \+,–installroot=,’`
DESTDIRVAR=`echo “$DESTDIRVAR” | sed ‘s,=, ,’`
DESTDIRVAR=`echo “$DESTDIRVAR” | cut -d’ ‘ -f2`
if expr “$DESTDIRVAR” : “^-” 1>/dev/null; then
if expr “$PREFIX_ARG” : “–installroot \+-” 1>/dev/null ||\
expr “$PREFIX_ARG” : “–installroot= \+-” 1>/dev/null; then
DESTDIRVAR=””
else
echo “‘installroot’ appears to be an option”
echo “”
usage
exit 1
fi
else
DESTDIRVAR=`echo $DESTDIRVAR | sed ‘s,/$,,’`

if expr “$PREFIX_ARG” : “–installroot \+=” 1>/dev/null; then
shift
fi
if expr “$PREFIX_ARG” : “–installroot *= \+” 1>/dev/null; then
shift
fi
if expr “$PREFIX_ARG” : “–installroot \+[^ =]” 1>/dev/null; then
shift
fi
fi
;;
*)
echo “unrecognized and/or too many command-line arguments”
echo ”  Arguments:      $1″
echo “”
usage
exit 1
;;
esac

;;
esac

shift
done
if [ -n “$LIST_ONLY” ]; then
modlistdisplay
exit 0
fi
if [ $BUILD_ONE -eq 0 ];then
buildgeneral
else
build_onemod “$SINGLE_MOD”
fi

# Print the end date/time to compare with the start date/time
date

Advertisements

Gửi phản hồi

Website này sử dụng Akismet để hạn chế spam. Tìm hiểu bình luận của bạn được duyệt như thế nào.

%d bloggers like this: