From: Andy Moreton <andrewjmoreton@gmail.com>
To: 30198@debbugs.gnu.org
Subject: bug#30198: 26.0.91; [PATCH] Fix emacs-module-tests to work with out of tree build directory
Date: Sun, 21 Jan 2018 18:44:16 +0000 [thread overview]
Message-ID: <a2f64144-0bf7-17c2-5c7b-140f2cc569c6@gmail.com> (raw)
Currently the emacs module tests fail to build when using an out of tree
build directory. The following patch moves the location of the module
library mod-test.{so,dll} from test/data/emacs-module to
<builddir>/test/data/emacs-module, as build outputs do not belong in the
source tree. It also fixes the test module build to find the module header
at the correct lcoation, namely <builddir>/src/emacs-module.h.
Tested on Windows with the mingw64-x86_64 toolchain (msys2) for both
both in-tree and out-of-tree build directories:
Fix emacs-module-tests to work with an out of tree build directory
* test/Makefile.in(test_module_dir): Build the test module library in
a subdirectory of the build directory (not the source tree).
(MODULE_CFLAGS): Fix location of emacs-module.h header file.
(test_module): Move built library out of the source tree.
* test/src/emacs-module-tests.el(mod-test-file): Locate the test module
library relative to the running emacs executable.
diff --git a/test/Makefile.in b/test/Makefile.in
index 341b09b03f..7c5976435c 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -119,7 +119,7 @@ emacs =
EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \
$(GDB) "$(EMACS)" $(MODULES_EMACSOPT) $(EMACSOPT)
-test_module_dir := $(srcdir)/data/emacs-module
+test_module_dir := data/emacs-module
.PHONY: all check
@@ -222,12 +222,13 @@ FPIC_CFLAGS =
FPIC_CFLAGS = -fPIC
endif
-MODULE_CFLAGS = -I$(srcdir)/../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \
+MODULE_CFLAGS = -I../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
test_module = $(test_module_dir)/mod-test${SO}
src/emacs-module-tests.log: $(test_module)
-$(test_module): $(test_module:${SO}=.c) $(srcdir)/../src/emacs-module.h
+$(test_module): ${srcdir}/$(test_module:${SO}=.c) ../src/emacs-module.h
+ $(AM_V_at)${MKDIR_P} $(dir $@)
$(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \
-o $@ $<
endif
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index d9406a9609..85d6305386 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -25,8 +25,7 @@ mod-test-emacs
(eval-and-compile
(defconst mod-test-file
- (substitute-in-file-name
- "$EMACS_TEST_DIRECTORY/data/emacs-module/mod-test")
+ (expand-file-name "../test/data/emacs-module/mod-test"
invocation-directory)
"File name of the module test file."))
(require 'mod-test mod-test-file)
next reply other threads:[~2018-01-21 18:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-21 18:44 Andy Moreton [this message]
2018-01-26 10:12 ` bug#30198: 26.0.91; [PATCH] Fix emacs-module-tests to work with out of tree build directory Eli Zaretskii
2018-01-26 13:58 ` bug#30198: 26.0.91; " Andy Moreton
2018-01-26 15:42 ` Eli Zaretskii
2018-01-26 19:54 ` Glenn Morris
2018-01-26 20:04 ` Eli Zaretskii
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://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2f64144-0bf7-17c2-5c7b-140f2cc569c6@gmail.com \
--to=andrewjmoreton@gmail.com \
--cc=30198@debbugs.gnu.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://git.savannah.gnu.org/cgit/emacs.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).