unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source
@ 2016-12-03 12:53 Tomi Ollila
  0 siblings, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2016-12-03 12:53 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

The ${srcdir} -- usually relative path to notmuch source -- works fine
in current ./configure and all makefiles. To have simple access to
notmuch source in tests and out of tree builds holding absolute path to
the source directory is useful.
---
 configure | 8 ++++++++
 1 file changed, 8 insertions(+)

Version 3 of id:1480099848-17636-1-git-send-email-too@guru.guru-group.fi
now adding variable holding absolute path to notmuch source to *.config
files in ./configure

diff --git a/configure b/configure
index 72db26d..174b24a 100755
--- a/configure
+++ b/configure
@@ -19,7 +19,12 @@ To work around this problem you may try to execute:
 # Store original IFS value so it can be changed (and restored) in many places.
 readonly DEFAULT_IFS="$IFS"
 
+# The top-level directory for the source. This ./configure and all Makefiles
+# are good with ${srcdir} usually being relative. Some components (e.g. tests)
+# are executed in subdirectories and for those it is simpler to use
+# ${NOTMUCH_SRCDIR} which holds absolute path to the source.
 srcdir=$(dirname "$0")
+NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd)
 
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
@@ -927,6 +932,7 @@ cat > Makefile.config <<EOF
 # the configure script). This may be different than the build
 # directory (the current directory at the time configure was run).
 srcdir = ${srcdir}
+NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
 
 # subdirectories to build
 subdirs = ${subdirs}
@@ -1182,6 +1188,8 @@ cat > sh.config <<EOF
 # This sh.config was automatically generated by the ./configure
 # script of notmuch.
 
+NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
+
 # Whether the Xapian version in use supports compaction
 NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 
-- 
2.10.0

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

