From: Andrea Corallo Date: Sat, 11 Apr 2020 12:59:59 +0000 (+0100) Subject: Implement working make install for native build. X-Git-Tag: emacs-28.0.90~2727^2~713 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3dd6cf813953ffda1a581243faa098f3b8f7c12b;p=emacs.git Implement working make install for native build. --- diff --git a/Makefile.in b/Makefile.in index 67e15cfecd2..2f6a68fd9d7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -421,7 +421,8 @@ lib lib-src lisp nt: Makefile dirstate = .git/logs/HEAD VCSWITNESS = $(if $(wildcard $(srcdir)/$(dirstate)),$$(srcdir)/../$(dirstate)) src: Makefile - $(MAKE) -C $@ VCSWITNESS='$(VCSWITNESS)' all + $(MAKE) -C $@ VCSWITNESS='$(VCSWITNESS)' BIN_DESTDIR='$(DESTDIR)${bindir}/' \ + LISP_DESTDIR='$(DESTDIR)${lispdir}/' all blessmail: Makefile src $(MAKE) -C lib-src maybe-blessmail diff --git a/lisp/loadup.el b/lisp/loadup.el index bda9919cbbc..3cc47bc91fa 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -449,19 +449,32 @@ lost after dumping"))) ;; At this point, we're ready to resume undo recording for scratch. (buffer-enable-undo "*scratch*") -(when (boundp 'comp-ctxt) ; FIXME better native-comp build discriminant? - ;; Set the filename for every compilation unit as realtive - ;; to obtain a position independent dump. - (let ((h (make-hash-table :test #'eq))) +(when (boundp 'comp-ctxt) ; FIXME better native-comp feature discriminant? + ;; 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 + (native-comp-unit-set-file cu - (file-relative-name (native-comp-unit-file cu) - invocation-directory))) + (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))) (when (hash-table-p purify-flag) diff --git a/src/Makefile.in b/src/Makefile.in index 429f7035443..7f86e96cdb4 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -588,7 +588,8 @@ endif ifeq ($(DUMPING),pdumper) $(pdmp): emacs$(EXEEXT) - LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=pdump + LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=pdump \ + --bin-dest $(BIN_DESTDIR) --lisp-dest $(LISP_DESTDIR) cp -f $@ $(bootstrap_pdmp) endif diff --git a/src/pdumper.c b/src/pdumper.c index 69594b51c59..490f357219d 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -5298,6 +5298,11 @@ dump_do_dump_relocation (const uintptr_t dump_base, { struct Lisp_Native_Comp_Unit *comp_u = dump_ptr (dump_base, reloc_offset); + if (!CONSP (comp_u->file)) + error ("Trying to load incoherent dumped .eln"); + comp_u->file = + NILP (Ffile_exists_p (XCAR (comp_u->file))) + ? XCDR (comp_u->file) : XCAR (comp_u->file); comp_u->handle = dynlib_open (SSDATA (concat2 (Vinvocation_directory, comp_u->file))); if (!comp_u->handle)