emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp 3dd6cf8 5/7: Implement working make install for nati


From: Andrea Corallo
Subject: feature/native-comp 3dd6cf8 5/7: Implement working make install for native build.
Date: Sun, 12 Apr 2020 12:13:39 -0400 (EDT)

branch: feature/native-comp
commit 3dd6cf813953ffda1a581243faa098f3b8f7c12b
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    Implement working make install for native build.
---
 Makefile.in     |  3 ++-
 lisp/loadup.el  | 27 ++++++++++++++++++++-------
 src/Makefile.in |  3 ++-
 src/pdumper.c   |  5 +++++
 4 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 67e15cf..2f6a68f 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 bda9919..3cc47bc 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 429f703..7f86e96 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 69594b5..490f357 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]