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

Daniel Narvaez dwnarvaez at gmail.com
Wed Jun 27 04:45:13 EDT 2012


On 27 June 2012 02:42, James Cameron <quozl at laptop.org> wrote:
>> 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.

I'm not sure exactly why but this is present, in one form or another,
in all the autogen.sh script I checked on git.gnome.org and
freedesktop

The most common form is really

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.

Maybe be they are trying to account for systems that doesn't have
dirname? Or maybe dirname on some systems returns empty instead of .?

I don't have a strong feeling here but I'm tempted to go with the
commonly used pattern. It won't hurt and if we find out later there
was a good reason for it, it will be a bunch of scripts to update.


More information about the Sugar-devel mailing list