From: Trevor Woerner <[email protected]>

Allow a user to specify per-component configure options by
providing them in the --modfile file. Any text remaining on
a line following a given module/component is assumed to be
options which will be passed to the configuration script.

Signed-off-by: Trevor Woerner <[email protected]>
---
 build.sh |   40 +++++++++++++++++++++++++++-------------
 1 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/build.sh b/build.sh
index b01d652..5c34eb7 100755
--- a/build.sh
+++ b/build.sh
@@ -148,11 +148,13 @@ failed() {
 # arguments:
 #   $1 - module
 #   $2 - component
+#   $3 - configuration options
 # returns:
 #   (irrelevant)
 module_title() {
     module=$1
     component=$2
+    confopts="$3"
     # preconds
     if [ X"$module" = X ]; then
        return
@@ -161,6 +163,7 @@ module_title() {
     echo ""
     echo 
"======================================================================"
     echo "==  Processing module/component:  \"$module/$component\""
+    echo "==        configuration options:  \"$confopts\""
 }
 
 checkfortars() {
@@ -341,7 +344,8 @@ clone() {
 # perform processing of each module/component
 # arguments:
 #   $1 - module
-#   $2 - component (optional)
+#   $2 - component
+#   $3 - configure options
 # returns:
 #   0 - good
 #   1 - bad
@@ -349,29 +353,30 @@ process() {
     needs_config=0
 
     module=$1
-    component=$2
+    component="$2"
+    confopts="$3"
     # preconds
     if [ X"$module" = X ]; then
        echo "process() required first argument is missing"
        return 1
     fi
 
-    module_title $module $component
+    module_title $module "$component" "$confopts"
 
     SRCDIR=""
     CONFCMD=""
-    if [ -f $module/$component/autogen.sh ]; then
+    if [ -f $module/"$component"/autogen.sh ]; then
         SRCDIR="$module/$component"
         CONFCMD="autogen.sh"
     elif [ X"$CLONE" != X ]; then
-        clone $module $component
+        clone $module "$component"
         if [ $? -eq 0 ]; then
            SRCDIR="$module/$component"
            CONFCMD="autogen.sh"
         fi
        needs_config=1
     else
-        checkfortars $module $component
+        checkfortars $module "$component"
         CONFCMD="configure"
     fi
 
@@ -451,7 +456,8 @@ process() {
            ${CPP:+CPP="$CPP"} \
            ${CPPFLAGS:+CPPFLAGS="$CPPFLAGS"} \
            ${CFLAGS:+CFLAGS="$CFLAGS"} \
-           ${LDFLAGS:+LDFLAGS="$LDFLAGS"}
+           ${LDFLAGS:+LDFLAGS="$LDFLAGS"} \
+           $confopts
        if [ $? -ne 0 ]; then
            failed ${CONFCMD} $module $component
            cd $old_pwd
@@ -536,13 +542,15 @@ process() {
 # LISTONLY, RESUME, NOQUIT, and BUILD_ONE
 # arguments:
 #   $1 - module
-#   $2 - component (optional)
+#   $2 - component
+#   $3 - configure options
 # returns:
 #   0 - good
 #   1 - bad
 build() {
     module=$1
-    component=$2
+    component="$2"
+    confopts="$3"
     if [ X"$LISTONLY" != X ]; then
        echo "$module/$component"
        return 0
@@ -558,7 +566,7 @@ build() {
        fi
     fi
 
-    process $module $component
+    process $module "$component" "$confopts"
     if [ $? -ne 0 ]; then
        echo "build.sh: error processing module/component:  
\"$module/$component\""
        if [ X"$NOQUIT" = X ]; then
@@ -1009,9 +1017,15 @@ process_module_file() {
            continue
        fi
 
-       module=`echo $line | cut -d'/' -f1`
-       component=`echo $line | cut -d'/' -f2`
-       build $module $component
+       module=`echo $line | cut -d' ' -f1 | cut -d'/' -f1`
+       component=`echo $line | cut -d' ' -f1 | cut -d'/' -f2`
+       confopts_check=`echo $line | cut -d' ' -f2-`
+       if [ "$module/$component" = "$confopts_check" ]; then
+           confopts=""
+       else
+           confopts="$confopts_check"
+       fi
+       build $module "$component" "$confopts"
     done <"$MODFILE"
 
     return 0
-- 
1.7.6.233.gd79bc

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to