aboutsummaryrefslogtreecommitdiff
path: root/guix/build/emacs-build-system.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2016-05-27 09:58:39 -0400
committerDavid Thompson <dthompson2@worcester.edu>2016-05-30 10:48:44 -0400
commit578b96af69057883a2a49a34dd6fe261cb2f4e5c (patch)
treec90f8e5a9da82cfbc89e9aa72d2d999a215aad77 /guix/build/emacs-build-system.scm
parent62a45cb647b9a54005557b6d503c4df58487e887 (diff)
downloadguix-578b96af69057883a2a49a34dd6fe261cb2f4e5c.tar
guix-578b96af69057883a2a49a34dd6fe261cb2f4e5c.tar.gz
build: emacs: Handle sources that are a single elisp file.
* guix/build/emacs-build-system.scm (gnu:unpack) (store-file->elisp-source-file, unpack): New procedures. (%standard-phases): Use the new unpack procedure.
Diffstat (limited to 'guix/build/emacs-build-system.scm')
-rw-r--r--guix/build/emacs-build-system.scm23
1 files changed, 23 insertions, 0 deletions
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index f0a9a6e125..ab970012a7 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -21,6 +21,7 @@
#:use-module (guix build utils)
#:use-module (guix build emacs-utils)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
@@ -39,6 +40,27 @@
;; archive signature.
(define %install-suffix "/share/emacs/site-lisp/guix.d")
+(define gnu:unpack (assoc-ref gnu:%standard-phases 'unpack))
+
+(define (store-file->elisp-source-file file)
+ "Convert FILE, a store file name for an Emacs Lisp source file, into a file
+name that has been stripped of the hash and version number."
+ (let-values (((name version)
+ (package-name->name+version
+ (strip-store-file-name file))))
+ (string-append name ".el")))
+
+(define* (unpack #:key source #:allow-other-keys)
+ "Unpack SOURCE into the build directory. SOURCE may be a compressed
+archive, a directory, or an Emacs Lisp file."
+ (if (string-suffix? ".el" source)
+ (begin
+ (mkdir "source")
+ (chdir "source")
+ (copy-file source (store-file->elisp-source-file source))
+ #t)
+ (gnu:unpack #:source source)))
+
(define* (build #:key outputs inputs #:allow-other-keys)
"Compile .el files."
(let* ((emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs"))
@@ -151,6 +173,7 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages."
(define %standard-phases
(modify-phases gnu:%standard-phases
+ (replace 'unpack unpack)
(delete 'configure)
(delete 'check)
(delete 'install)