[PATCH modular] Per-component configure options

Gaetan Nadon memsize at videotron.ca
Wed Jan 18 11:32:48 PST 2012


On 12-01-16 06:22 PM, Trevor Woerner wrote:
> From: Trevor Woerner <twoerner at gmail.com>
>
> 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.
How will anyone know that this feature even exists?
It does not show up in the --help as it is not a command line option or
an env var. One day we will need a man page :-)

We already have --confflags option (and CONFFLAGS env var). I suppose
the per module conf option will be in addition to the (global) confflags.


> Signed-off-by: Trevor Woerner <twoerner at gmail.com>
> ---
>  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\""
Should it not also show the $CONFFLAGS option? They were not shown
before, but now it would be misleading to only show the per module
option. A popular one is --without-fop.
>  }
>  
>  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
Perhaps it should be following CONFFLAGS to alert the reader.
Would it need ${} like CONFFLAGS?
>  	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



More information about the xorg-devel mailing list