unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] build: emacs: Handle sources that are a single elisp file.
@ 2016-05-27 14:10 David Thompson
  2016-05-27 14:10 ` [PATCH 2/2] gnu: Add emacs-better-defaults David Thompson
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: David Thompson @ 2016-05-27 14:10 UTC (permalink / raw)
  To: guix-devel

* guix/build/emacs-build-system.scm (gnu:unpack)
(store-file->elisp-source-file, unpack): New procedures.
(%standard-phases): Use the new unpack procedure.
---
 guix/build/emacs-build-system.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index f0a9a6e..4fd36d1 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)
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-06-08 12:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-27 14:10 [PATCH 1/2] build: emacs: Handle sources that are a single elisp file David Thompson
2016-05-27 14:10 ` [PATCH 2/2] gnu: Add emacs-better-defaults David Thompson
2016-05-28 14:05   ` Alex Kost
2016-05-28 15:37   ` Ludovic Courtès
2016-05-30 15:11     ` Thompson, David
2016-05-31 16:59       ` Mark H Weaver
2016-05-31 17:16         ` Thompson, David
2016-06-01  2:07           ` Mark H Weaver
2016-05-31 20:53         ` Alex Kost
2016-05-31 20:55           ` Thompson, David
2016-05-28 13:59 ` [PATCH 1/2] build: emacs: Handle sources that are a single elisp file Alex Kost
2016-05-28 15:36 ` Ludovic Courtès
2016-05-28 19:05   ` Alex Kost
2016-05-29 21:50     ` Ludovic Courtès
2016-05-30 10:14       ` Alex Kost
2016-05-30 11:55         ` Catonano
2016-05-30 12:42           ` Catonano
2016-05-30 15:12         ` Thompson, David
2016-05-30 16:27 ` Solving the ‘package-name->name+version’ name conflict. (was: [PATCH 1/2] build: emacs: Handle sources that are a single elisp file.) Mathieu Lirzin
2016-06-08 12:44   ` Solving the ‘package-name->name+version’ name conflict Ludovic Courtès

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).