[PATCH 3/3] docker: Pass extra options to configure

Samuel Mendoza-Jonas sam at mendozajonas.com
Thu Aug 2 10:35:50 AEST 2018


On Wed, 2018-08-01 at 14:20 -0700, Geoff Levand wrote:
> Hi Sam,
> 
> On 07/31/2018 10:53 PM, Samuel Mendoza-Jonas wrote:
> > Pass extra configure options and CFLAGS/LDFLAGS to docker to enable
> > building multiple configurations.
> > 
> > Signed-off-by: Samuel Mendoza-Jonas <sam at mendozajonas.com>
> > ---
> >  docker/build-pb | 16 +++++++++++++---
> >  1 file changed, 13 insertions(+), 3 deletions(-)
> > 
> > diff --git a/docker/build-pb b/docker/build-pb
> > index ad08ef9..baac2fd 100755
> > --- a/docker/build-pb
> > +++ b/docker/build-pb
> > @@ -18,15 +18,18 @@ usage () {
> >  	echo "  -i --interactive - Run an interactive pb-builder container." >&2
> >  	echo "  -t --tag         - Print Docker tag to stdout and exit." >&2
> >  	echo "  -v --verbose     - Verbose execution." >&2
> > +	echo "  -o --options     - Extra arguments for configure." >&2
> 
> These are in alphabetical order, so put -o between -i and -t.
> 
> Would configure-opts be a better long name?

Sounds good, will fixup.

> 
> >  	echo "Environment:" >&2
> >  	echo "  DOCKER_TAG       - Default: '${DOCKER_TAG}'" >&2
> > +	echo "  CFLAGS           - Default: '${CFLAGS}'" >&2
> > +	echo "  LDFLAGS          - Default: '${LDFLAGS}'" >&2
> >  	echo "Examples:" >&2
> >  	echo "  ${name} -vc"
> >  	echo "  ${name} -v"
> >  }
> >  
> > -short_opts="cdhitv"
> > -long_opts="check,dry-run,help,interactive,tag,verbose"
> > +short_opts="cdhitvo:"
> 
> "cdhio:tv"
> 
> > +long_opts="check,dry-run,help,interactive,tag,verbose,options:"
> 
> long_opts="check,dry-run,help,interactive,options:,tag,verbose"
> 
> >  
> >  opts=$(getopt --options ${short_opts} --long ${long_opts} -n "${name}" -- "$@")
> >  
> > @@ -43,6 +46,11 @@ while true ; do
> >  		check=1
> >  		shift
> >  		;;
> > +	-o | --options)
> 
> And this goes after the '-i --interactive' case.
> 
> > +		shift
> > +		configure_opts=${1}
> 
> You've got configure_opts here...
> 
> > +		shift
> > +		;;
> >  	-d | --dry-run)
> >  		dry_run=1
> >  		shift
> > @@ -112,8 +120,10 @@ else
> >  	docker_extra="true"
> >  fi
> >  
> > +flags="CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS}"
> > +
> >  cd "${TOP_DIR}"
> >  docker_args="${docker_base_args} ${docker_user_args}"
> >  run_cmd "docker run ${docker_args} ${DOCKER_TAG} /bin/bash \
> >  	-e ${bash_debug} \
> > -	-c './bootstrap && ./configure --with-ncurses && make && ${docker_extra}'"
> > +	-c './bootstrap && ${flags} ./configure ${configure_args[@]} && make && ${docker_extra}'"
> 
> And configure_args here.  Maybe change this to configure_opts?

Arg, I squashed this very fixup into the wrong commit! Yes it would make
much more sense for the variable names to agree :)

> 
> -Geoff




More information about the Petitboot mailing list