[Sugar-devel] [PATCH sugar] Allow to build outside the source directory

James Cameron quozl at laptop.org
Tue Jun 26 20:42:31 EDT 2012


On Tue, Jun 26, 2012 at 02:26:02PM +0200, Daniel Narvaez wrote:
> From: Daniel Narvaez <dwnarvaez at gmail.com>
> 
> This is based on a patch by
> Marco Pesenti Gritti <marco at marcopg.org>,
> with reviewer comments addressed.
> ---
>  autogen.sh |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/autogen.sh b/autogen.sh
> index a71e202..bac5247 100755
> --- a/autogen.sh
> +++ b/autogen.sh
> @@ -1,4 +1,13 @@
>  #!/bin/sh
> +
> +test -n "${srcdir}" || srcdir=`dirname "$0"`
> +test -n "${srcdir}" || srcdir="$(pwd)"

I don't quite understand the intent here.  The dirname should always
succeed.  The value depends on how the script is called.  I see four
methods of calling the script:

1.  ./autogen.sh ... dirname will yield .

2.  /path/autogen.sh ... dirname will yield /path

3.  sh autogen.sh ... dirname will yield .

4.  sh /path/autogen.sh ... dirname will yield /path

All methods yield the correct path for the context.

If the dirname always succeeds, the second test can be removed.

What is the situation where the first dirname fails to return data?

> +
> +olddir="$(pwd)"
> +cd "$srcdir"
> +
>  intltoolize
>  autoreconf -i
> -./configure --enable-maintainer-mode "$@"
> +
> +cd "$olddir"
> +"$srcdir/configure" --enable-maintainer-mode "$@"
> -- 

This is fine.  I like it.

-- 
James Cameron
http://quozl.linux.org.au/


More information about the Sugar-devel mailing list