[PATCH modular 1/3] Process a user-supplied list of module/components.
Trevor Woerner
twoerner at gmail.com
Mon Oct 4 03:54:18 PDT 2010
From: Trevor Woerner <twoerner at gmail.com>
New feature. Allow the user to supply, on the cmdline, a space-separated list
of module/components to process, the script will process only those listed
module/components. The list can be in any arbitrary order, the script takes
care to process them in their correct, dependency order. Warn the user should
there be any module/components from the list which aren't processed (probably
due to misspelling).
Suggested usage:
1. run the script, only generating the list of modules, redirected to a file
$ build.sh -L > list
2. edit list, removing any unneeded module/components
3. run the build as follows:
$ build.sh $PREFIX --modlist "`cat list`" ...
Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
build.sh | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 92 insertions(+), 17 deletions(-)
diff --git a/build.sh b/build.sh
index 6c76a5c..fb15cb1 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+APP=$0
+
envoptions() {
cat << EOF
global environment variables you may set:
@@ -864,6 +866,69 @@ build_doc() {
build doc xorg-docs
}
+# just build the modules supplied on the command-line,
+# in their correct order, as found in $MODULES
+# arguments:
+# (none)
+# returns:
+# 0 - good
+# 1 - bad
+process_modules() {
+ local inorder
+ local noorder
+ local module
+ local component
+ local processed=""
+ local mc
+ local found
+ local notprocessed=""
+
+ # preconds
+ if [ X"$MODULES" = X ]; then
+ echo "internal process_modules() error, \$MODULES is empty"
+ return 1
+ fi
+
+ # process module/components in-order
+ for inorder in `$APP -L`; do
+ for noorder in $MODULES; do
+ if [ X"$inorder" = X"$noorder" ]; then
+ module=`echo $noorder | cut -d'/' -f1`
+ component=`echo $noorder | cut -d'/' -f2`
+ build $module $component
+ processed="$processed $noorder"
+ fi
+ done
+ done
+
+ # check user-supplied list for extras which weren't processed
+ for noorder in $MODULES; do
+ found=0
+ for mc in $processed; do
+ if [ X"$noorder" = X"$mc" ]; then
+ found=1
+ break
+ fi
+ done
+ if [ $found -eq 0 ]; then
+ notprocessed="$notprocessed $noorder"
+ fi
+ done
+
+ # if any modules from the user-list are not processed
+ # warn the user
+ if [ X"$notprocessed" != X ]; then
+ echo ""
+ echo "***** WARNING: the following user-supplied module/components were not processed *****"
+ for mc in $notprocessed; do
+ echo " $mc"
+ done
+ echo ""
+ fi
+
+ return 0
+}
+
usage() {
echo "Usage: $0 [options] prefix"
echo " where options are:"
@@ -886,6 +951,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 " --modlist mods : only process the given space-separated list of modules"
echo ""
echo "Usage: $0 -L"
echo " -L : just list modules to build"
@@ -984,6 +1050,11 @@ do
exit 1
fi
;;
+ --modlist)
+ shift
+ CLONE=1
+ MODULES=$1
+ ;;
*)
if [ X"$PREFIX" != X ]; then
echo "unrecognized and/or too many command-line arguments"
@@ -1014,23 +1085,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"$MODULES" = 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_modules
fi
if [ X"$LISTONLY" != X ]; then
--
1.7.3.1.50.g1e633
More information about the xorg-devel
mailing list