unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH v2] fix out of tree build
Date: Mon, 14 Nov 2016 19:53:50 +0200	[thread overview]
Message-ID: <1479146030-17083-1-git-send-email-tomi.ollila@iki.fi> (raw)

With working tests.
---

This is v2 of id:1479066903-28310-1-git-send-email-tomi.ollila@iki.fi

with this ${srcdir} being absolute path will also work (relevant in tests!)

... and commit message is fixed: I accuse qt for "shadow build" ;)

Out of tree builds breaks every now and then; perhaps it is broken less
often in the future as I plan to start doing my "production" builds
out of tree...

 configure               | 6 ++++--
 test/test-lib-common.sh | 7 +++++++
 test/test-lib.sh        | 6 +++---
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 2a0ce9e..8174383 100755
--- a/configure
+++ b/configure
@@ -342,8 +342,8 @@ int main(void) {
     return 0;
 }
 EOF
-if ${CC} ${CFLAGS} _libversion.c -o _libversion > /dev/null 2>&1 && \
-       ./_libversion > _libversion.sh && . ./_libversion.sh
+if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
+       && ./_libversion > _libversion.sh && . ./_libversion.sh
 then
     printf "OK.\n"
 else
@@ -1158,6 +1158,8 @@ cat > sh.config <<EOF
 # This sh.config was automatically generated by the ./configure
 # script of notmuch.
 
+NOTMUCH_SRCDIR='${srcdir}'
+
 # Whether the Xapian version in use supports compaction
 NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index 03ef1d2..9b05b61 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -66,6 +66,13 @@ export LD_LIBRARY_PATH
 # configure output
 . $notmuch_path/sh.config || exit 1
 
+# Like $TEST_DIRECTORY this needs to be absolute as working directories change.
+SOURCE_DIRECTORY=$(
+	case $NOTMUCH_SRCDIR in /*) cd "$NOTMUCH_SRCDIR" ;;
+				 *) cd "../$NOTMUCH_SRCDIR"
+	esac
+	pwd -P)
+
 if test -n "$valgrind"
 then
 	make_symlink () {
diff --git a/test/test-lib.sh b/test/test-lib.sh
index a12c6d0..1cd0ff0 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1205,19 +1205,19 @@ test_emacs () {
 test_python() {
     # Note: if there is need to print debug information from python program,
     # use stdout = os.fdopen(6, 'w') or stderr = os.fdopen(7, 'w')
-    PYTHONPATH="$TEST_DIRECTORY/../bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
+    PYTHONPATH="$SOURCE_DIRECTORY/bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
 	$NOTMUCH_PYTHON -B - > OUTPUT
 }
 
 test_ruby() {
-    MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
+    MAIL_DIR=$MAIL_DIR ruby -I $SOURCE_DIRECTORY/bindings/ruby> OUTPUT
 }
 
 test_C () {
     exec_file="test${test_count}"
     test_file="${exec_file}.c"
     cat > ${test_file}
-    ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY} -I${TEST_DIRECTORY}/../lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
+    ${TEST_CC} ${TEST_CFLAGS} -I${TEST_DIRECTORY} -I${SOURCE_DIRECTORY}/lib -o ${exec_file} ${test_file} -L${TEST_DIRECTORY}/../lib/ -lnotmuch -ltalloc
     echo "== stdout ==" > OUTPUT.stdout
     echo "== stderr ==" > OUTPUT.stderr
     ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
-- 
2.7.4

             reply	other threads:[~2016-11-14 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 17:53 Tomi Ollila [this message]
2016-11-20  1:26 ` [PATCH v2] fix out of tree build David Bremner
2016-11-20 11:35   ` Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479146030-17083-1-git-send-email-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).