Make install target functional for new eln-cache directory arrangement

* src/comp.h (fixup_eln_load_path): New extern.

	* src/comp.c (fixup_eln_load_path): New function.

	* src/pdumper.c (dump_do_dump_relocation): Update to make use of
	'fixup_eln_load_path'.

	* lisp/loadup.el: Update to store in the compilation unit the
	correct eln-cache installed path. Rename --lisp-dest -> --eln-dest
	and.

	* Makefile.in: Pass the eln destination directory to
	src/Makefile. Rename LISP_DESTDIR -> ELN_DESTDIR.
	(ELN_DESTDIR): Define.
	(install-eln): New target.
	(install): Add install-eln as prerequisite.

	* src/Makefile.in: Rename --lisp-dest -> --eln-dest and
	LISP_DESTDIR -> ELN_DESTDIR.
This commit is contained in:
Andrea Corallo 2020-08-16 11:18:36 +02:00
parent b6238d826e
commit 171db31101
6 changed files with 61 additions and 39 deletions

View file

@ -108,6 +108,8 @@ am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@
# ==================== Where To Install Things ====================
# Location to install Emacs.app under GNUstep / macOS.
@ -330,6 +332,8 @@ CONFIG_STATUS_FILES_IN = \
COPYDIR = ${srcdir}/etc ${srcdir}/lisp
COPYDESTS = "$(DESTDIR)${etcdir}" "$(DESTDIR)${lispdir}"
ELN_DESTDIR = "$(DESTDIR)${libexecdir}/emacs/${version}/${configuration}/"
all: ${SUBDIR} info
.PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 etc-emacsver
@ -422,7 +426,7 @@ dirstate = .git/logs/HEAD
VCSWITNESS = $(if $(wildcard $(srcdir)/$(dirstate)),$$(srcdir)/../$(dirstate))
src: Makefile
$(MAKE) -C $@ VCSWITNESS='$(VCSWITNESS)' BIN_DESTDIR='$(DESTDIR)${bindir}/' \
LISP_DESTDIR='$(DESTDIR)${lispdir}/' all
ELN_DESTDIR='$(ELN_DESTDIR)' all
blessmail: Makefile src
$(MAKE) -C lib-src maybe-blessmail
@ -462,14 +466,14 @@ $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/m4/*.m4
# ==================== Installation ====================
.PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info
.PHONY: install-man install-etc install-strip install-$(NTDIR)
.PHONY: install-man install-etc install-strip install-$(NTDIR) install-eln
.PHONY: uninstall uninstall-$(NTDIR)
## If we let lib-src do its own installation, that means we
## don't have to duplicate the list of utilities to install in
## this Makefile as well.
install: all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) blessmail
install: all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) blessmail install-eln
@true
## Ensure that $subdir contains a subdirs.el file.
@ -753,6 +757,12 @@ install-etc:
done ; \
done
### Install native compiled Lisp files.
install-eln:
ifeq ($(HAVE_NATIVE_COMP),yes)
find eln-cache -type f -exec ${INSTALL_DATA} -D "{}" "$(ELN_DESTDIR){}" \;
endif
### Build Emacs and install it, stripping binaries while installing them.
install-strip:
$(MAKE) INSTALL_STRIP=-s install

View file

@ -449,33 +449,33 @@ lost after dumping")))
;; At this point, we're ready to resume undo recording for scratch.
(buffer-enable-undo "*scratch*")
(when (native-comp-available-p)
(when (boundp 'comp-ctxt)
;; Fix the compilation unit filename to have it working when
;; when installed or if the source directory got moved. This is set to be
;; a pair in the form: (rel-path-from-install-bin . rel-path-from-local-bin).
(let ((h (make-hash-table :test #'eq))
(lisp-src-dir (expand-file-name (concat default-directory "../lisp")))
(bin-dest-dir (cadr (member "--bin-dest" command-line-args)))
(lisp-dest-dir (cadr (member "--lisp-dest" command-line-args))))
(mapatoms (lambda (s)
(let ((f (symbol-function s)))
(when (subr-native-elisp-p f)
(puthash (subr-native-comp-unit f) nil h)))))
(maphash (lambda (cu _)
(native-comp-unit-set-file
cu
(cons
;; Relative path from the installed binary.
(file-relative-name
(concat lisp-dest-dir
(replace-regexp-in-string
(regexp-quote lisp-src-dir) ""
(native-comp-unit-file cu)))
bin-dest-dir)
;; Relative path from the built uninstalled binary.
(file-relative-name (native-comp-unit-file cu)
invocation-directory))))
h)))
(eln-dest-dir (cadr (member "--eln-dest" command-line-args))))
(when (and bin-dest-dir eln-dest-dir)
(setq eln-dest-dir
(concat eln-dest-dir "eln-cache/" comp-native-path-postfix "/"))
(mapatoms (lambda (s)
(let ((f (symbol-function s)))
(when (subr-native-elisp-p f)
(puthash (subr-native-comp-unit f) nil h)))))
(maphash (lambda (cu _)
(native-comp-unit-set-file
cu
(cons
;; Relative path from the installed binary.
(file-relative-name (concat eln-dest-dir
(file-name-nondirectory
(native-comp-unit-file cu)))
bin-dest-dir)
;; Relative path from the built uninstalled binary.
(file-relative-name (native-comp-unit-file cu)
invocation-directory))))
h))))
(when (hash-table-p purify-flag)
(let ((strings 0)

View file

@ -587,7 +587,7 @@ endif
ifeq ($(DUMPING),pdumper)
$(pdmp): emacs$(EXEEXT)
LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=pdump \
--bin-dest $(BIN_DESTDIR) --lisp-dest $(LISP_DESTDIR)
--bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR)
cp -f $@ $(bootstrap_pdmp)
endif

View file

@ -4529,6 +4529,27 @@ maybe_defer_native_compilation (Lisp_Object function_name,
/* Functions used to load eln files. */
/**************************************/
/* Fixup the system eln-cache dir. This is the last entry in
`comp-eln-load-path'. */
void
fixup_eln_load_path (Lisp_Object directory)
{
Lisp_Object last_cell = Qnil;
Lisp_Object tmp = Vcomp_eln_load_path;
FOR_EACH_TAIL (tmp)
if (CONSP (tmp))
last_cell = tmp;
Lisp_Object eln_cache_sys =
Ffile_name_directory (concat2 (Vinvocation_directory,
directory));
/* One directory up... */
eln_cache_sys =
Ffile_name_directory (Fsubstring (eln_cache_sys, Qnil,
make_fixnum (-1)));
Fsetcar (last_cell, eln_cache_sys);
}
typedef char *(*comp_lit_str_func) (void);
/* Deserialize read and return static object. */

View file

@ -101,6 +101,8 @@ extern void dispose_all_remaining_comp_units (void);
extern void clean_package_user_dir_of_old_comp_units (void);
extern void fixup_eln_load_path (Lisp_Object directory);
#else /* #ifdef HAVE_NATIVE_COMP */
static inline void

View file

@ -5249,23 +5249,12 @@ dump_do_dump_relocation (const uintptr_t dump_base,
{
fclose (file);
installation_state = INSTALLED;
/* FIXME Vcomp_eln_load_path = ?? */
fixup_eln_load_path (XCAR (comp_u->file));
}
else
{
installation_state = LOCAL_BUILD;
/* Fixup `comp-eln-load-path' so emacs can be invoked
position independently. */
Lisp_Object eln_cache_sys =
Ffile_name_directory (concat2 (Vinvocation_directory,
XCDR (comp_u->file)));
/* One directory up... */
eln_cache_sys =
Ffile_name_directory (Fsubstring (eln_cache_sys, Qnil,
make_fixnum (-1)));
/* FIXME for subsequent dumps we should fixup only the
last entry. */
Vcomp_eln_load_path = Fcons (eln_cache_sys, Qnil);
fixup_eln_load_path (XCDR (comp_u->file));
}
}