unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] fix out of tree build
@ 2016-11-14 17:53 Tomi Ollila
  2016-11-20  1:26 ` David Bremner
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2016-11-14 17:53 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fix out of tree build
  2016-11-14 17:53 [PATCH v2] fix out of tree build Tomi Ollila
@ 2016-11-20  1:26 ` David Bremner
  2016-11-20 11:35   ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2016-11-20  1:26 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> 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...

Hi Tomi;

Did you test this with ruby-dev installed? for me out-of-tree-build
fails with your patch with

cd bindings/ruby && \
	EXTRA_LDFLAGS="-Wl,--no-undefined" \
	LIBNOTMUCH="../../lib/libnotmuch.so" \
	ruby extconf.rb --vendor
/bin/sh: 1: cd: can't cd to bindings/ruby
bindings/Makefile.local:8: recipe for target 'ruby-bindings' failed

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] fix out of tree build
  2016-11-20  1:26 ` David Bremner
@ 2016-11-20 11:35   ` Tomi Ollila
  0 siblings, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2016-11-20 11:35 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sun, Nov 20 2016, David Bremner <david@tethera.net> wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>> 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...
>
> Hi Tomi;
>
> Did you test this with ruby-dev installed? for me out-of-tree-build
> fails with your patch with

Hi David;

Thanks for testing this.

I (must confess I) did not test with ruby-dev installed...

... now I installed 'ruby-dev' *and* 'ruby' to my test debian:8.6
container -- and got exactly the same problem.

I tried to "trivial" change and added (*)

   cp -a "$srcdir"/bindings/ruby bindings

to ./configure


(*) the '-a' option is supported by at least linux, freebsd & macos
cp command, but not by solaris 10 cp. tough for solaris users ;(

next it fails

  make -C bindings/ruby
  make[1]: Entering directory
  '/home/too/tmp/nm-docker-tst/twd-notmuch-too-8.6/bindings/ruby'
  compiling messages.c
  In file included from messages.c:21:0:
  defs.h:24:21: fatal error: notmuch.h: No such file or directory
   #include <notmuch.h>

I looked a bit of the generated bindings/ruby/Makefile and did not
find out a "SMOP" solution (P meaning 'patching' this time). Also
it *looks to me that* building ruby bindings out-of-tree has never
worked...

Anyway, this makes my bold statement: 'With working tests.' false.

On IRC you asked whether out of tree build is documented. at least
command:
         grep -nIri out.*of.*tree notmuch notmuch-wiki

doesn't print any relevant matches.


The patch is useful but in this light I drop my suggestion to add
it to next 0.23.x release. I'll work on the commit message so
it could be added to master later...

... I am (slowly) creating a tool that runs (notmuch) tests
(in parallel!) in containers: debian:7.11, debian:8.6,
ubuntu:14.04.5, ubuntu:16.04, fedora:24 and debian:unstable.
Out-of-tree builds makes setupping build directories
(from same source directory) easier.


Tomi


> cd bindings/ruby && \
> 	EXTRA_LDFLAGS="-Wl,--no-undefined" \
> 	LIBNOTMUCH="../../lib/libnotmuch.so" \
> 	ruby extconf.rb --vendor
> /bin/sh: 1: cd: can't cd to bindings/ruby
> bindings/Makefile.local:8: recipe for target 'ruby-bindings' failed

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-20 11:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-14 17:53 [PATCH v2] fix out of tree build Tomi Ollila
2016-11-20  1:26 ` David Bremner
2016-11-20 11:35   ` Tomi Ollila

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).