]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement working make install for native build.
authorAndrea Corallo <akrl@sdf.org>
Sat, 11 Apr 2020 12:59:59 +0000 (13:59 +0100)
committerAndrea Corallo <akrl@sdf.org>
Sun, 12 Apr 2020 15:52:05 +0000 (16:52 +0100)
Makefile.in
lisp/loadup.el
src/Makefile.in
src/pdumper.c

index 67e15cfecd24333d6f39683cabda0e36c28bd26b..2f6a68fd9d7a6f5ccd348be621690747713884bd 100644 (file)
@@ -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
index bda9919cbbcc2dcc04acdb5591c99c5716b4640e..3cc47bc91fae697f75f29fdf9c2ac6b3ca75417d 100644 (file)
@@ -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)
index 429f7035443be80c112633b545fa844eb61b647d..7f86e96cdb4dfa2a2791b2e103bb617ced7a461b 100644 (file)
@@ -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
 
index 69594b51c597ed9007f11029a621c3dc315bf094..490f357219d97cf2eb9f2c0875a4f13c4e76d053 100644 (file)
@@ -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)