unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Prikler <leo.prikler@student.tugraz.at>
To: 45316@debbugs.gnu.org
Cc: maxim.cournoyer@gmail.com
Subject: bug#45316: [WIP PATCH 2/3] build-system: emacs: Use subdirectories again.
Date: Tue, 30 Mar 2021 11:45:13 +0200	[thread overview]
Message-ID: <20210330094514.4819-2-leo.prikler@student.tugraz.at> (raw)
In-Reply-To: <20210330094514.4819-1-leo.prikler@student.tugraz.at>

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	other threads:[~2021-03-30  9:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 22:00 bug#45316: [PATCH]: Re-introduce Emacs packages specific installation prefix Maxim Cournoyer
2020-12-18 22:16 ` bug#45316: [PATCH 01/26] build-systems/emacs: Install packages in their own directory Maxim Cournoyer
2020-12-18 22:16   ` bug#45316: [PATCH 02/26] gnu: emacs-ert-runner: Adjust following emacs-build-system changes Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 03/26] gnu: emacs-xyz: Do not use --quick or -Q Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 04/26] gnu: cedille: Adjust following emacs-build-system changes Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 05/26] gnu: emacs-libgit: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 06/26] gnu: emacs-typit: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 07/26] gnu: emacs-flycheck-grammalecte: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 08/26] gnu: emacs-scel: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 09/26] gnu: emacs-chess: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 10/26] gnu: emacs-org-contrib: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 11/26] gnu: emacs-edbi: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 12/26] gnu: emacs-telega: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 13/26] gnu: emacs-rime: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 14/26] gnu: emacs-haskell-snippets: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 15/26] gnu: guile-wisp: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 16/26] gnu: emacs-pdf-tools: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 17/26] gnu: emacs-emacsql: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 18/26] gnu: emacs-racer: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 19/26] gnu: emacs-magit: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 20/26] gnu: emacs-org-super-agenda: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 21/26] gnu: notmuch: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 22/26] gnu: emacs-howm: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 23/26] gnu: emacs-rjsx-mode: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 24/26] gnu: emacs-sudo-edit: Update to commit 0e2c32b, fix tests Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 25/26] gnu: emacs-sly-named-readtables: Adjust following emacs-build-system changes Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 26/26] gnu: emacs-realgud: " Maxim Cournoyer
2021-03-30  9:45 ` bug#45316: [WIP PATCH 1/3] profiles: Add hook for Emacs subdirs Leo Prikler
2021-03-30  9:45   ` Leo Prikler [this message]
2021-03-30  9:45   ` bug#45316: [WIP PATCH 3/3] gnu: emacs-libgit: Adjust to changes in emacs-build-system Leo Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210330094514.4819-2-leo.prikler@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=45316@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).