[PATCH modular 03/13] build.sh: allow user to specify an alternate bin directory

Gaetan Nadon memsize at videotron.ca
Thu Dec 30 07:59:22 PST 2010


On Wed, 2010-12-29 at 20:28 -0500, Trevor Woerner wrote:

> Not to belabour the point too much, but I think the following patch
> does what you want to do with #3 of this patch series:
> 
> diff --git a/build.sh b/build.sh
> index 80452d3..465bd03 100755
> --- a/build.sh
> +++ b/build.sh
> @@ -7,6 +7,8 @@ Environment variables specific to build.sh:
>                Each module/components is invoked with --prefix
>    EPREFIX     Install architecture-dependent files in EPREFIX [PREFIX]
>                Each module/components is invoked with --exec-prefix
> +  BINDIR      Install user executables [EPREFIX/bin]
> +              Each module/component is invoked with --bindir
>    QUIET       Do not print messages saying which checks are being made
>                Each module/components is invoked with --quite
>    GITROOT     Source code repository path [git://anongit.freedesktop.org/git]
> @@ -67,7 +69,7 @@ setup_buildenv() {
>      export LD_LIBRARY_PATH
> 
>      # Set the path so that locally built apps will be found and used
> -    PATH=${DESTDIR}${EPREFIX}/bin${PATH+:$PATH}
> +    PATH=${DESTDIR}${BINDIR-$EPREFIX/bin}${PATH+:$PATH}

This line does not work. EPREFIX has not been set by the user and has
not been assigned a default value.
Yet, we need a real full path to add to the PATH env variable.
This is why I need to have the *DIR variables to always be set to a
value.

I did a small sample, using the a few lines:

    check_full_path ${PREFIX:-/usr/local} PREFIX
    check_full_path ${EPREFIX:-${$PREFIX:-/usr/local}} EPREFIX
    check_full_path ${BINDIR:-${EPREFIX:-${$PREFIX:-/usr/local}}/bin}
BINDIR or something similar :-)

Aside from having to specify the default value every where a variable is
used, there is a cascading effect
as many variables depend on the value of another variable. What you
propose would work fine in simple cases where you use a variable once or
twice and there is no "composite" assignment.

Just to put in different words, in the way the patches are today, the
DIR variables hold their final values, the default values and used only
once and the _SET variables tells us to isssue the command line option
such as --bindir or not.

I think patch 15 is a big improvement and I may be able to make it
better later today. 

If you have a solution, you can use the same calls to check_full_path to
illustrate how it would work.


>      export PATH
> 
>      # Choose which make program to use
> @@ -366,6 +368,7 @@ process() {
>         sh ${DIR_CONFIG}/${CONFCMD} \
>             --prefix=${PREFIX} \
>             ${EPREFIX_SET:+--exec-prefix="$EPREFIX"} \
> +           ${BINDIR+--bindir="$BINDIR"}
>             ${LIB_FLAGS} \
>             ${QUIET:+--quiet} \
>             ${CONFFLAGS} \
> 
> 
> 
> Of the 3 changes, the first is the same as your original.
> 
> In the 2nd change: if BINDIR is set then it will be used in the PATH=
> line, otherwise the default of $EPREFIX/bin will be substituted. If
> you wanted to be more explicit, a variable called BINDIR_DEFAULT could
> be defined as "$EPREFIX/bin" and used in this case.
> 
> For the 3rd change: if BINDIR does not exist then the
> --bindir="$BINDIR" configuration option will not be emitted.
> 
> No need for BINDIR_SET variables, no need for explicitly setting the
> default value of BINDIR if BINDIR_SET is not defined. Or am I still
> not "getting" it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101230/d92ca6d6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20101230/d92ca6d6/attachment.pgp>


More information about the xorg-devel mailing list