fix out of tree build

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).
This commit is contained in:
Tomi Ollila 2017-03-12 13:59:13 +02:00 committed by David Bremner
parent 18914c725b
commit 35cdebdad0
3 changed files with 10 additions and 3 deletions

View file

@ -8,6 +8,7 @@ ifeq ($(HAVE_RUBY_DEV),1)
cd $(dir)/ruby && \ cd $(dir)/ruby && \
EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \ EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
LIBNOTMUCH="../../lib/$(LINKER_NAME)" \ LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \
ruby extconf.rb --vendor ruby extconf.rb --vendor
$(MAKE) -C $(dir)/ruby $(MAKE) -C $(dir)/ruby
endif endif

View file

@ -5,7 +5,7 @@
require 'mkmf' require 'mkmf'
dir = File.join('..', '..', 'lib') dir = File.join(ENV['NOTMUCH_SRCDIR'], 'lib')
# includes # includes
$INCFLAGS = "-I#{dir} #{$INCFLAGS}" $INCFLAGS = "-I#{dir} #{$INCFLAGS}"

10
configure vendored
View file

@ -47,6 +47,12 @@ if [ "$srcdir" != "." ]; then
# Emacs only likes to generate compiled files next to the .el files # Emacs only likes to generate compiled files next to the .el files
# by default so copy these as well (which is not ideal). # by default so copy these as well (which is not ideal).
cp -a "$srcdir"/emacs/*.el emacs 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 fi
# Set several defaults (optionally specified by the user in # Set several defaults (optionally specified by the user in
@ -357,8 +363,8 @@ int main(void) {
return 0; return 0;
} }
EOF EOF
if ${CC} ${CFLAGS} _libversion.c -o _libversion > /dev/null 2>&1 && \ if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
./_libversion > _libversion.sh && . ./_libversion.sh && ./_libversion > _libversion.sh && . ./_libversion.sh
then then
printf "OK.\n" printf "OK.\n"
else else