]> git.eshelyaron.com Git - emacs.git/commitdiff
Make install target functional for new eln-cache directory arrangement
authorAndrea Corallo <akrl@sdf.org>
Sun, 16 Aug 2020 09:18:36 +0000 (11:18 +0200)
committerAndrea Corallo <akrl@sdf.org>
Mon, 17 Aug 2020 16:04:23 +0000 (18:04 +0200)
* 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.

Makefile.in
lisp/loadup.el
src/Makefile.in
src/comp.c
src/comp.h
src/pdumper.c

index 253f7f7a54b96156e49c8b409b0edf0cab37edc3..a15850d55ef3272421d6e1dc5acb2681e72d9d96 100644 (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
index 31843fc24d16de1154ee041ecdcfebcca25a3378..aaa5888bf9265d0c87f4ef219dcc08810f924bce 100644 (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)
index 7380a87644b03d5c51429706581c0367c3ea5f57..31a5a7e77090f834101af400b2b4ab106ec9b21f 100644 (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
 
index b795afae351b2a39832e96c9c1cadce91530fbb2..d42bb4f8eb5ae75d73028e9d1c3fb4e666108626 100644 (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.  */
index 687e426b1ef789714882a1d48084c0f91a1b8b53..9270f8bf664206b7c0825fbf7a3f746c303ebcf9 100644 (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
index ca055a1327c35fc81fbec2c4828fb0dc2e67fe25..8172389a49b7c2418a8e30c5f68afc5246e46962 100644 (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));
              }
          }