* [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source
@ 2017-03-12 11:59 Tomi Ollila
  2017-03-12 11:59 ` [PATCH 2/3] fix out of tree build Tomi Ollila
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tomi Ollila @ 2017-03-12 11:59 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

The ${srcdir} -- usually relative path to notmuch source -- works fine
in current ./configure and all makefiles. To have simple access to
notmuch source in tests and out of tree builds holding absolute path to
the source directory is useful.
---

Fixed version of series starting with
id:1480769604-11307-1-git-send-email-tomi.ollila@iki.fi

diff to that one:

: -if [ "$srcdir" != "." ] && [ "$srcdir" != "$NOTMUCH_SRCDIR" ]; then
: +if [ "$srcdir" != "." ]; then

That one broke OOT build when using absolute path (and is now pretty
obvious)... That change is not needed here (and should not have been
there in the first place...)

 configure | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/configure b/configure
index e16a9b7..bcfa416 100755
--- a/configure
+++ b/configure
@@ -19,7 +19,12 @@ To work around this problem you may try to execute:
 # Store original IFS value so it can be changed (and restored) in many places.
 readonly DEFAULT_IFS="$IFS"
 
+# The top-level directory for the source. This ./configure and all Makefiles
+# are good with ${srcdir} usually being relative. Some components (e.g. tests)
+# are executed in subdirectories and for those it is simpler to use
+# ${NOTMUCH_SRCDIR} which holds absolute path to the source.
 srcdir=$(dirname "$0")
+NOTMUCH_SRCDIR=$(cd "$srcdir" && pwd)
 
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
@@ -913,6 +918,7 @@ cat > Makefile.config <<EOF
 # the configure script). This may be different than the build
 # directory (the current directory at the time configure was run).
 srcdir = ${srcdir}
+NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
 
 # subdirectories to build
 subdirs = ${subdirs}
@@ -1164,6 +1170,8 @@ cat > sh.config <<EOF
 # This sh.config was automatically generated by the ./configure
 # script of notmuch.
 
+NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
+
 # Whether the Xapian version in use supports compaction
 NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 
-- 
2.9.3

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

* [PATCH 2/3] fix out of tree build
  2017-03-12 11:59 [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source Tomi Ollila
@ 2017-03-12 11:59 ` Tomi Ollila
  2017-03-12 11:59 ` [PATCH 3/3] fix out of tree tests Tomi Ollila
  2017-03-13  1:07 ` [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2017-03-12 11:59 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

In addition to use ${srcdir} and deliver ${NOTMUCH_SRCDIR} where needed,
source from ruby bindings had to be copied to the out-of-tree target
directory -- if the source files in source directory were referenced
in build and there were also built object files there, those could have
been considered as target files (and then not found when attempting
to create bindings/ruby/notmuch.so).
---
 bindings/Makefile.local  |  1 +
 bindings/ruby/extconf.rb |  2 +-
 configure                | 10 ++++++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 11d11d4..17b561c 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -8,6 +8,7 @@ ifeq ($(HAVE_RUBY_DEV),1)
 	cd $(dir)/ruby && \
 		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
 		LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
+		NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \
 		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 endif
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index ddaa684..161de5a 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -5,7 +5,7 @@
 
 require 'mkmf'
 
-dir = File.join('..', '..', 'lib')
+dir = File.join(ENV['NOTMUCH_SRCDIR'], 'lib')
 
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
diff --git a/configure b/configure
index bcfa416..6c782e1 100755
--- a/configure
+++ b/configure
@@ -47,6 +47,12 @@ if [ "$srcdir" != "." ]; then
     # Emacs only likes to generate compiled files next to the .el files
     # by default so copy these as well (which is not ideal).
     cp -a "$srcdir"/emacs/*.el emacs
+
+    # We were not able to create fully working Makefile using ruby mkmf.rb
+    # so ruby bindings source files are copied as well (ditto -- not ideal).
+    mkdir bindings/ruby
+    cp -a "$srcdir"/bindings/ruby/*.[ch] bindings/ruby
+    cp -a "$srcdir"/bindings/ruby/extconf.rb bindings/ruby
 fi
 
 # Set several defaults (optionally specified by the user in
@@ -357,8 +363,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
-- 
2.9.3

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

* [PATCH 3/3] fix out of tree tests
  2017-03-12 11:59 [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source Tomi Ollila
  2017-03-12 11:59 ` [PATCH 2/3] fix out of tree build Tomi Ollila
@ 2017-03-12 11:59 ` Tomi Ollila
  2017-03-13  1:07 ` [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2017-03-12 11:59 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

Use $NOTMUCH_SRCDIR/ instead of $TEST_DIRECTORY/../ (in those 2 places)
where reference to source directory instead of build directory is
required.
---
 test/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 43fed20..185deed 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1129,7 +1129,7 @@ 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="$NOTMUCH_SRCDIR/bindings/python${PYTHONPATH:+:$PYTHONPATH}" \
 	$NOTMUCH_PYTHON -B - > OUTPUT
 }
 
@@ -1141,7 +1141,7 @@ 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${NOTMUCH_SRCDIR}/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.9.3

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

* Re: [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source
  2017-03-12 11:59 [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source Tomi Ollila
  2017-03-12 11:59 ` [PATCH 2/3] fix out of tree build Tomi Ollila
  2017-03-12 11:59 ` [PATCH 3/3] fix out of tree tests Tomi Ollila
@ 2017-03-13  1:07 ` David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2017-03-13  1:07 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

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

> The ${srcdir} -- usually relative path to notmuch source -- works fine
> in current ./configure and all makefiles. To have simple access to
> notmuch source in tests and out of tree builds holding absolute path to
> the source directory is useful.

series pushed to master.

d

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

end of thread, other threads:[~2017-03-13  1:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 11:59 [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source Tomi Ollila
2017-03-12 11:59 ` [PATCH 2/3] fix out of tree build Tomi Ollila
2017-03-12 11:59 ` [PATCH 3/3] fix out of tree tests Tomi Ollila
2017-03-13  1:07 ` [PATCH 1/3] configure: add ${NOTMUCH_SRCDIR} -- absolute path to notmuch source David Bremner
  -- strict thread matches above, loose matches on Subject: below --
2016-12-03 12:53 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).