Mercurial > ~mikael > mcabber > hg
diff mcabber/hgcset.sh @ 2041:e8f2db654e67
Fix building from separate directory
This patch allows the following build sequence:
$ mkdir build; cd build; ../configure args; make; make install
author | Myhailo Danylenko <isbear@ukrpost.net> |
---|---|
date | Thu, 22 Nov 2012 00:59:19 +0200 |
parents | 41c26b7d2890 |
children |
line wrap: on
line diff
--- a/mcabber/hgcset.sh Mon Nov 26 11:55:22 2012 +0100 +++ b/mcabber/hgcset.sh Thu Nov 22 00:59:19 2012 +0200 @@ -1,19 +1,24 @@ #! /bin/sh -if [ ! -f logprint.h ]; then - echo "You are not in the mcabber directory" >&2 +srcdir="$1" +builddir="$2" + +if [ ! -f "$srcdir/logprint.h" ]; then + echo "Unable to find mcabber sources!" >&2 exit 1 fi +cd "$srcdir" + if which hg > /dev/null 2>&1; then cs=$(hg id 2> /dev/null | cut -d' ' -f1) if test $? -eq 0; then if [ x"$cs" != x ]; then - grep -q "$cs" hgcset.h > /dev/null 2>&1 || \ - echo "#define HGCSET \"$cs\"" > hgcset.h + grep -q "$cs" "$builddir/hgcset.h" > /dev/null 2>&1 || \ + echo "#define HGCSET \"$cs\"" > "$builddir/hgcset.h" exit 0 fi fi fi -echo > hgcset.h +echo > "$builddir/hgcset.h"