bug-guix
[Top][All Lists]
Advanced

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

bug#45316: [WIP PATCH 2/3] build-system: emacs: Use subdirectories again


From: Leo Prikler
Subject: bug#45316: [WIP PATCH 2/3] build-system: emacs: Use subdirectories again.
Date: Tue, 30 Mar 2021 11:45:13 +0200

With this, Emacs libraries are installed in the ELPA_NAME-VERSION subdirectory
of site-lisp and potential subdirectories should no longer collide.

* guix/build/emacs-build-system.scm (build, patch-el-files, make-autoloads):
Use ELPA name and version to construct subdirectories of %install-dir.
(install): Install in subdirectory.  Also create a subdirs.el, so that
emacs-build-system can find the library without needing to hack EMACSLOADPATH.
---
 guix/build/emacs-build-system.scm | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/guix/build/emacs-build-system.scm 
b/guix/build/emacs-build-system.scm
index 26ea59bc25..adc4861f02 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -96,10 +96,11 @@ environment variable\n" source-directory)))
   "Compile .el files."
   (let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs"))
          (out (assoc-ref outputs "out"))
-         (site-lisp (string-append out %install-dir)))
+         (elpa-name-ver (store-directory->elpa-name-version out))
+         (el-dir (string-append out %install-dir "/" elpa-name-ver)))
     (setenv "SHELL" "sh")
     (parameterize ((%emacs emacs))
-      (emacs-byte-compile-directory site-lisp))))
+      (emacs-byte-compile-directory el-dir))))
 
 (define* (patch-el-files #:key outputs #:allow-other-keys)
   "Substitute the absolute \"/bin/\" directory with the right location in the
@@ -116,7 +117,8 @@ store in '.el' files."
       #:binary #t))
 
   (let* ((out (assoc-ref outputs "out"))
-         (site-lisp (string-append out %install-dir))
+         (elpa-name-ver (store-directory->elpa-name-version out))
+         (el-dir (string-append out %install-dir "/" elpa-name-ver))
          ;; (ice-9 regex) uses libc's regexp routines, which cannot deal with
          ;; strings containing NULs.  Filter out such files.  TODO: Remove
          ;; this workaround when <https://bugs.gnu.org/30116> is fixed.
@@ -130,7 +132,7 @@ store in '.el' files."
              (error "patch-el-files: unable to locate " cmd-name))
            (string-append "\"" cmd "\"")))))
 
-    (with-directory-excursion site-lisp
+    (with-directory-excursion el-dir
       ;; Some old '.el' files (e.g., tex-buf.el in AUCTeX) are still
       ;; ISO-8859-1-encoded.
       (unless (false-if-exception (substitute-program-names))
@@ -182,16 +184,22 @@ parallel. PARALLEL-TESTS? is ignored when using a 
non-make TEST-COMMAND."
 
   (let* ((out (assoc-ref outputs "out"))
          (site-lisp (string-append out %install-dir))
+         (elpa-name-ver (store-directory->elpa-name-version out))
+         (el-dir (string-append site-lisp "/" elpa-name-ver))
          (files-to-install (find-files source install-file?)))
     (cond
      ((not (null? files-to-install))
       (for-each
        (lambda (file)
          (let* ((stripped-file (string-drop file (string-length source)))
-                (target-file (string-append site-lisp stripped-file)))
+                (target-file (string-append el-dir stripped-file)))
            (format #t "`~a' -> `~a'~%" file target-file)
            (install-file file (dirname target-file))))
        files-to-install)
+      (call-with-output-file (string-append site-lisp "/subdirs.el")
+        (lambda (port)
+          (write `(normal-top-level-add-to-load-path (list ,el-dir)) port)
+          (newline port)))
       #t)
      (else
       (format #t "error: No files found to install.\n")
@@ -219,11 +227,11 @@ parallel. PARALLEL-TESTS? is ignored when using a 
non-make TEST-COMMAND."
   "Generate the autoloads file."
   (let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs"))
          (out (assoc-ref outputs "out"))
-         (site-lisp (string-append out %install-dir))
          (elpa-name-ver (store-directory->elpa-name-version out))
-         (elpa-name (package-name->name+version elpa-name-ver)))
+         (elpa-name (package-name->name+version elpa-name-ver))
+         (el-dir (string-append out %install-dir "/" elpa-name-ver)))
     (parameterize ((%emacs emacs))
-      (emacs-generate-autoloads elpa-name site-lisp))))
+      (emacs-generate-autoloads elpa-name el-dir))))
 
 (define* (enable-autoloads-compilation #:key outputs #:allow-other-keys)
   "Remove the NO-BYTE-COMPILATION local variable embedded in the generated
-- 
2.31.0






reply via email to

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