From: Leo Prikler <leo.prikler@student.tugraz.at>
To: 47661@debbugs.gnu.org
Subject: [bug#47661] [PATCH v2 04/33] build-system: emacs: Use subdirectories again.
Date: Sat, 17 Apr 2021 19:06:19 +0200 [thread overview]
Message-ID: <20210417170648.3810-4-leo.prikler@student.tugraz.at> (raw)
In-Reply-To: <20210417170648.3810-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 (add-source-to-load-path): Rename to...
(expand-load-path): ... this. Also expand lone subdirectories of site-lisp.
(%standard-phases): Adjust accordingly.
(elpa-directory): New variable. Export it publicly for use in other build
systems.
(build, patch-el-files, make-autoloads): Use ELPA name and version to
construct subdirectories of %install-dir.
(install): Install in subdirectory.
---
guix/build/emacs-build-system.scm | 70 ++++++++++++++++++++-----------
1 file changed, 45 insertions(+), 25 deletions(-)
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 26ea59bc25..ae0f2e569e 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -26,13 +26,16 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
+ #:use-module (ice-9 format)
+ #:use-module (ice-9 ftw)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
#:export (%standard-phases
%default-include
%default-exclude
- emacs-build))
+ emacs-build
+ elpa-directory))
;; Commentary:
;;
@@ -73,33 +76,43 @@ archive, a directory, or an Emacs Lisp file."
#t)
(gnu:unpack #:source source)))
-(define* (add-source-to-load-path #:key dummy #:allow-other-keys)
- "Augment the EMACSLOADPATH environment variable with the source directory."
+(define* (expand-load-path #:key (prepend-source? #t) #:allow-other-keys)
+ "Expand EMACSLOADPATH, so that inputs, whose code resides in subdirectories,
+are properly found.
+If @var{prepend-source?} is @code{#t} (the default), also add the current
+directory to EMACSLOADPATH in front of any other directories."
(let* ((source-directory (getcwd))
(emacs-load-path (string-split (getenv "EMACSLOADPATH") #\:))
- ;; XXX: Make sure the Emacs core libraries appear at the end of
- ;; EMACSLOADPATH, to avoid shadowing any other libraries depended
- ;; upon.
- (emacs-load-path-non-core (filter (cut string-contains <>
- "/share/emacs/site-lisp")
- emacs-load-path))
+ (emacs-load-path*
+ (map
+ (lambda (dir)
+ (match (scandir dir (negate (cute member <> '("." ".."))))
+ ((sub) (string-append dir "/" sub))
+ (_ dir)))
+ emacs-load-path))
(emacs-load-path-value (string-append
- (string-join (cons source-directory
- emacs-load-path-non-core)
- ":")
+ (string-join
+ (if prepend-source?
+ (cons source-directory emacs-load-path*)
+ emacs-load-path*)
+ ":")
":")))
(setenv "EMACSLOADPATH" emacs-load-path-value)
- (format #t "source directory ~s prepended to the `EMACSLOADPATH' \
-environment variable\n" source-directory)))
+ (when prepend-source?
+ (format #t "source directory ~s prepended to the `EMACSLOADPATH' \
+environment variable\n" source-directory))
+ (let ((diff (lset-difference string=? emacs-load-path* emacs-load-path)))
+ (unless (null? diff)
+ (format #t "expanded load paths for ~{~a~^, ~}\n"
+ (map basename diff))))))
(define* (build #:key outputs inputs #:allow-other-keys)
"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)))
+ (out (assoc-ref outputs "out")))
(setenv "SHELL" "sh")
(parameterize ((%emacs emacs))
- (emacs-byte-compile-directory site-lisp))))
+ (emacs-byte-compile-directory (elpa-directory out)))))
(define* (patch-el-files #:key outputs #:allow-other-keys)
"Substitute the absolute \"/bin/\" directory with the right location in the
@@ -116,7 +129,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 +144,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))
@@ -181,14 +195,14 @@ parallel. PARALLEL-TESTS? is ignored when using a non-make TEST-COMMAND."
(not (any (cut match-stripped-file "excluded" <>) exclude)))))
(let* ((out (assoc-ref outputs "out"))
- (site-lisp (string-append out %install-dir))
+ (el-dir (elpa-directory out))
(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)
@@ -219,11 +233,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 (elpa-directory out)))
(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
@@ -258,10 +272,16 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages."
strip-store-file-name)
store-dir))
+(define (elpa-directory store-dir)
+ "Given the store directory STORE-DIR return the absolute install directory
+for libraries following the ELPA convention."
+ (string-append store-dir %install-dir "/"
+ (store-directory->elpa-name-version store-dir)))
+
(define %standard-phases
(modify-phases gnu:%standard-phases
(replace 'unpack unpack)
- (add-after 'unpack 'add-source-to-load-path add-source-to-load-path)
+ (add-after 'unpack 'expand-load-path expand-load-path)
(delete 'bootstrap)
(delete 'configure)
(delete 'build)
--
2.31.1
next prev parent reply other threads:[~2021-04-17 17:51 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 17:46 [bug#47661] [PATCH 00/33] Improve Emacs UX Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 01/33] profiles: Add hook for Emacs subdirs Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 02/33] gnu: emacs: Wrap EMACSLOADPATH Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 03/33] gnu: emacs: Patch more program file names Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 04/33] build-system: emacs: Use subdirectories again Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 05/33] gnu: emacs-libgit: Adjust to changes in emacs-build-system Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 06/33] gnu: emacs-guix: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 07/33] gnu: emacs-telega: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 08/33] gnu: Add emacs-telega-contrib Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 09/33] gnu: emacs-emacsql: Adjust to changes in emacs-build-system Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 10/33] gnu: emacs-howm: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 11/33] gnu: emacs-ert-runner: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 12/33] gnu: emacs-pdf-tools: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 13/33] gnu: emacs-shroud: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 14/33] gnu: emacs-sly-stepper: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 15/33] gnu: emacs-sly-stepper: Remove generated sources Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 16/33] gnu: emacs-org-contrib: Adjust to changes in emacs-build-system Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 17/33] gnu: emacs-edbi: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 18/33] gnu: emacs-scel: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 19/33] gnu: emacs-vterm: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 20/33] gnu: notmuch: " Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 21/33] gnu: emacs-pyim: Update to 3.6 Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 22/33] gnu: emacs-realgud: Adjust to changes in emacs-build-system Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 23/33] gnu: emacs-geiser: Update to 0.13 Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 24/33] gnu: Add emacs-geiser-guile Leo Prikler
2021-04-08 17:49 ` [bug#47661] [PATCH 25/33] gnu: emacs-guix: Update to 0.5.2-4.8ce6d21 Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 26/33] gnu: emacs-flycheck-guile: Add missing input Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 27/33] gnu: guile-studio: " Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 28/33] gnu: geiser-gauche: Adjust to changes in emacs-build-system Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 29/33] gnu: emacs-dvc: " Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 30/33] gnu: emacs-w3m: " Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 31/33] gnu: emacs-wget: Port to emacs-build-system Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 32/33] gnu: emacs-haskell-mode: Adjust to changes in emacs-build-system Leo Prikler
2021-04-08 17:50 ` [bug#47661] [PATCH 33/33] gnu: emacs-julia-snail: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 01/33] profiles: Add hook for Emacs subdirs Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 02/33] gnu: emacs: Wrap EMACSLOADPATH Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 03/33] gnu: emacs: Add coreutils and gzip to PATH Leo Prikler
2021-04-17 17:06 ` Leo Prikler [this message]
2021-04-17 17:06 ` [bug#47661] [PATCH v2 05/33] gnu: emacs-libgit: Adjust to changes in emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 06/33] gnu: emacs-guix: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 07/33] gnu: emacs-telega: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 08/33] gnu: Add emacs-telega-contrib Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 09/33] gnu: emacs-emacsql: Adjust to changes in emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 10/33] gnu: emacs-howm: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 11/33] gnu: emacs-ert-runner: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 12/33] gnu: emacs-pdf-tools: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 13/33] gnu: emacs-shroud: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 14/33] gnu: emacs-sly-stepper: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 15/33] gnu: emacs-sly-stepper: Remove generated sources Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 16/33] gnu: emacs-org-contrib: Adjust to changes in emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 17/33] gnu: emacs-edbi: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 18/33] gnu: emacs-scel: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 19/33] gnu: emacs-vterm: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 20/33] gnu: notmuch: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 21/33] gnu: emacs-pyim: Update to 3.6 Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 22/33] gnu: emacs-realgud: Adjust to changes in emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 23/33] gnu: emacs-geiser: Update to 0.13 Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 24/33] gnu: Add emacs-geiser-guile Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 25/33] gnu: emacs-guix: Update to 0.5.2-4.8ce6d21 Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 26/33] gnu: emacs-flycheck-guile: Add missing input Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 27/33] gnu: guile-studio: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 28/33] gnu: geiser-gauche: Adjust to changes in emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 29/33] gnu: emacs-dvc: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 30/33] gnu: emacs-w3m: " Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 31/33] gnu: emacs-wget: Port to emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 32/33] gnu: emacs-haskell-mode: Adjust to changes in emacs-build-system Leo Prikler
2021-04-17 17:06 ` [bug#47661] [PATCH v2 33/33] gnu: emacs-julia-snail: " Leo Prikler
2021-04-29 12:16 ` [bug#47661] [PATCH 00/33] Improve Emacs UX Xinglu Chen
2021-04-29 14:58 ` Leo Prikler
2021-04-30 8:25 ` Xinglu Chen
2021-05-01 18:45 ` bug#47661: " Leo Prikler
2021-05-04 5:13 ` [bug#47661] " Arun Isaac
2021-05-04 6:38 ` Leo Prikler
2021-05-04 21:02 ` Arun Isaac
2021-05-04 21:22 ` Leo Prikler
2021-05-05 7:47 ` Arun Isaac
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=20210417170648.3810-4-leo.prikler@student.tugraz.at \
--to=leo.prikler@student.tugraz.at \
--cc=47661@debbugs.gnu.org \
/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).