emacs: add an option to install the C source

Install the source files, and the associated TAGS files. Use
.dir-locals.el to select the TAGS file automatically.

Turn the option on by default, to get a consistent behavior when using
xref-find-definitions (M-.), whether looking for an elisp (e.g. defun)
or a C (e.g. defalias) definition.
This commit is contained in:
Nicolas Dudebout 2016-09-26 10:10:03 -04:00
parent 2c570b4fbe
commit bb6708b858
2 changed files with 36 additions and 1 deletions

View File

@ -6,6 +6,7 @@
, withGTK2 ? true, gtk2 ? null
, withGTK3 ? false, gtk3 ? null
, withXwidgets ? false, webkitgtk24x ? null, wrapGAppsHook ? null, glib_networking ? null
, withCsrc ? true
, srcRepo ? false, autoconf ? null, automake ? null, texinfo ? null
}:
@ -31,7 +32,8 @@ stdenv.mkDerivation rec {
sha256 = "0cwgyiyymnx4xdg99dm2drfxcyhy2jmyf0rkr9fwj9mwwf77kwhr";
};
patches = lib.optional stdenv.isDarwin ./at-fdcwd.patch;
patches = lib.optional stdenv.isDarwin ./at-fdcwd.patch
++ lib.optional withCsrc ./install-C-src.patch;
nativeBuildInputs = [ pkgconfig ]
++ lib.optionals srcRepo [ autoconf automake texinfo ];

View File

@ -0,0 +1,33 @@
diff --git a/Makefile.in b/Makefile.in
index 7aac403..c21a396 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -563,7 +563,7 @@ set_installuser=
## work correctly, and therefore no idea when tar can be replaced.
## See also these comments from 2004 about cp -r working fine:
## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html
-install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
+install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} tags
-set ${COPYDESTS} ; \
unset CDPATH; \
$(set_installuser); \
@@ -617,6 +617,19 @@ install-arch-indep:
done; \
${GZIP_PROG} -9n "../etc/publicsuffix.txt"; \
}
+ for d in src lwlib ; do \
+ srcdir="$(DESTDIR)${datadir}/emacs/${version}/$$d" ; \
+ mkdir -p $$srcdir ; \
+ find $$d -name "*.[chm]" -exec cp {} $$srcdir \; ; \
+ done
+ for d in src lisp lwlib ; do \
+ srcdir="$(DESTDIR)${datadir}/emacs/${version}/$$d" ; \
+ cp $$d/TAGS $$srcdir ; \
+ echo '((nil . ((tags-file-name . "TAGS"))))' > $$srcdir/.dir-locals.el ; \
+ done
+ mkdir -p "$(DESTDIR)${datadir}/emacs/${version}/site-lisp"
+ echo "(setq find-function-C-source-directory \"$(DESTDIR)${datadir}/emacs/${version}/src\")" \
+ > "$(DESTDIR)${datadir}/emacs/${version}/site-lisp/site-start.el"
-chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS}
## The above chmods are needed because "umask 022; tar ..." is not