[Bug 59705] Fix out of source builddir - autogen

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jan 28 15:23:53 CET 2013


https://bugs.freedesktop.org/show_bug.cgi?id=59705

--- Comment #2 from Simon McVittie <simon.mcvittie at collabora.co.uk> ---
Comment on attachment 73439
  --> https://bugs.freedesktop.org/attachment.cgi?id=73439
Fix out of source builddir - autogen

Review of attachment 73439:
 --> (https://bugs.freedesktop.org/page.cgi?id=splinter.html&bug=59705&attachment=73439)
-----------------------------------------------------------------

::: autogen.sh
@@ +1,5 @@
>  #!/bin/sh
>  set -e
>  
> +srcdir=`dirname $0`
> +test -z "$srcdir" && srcdir=.

We're running under 'set -e', so it's not absolutely clear why this won't make
the script abort in the case where $srcdir is nonempty. In practice, I think it
usually won't abort... but I don't know how portable that is.

POSIX says commands in an && or || list are exempt from 'set -e', and dash(1)
says the left operand of && or || is exempt from 'set -e'.

I also think using the short-circuiting behaviour of || and especially && as a
pseudo-conditional is less clear than using a real conditional.

I'd feel happier about this if it was spelled out explicitly:

    if test -z "$srcdir"; then
        srcdir=.
    fi

I was slightly worried about whether this works correctly on certain non-Linux
systems where $0 is just the basename, but I think it does, because dirname
will return either "." or the empty string, either of which is fine - it just
won't support out-of-tree builds in the way you request on such systems.

As general good shell practice, I would prefer it properly quoted

    srcdir=`dirname "$0"`

so it does the right thing if $0 contains spaces (although I think
Autoconf/Automake explicitly don't support srcdir or builddir containing spaces
anyway).

@@ +23,2 @@
>  autoreconf -i -f
> +)

>From general defensive shell programming, I'd prefer "$srcdir" properly quoted,
as I said for "$0".

Also, I'd prefer consistent semicolon/no-semicolon and newline positioning, in
whichever of these three forms you prefer:

    (
    cd "$srcdir"
    gtkdocize
    autoreconf -i -f
    )

    (
        cd "$srcdir"
        gtkdocize
        autoreconf -i -f
    )

    ( cd "$srcdir" && gtkdocize )
    ( cd "$srcdir" && autoreconf -i -f )

(unless there's a specific reason for the way you wrote it, in which case,
please say).

@@ +40,4 @@
>  fi
>  
>  if test $run_configure = true; then
> +    $srcdir/configure "$@"

Again, I'd prefer "$srcdir/configure" quoted.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list