[PATCH v3 modular 2/3] build.sh: support CC, CPP, CPPFLAGS and CFLAGS

Dan Nicholson dbn.lists at gmail.com
Fri Dec 3 19:01:18 PST 2010


On Fri, Dec 3, 2010 at 11:32 AM, Gaetan Nadon <memsize at videotron.ca> wrote:
> There is a requirement for some build environment to set CC
> to something other than the Autoconf default.
>
> There is already a variable CONFCFLAGS in place that can handle C flags,
> however it was more a side-effect of adding -g option rather than
> a comprehensive support for C flags.
>
> The user interface for build.sh should closely follow the Autoconf one.
> Rather than inventing new variable names, let's use the ones
> Autoconf uses. The user will not have to learn two interfaces
> and do the mental mapping.
>
> Reviewed-by: Trevor Woerner <twoerner at gmail.com>
> Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> ---
>
>        Third edition: change quoting for CC/CFLAGS/CPP/CPPFLAGS/LDFLAGS
>
>  build.sh |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/build.sh b/build.sh
> index 075e9f4..33120e0 100755
> --- a/build.sh
> +++ b/build.sh
> @@ -15,6 +15,13 @@ global environment variables you may set to replace default functionality:
>             (default: git://anongit.freedesktop.org/git)
>
>  global environment variables you may set to augment functionality:
> +  CC          C compiler command
> +  CFLAGS      C compiler flags
> +  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
> +              nonstandard directory <lib dir>
> +  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
> +              you have headers in a nonstandard directory <include dir>
> +  CPP         C preprocessor
>   CONFFLAGS:  additional flags to pass to all configure scripts
>   CONFCFLAGS: additional compile flags to pass to all configure scripts
>   MAKEFLAGS:  additional flags to pass to all make invocations
> @@ -348,7 +355,14 @@ process() {
>     if [ $needs_config -eq 1 ] || [ X"$NOAUTOGEN" = X ]; then
>        sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
>            ${QUIET:+--quiet} \
> -           ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS"
> +           ${CACHE:+--cache-file=}${CACHE} \
> +           ${CONFFLAGS} \
> +           ${CC:+CC="$CC"} \
> +           ${CPP:+CPP="$CPP"} \
> +           ${CPPFLAGS:+CPPFLAGS="$CPPFLAGS"} \
> +           ${CFLAGS:+CFLAGS="$CFLAGS"} \
> +           ${LDFLAGS:+LDFLAGS="$LDFLAGS"} \
> +           "$CONFCFLAGS"
>        if [ $? -ne 0 ]; then
>            failed ${CONFCMD} $1 $2
>            cd $old_pwd

Yeah, that seems better, although CACHE should get the same treatment
with the braces.

Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>


More information about the xorg-devel mailing list