From: Trevor Woerner <[email protected]>

New feature.

Using the new "--modlist <file>" option, the user can specify a file which
contains a list of the sub-projects to process. The file can contain blank
lines as well as comment lines which start with a hash mark (#). The
sub-projects will be processed in the order in which they are found in the
list file.

Suggested usage:
    1. run script to generate the list of sub-projects, redirecting to a file
        $ util/modular/build.sh -L > list
    2. edit <list>, commenting-out or deleting unnecessary lines, or adding
       new lines as appropriate
    3. run the build with this list
        $ util/modular/build.sh --modfile list

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

diff --git a/build.sh b/build.sh
index 1e31c2a..bbe4d46 100755
--- a/build.sh
+++ b/build.sh
@@ -864,6 +864,52 @@ build_doc() {
     build doc xorg-docs
 }
 
+# just process the sub-projects supplied in the given file ($MODFILE)
+# in the order in which they are found in the list
+# (prerequisites and ordering are the responsibility of the user)
+# globals used:
+#   $MODFILE - readable file containing list of modules to process
+# arguments:
+#   (none)
+# returns:
+#   0 - good
+#   1 - bad
+process_module_file() {
+    local line
+    local module
+    local component
+
+    # preconds
+    if [ X"$MODFILE" = X ]; then
+       echo "internal process_module_file() error, \$MODFILE is empty"
+       return 1
+    fi
+    if [ ! -r "$MODFILE" ]; then
+       echo "module file '$MODFILE' is not readable or does not exist"
+       return 1
+    fi
+
+    # read from input file, skipping blank and comment lines
+    while read line; do
+       # skip blank lines
+       if [ X"$line" = X ]; then
+           continue
+       fi
+
+       # skip comment lines
+       echo "$line" | grep "^#" > /dev/null
+       if [ $? -eq 0 ]; then
+           continue
+       fi
+
+       module=`echo $line | cut -d'/' -f1`
+       component=`echo $line | cut -d'/' -f2`
+       build $module $component
+    done <"$MODFILE"
+
+    return 0
+}
+
 usage() {
     echo "Usage: $0 [options] prefix"
     echo "  where options are:"
@@ -886,6 +932,7 @@ usage() {
     echo "  --check : run make check in addition to others"
     echo "  --clone : clone non-existing repositories (uses \$GITROOT if set)"
     echo "  --cmd cmd : execute arbitrary git or make command 'cmd'"
+    echo "  --modfile file : only process the module/components specified in 
'file'"
     echo ""
     echo "Usage: $0 -L"
     echo "  -L : just list modules to build"
@@ -1022,6 +1069,16 @@ do
            exit 1
        fi
        ;;
+    --modfile)
+       required_arg $1 $2
+       shift
+       CLONE=1
+       if [ ! -r "$1" ]; then
+           echo "can't find/read file '$1'"
+           exit 1
+       fi
+       MODFILE=$1
+       ;;
     *)
        if [ X"$PREFIX" != X ]; then
            echo "unrecognized and/or too many command-line arguments"
@@ -1064,23 +1121,27 @@ if [ X"$LISTONLY" = X ]; then
     date
 fi
 
-# We must install the global macros before anything else
-build util macros
-build font util
-
-build_proto
-build_lib
-build_mesa
-
-if [ $LIB_ONLY -eq 0 ]; then
-    build_doc
-    build data bitmaps
-    build_app
-    build_xserver
-    build_driver
-    build_data
-    build_font
-    build_util
+if [ X"$MODFILE" = X ]; then
+    # We must install the global macros before anything else
+    build util macros
+    build font util
+
+    build_proto
+    build_lib
+    build_mesa
+
+    if [ $LIB_ONLY -eq 0 ]; then
+       build_doc
+       build data bitmaps
+       build_app
+       build_xserver
+       build_driver
+       build_data
+       build_font
+       build_util
+    fi
+else
+    process_module_file
 fi
 
 if [ X"$LISTONLY" != X ]; then
-- 
1.7.3.1.50.g1e633

_______________________________________________
[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