[PATCH build 08/10] Configure only when necessary.

Trevor Woerner twoerner at gmail.com
Sat Sep 18 13:12:20 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

The autoconfig/automake system knows to rerun configure when the
configuration changes, therefore the script doesn't need to blindly
configure every time it wants to build each module.

Provide a cmdline argument to force reconfiguration if the user
so wishes to reconfigure each module prior to building.

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
 build.sh |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/build.sh b/build.sh
index ce58919..0677c99 100755
--- a/build.sh
+++ b/build.sh
@@ -242,6 +242,8 @@ clone() {
 #   0 - good
 #   1 - bad
 process() {
+    local _need_config=0
+
     # preconds
     if [ -z "$1" ]; then
 	errout "internal error! required argument \$1 not provided"
@@ -252,6 +254,7 @@ process() {
 
     # do we need to clone?
     if [ ! -d "$1/$2" ]; then
+	_need_config=1
 	clone $1 $2
 	if [ $? -ne 0 ]; then
 	    return 1
@@ -295,25 +298,25 @@ process() {
 	fi
     fi
 
-    # Special configure flags for certain modules
-    MOD_SPECIFIC=
-
-    if [ "$1" = "lib" ] && [ "$2" = "libX11" ] && [ "${USE_XCB}" = "NO" ]; then
-	MOD_SPECIFIC="--with-xcb=no"
-    fi
+    if [ $_need_config -eq 1 ] || [ -n "$RECONFIG" ]; then
+	# Special configure flags for certain modules
+	MOD_SPECIFIC=
+	if [ "$1" = "lib" ] && [ "$2" = "libX11" ] && [ "${USE_XCB}" = "NO" ]; then
+	    MOD_SPECIFIC="--with-xcb=no"
+	fi
 
-    LIB_FLAGS=
-    if [ -n "$LIBDIR" ]; then
-        LIB_FLAGS="--libdir=${PREFIX}/${LIBDIR}"
-    fi
+	LIB_FLAGS=
+	if [ -n "$LIBDIR" ]; then
+	    LIB_FLAGS="--libdir=${PREFIX}/${LIBDIR}"
+	fi
 
-    # Use "sh autogen.sh" since some scripts are not executable in CVS
-    if [ -z "$NOAUTOGEN" ]; then
-        sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
+	# Use "sh autogen.sh" since some scripts are not executable in CVS
+	sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
 	    ${MOD_SPECIFIC} ${QUIET:+--quiet} \
 	    ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS" || \
 	    failed ${CONFCMD} $1 $2
     fi
+
     ${MAKE} $MAKEFLAGS || failed make $1 $2
     if [ -n "$CHECK" ]; then
         ${MAKE} $MAKEFLAGS check || failed check $1 $2
@@ -839,6 +842,7 @@ usage() {
     echo "  -s sudo-command : sudo command to use"
     echo "  --autoresume file : autoresume from file"
     echo "  --check : run make check in addition to others"
+    echo "  --reconfigure : run configure scripts again"
     echo ""
     echo "Usage: $0 -L"
     echo "  -L : just list modules to build"
@@ -852,7 +856,7 @@ DIR_CONFIG="."
 LIB_ONLY=0
 
 # Process command line args
-CMDLINE=`getopt -o abcdDf:ghklo:pr:s:L --long check,help,autoresume:,keep-going -n $0 -- "$@"`
+CMDLINE=`getopt -o bcdDf:ghklo:pr:s:L --long check,help,autoresume:,keep-going,reconfigure -n $0 -- "$@"`
 if [ $? != 0 ]; then
     errout "getopt(1) invocation error"
     exit 1
@@ -860,9 +864,6 @@ fi
 eval set -- "$CMDLINE"
 while [ 1 ]; do
     case $1 in
-    -a)
-	NOAUTOGEN=1
-	;;
     -b)
 	DIR_ARCH=".build.$HAVE_ARCH"
 	DIR_CONFIG=".."
@@ -922,6 +923,9 @@ while [ 1 ]; do
     -L)
 	LISTONLY=1
 	;;
+    --reconfigure)
+	RECONFIG=1
+	;;
     --)
 	shift
 	break
-- 
1.7.3.rc2



More information about the xorg-devel mailing list