summaryrefslogtreecommitdiff
path: root/guix/build/emacs-build-system.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-05-24 22:12:13 +0200
committerMarius Bakke <mbakke@fastmail.com>2017-05-24 22:12:13 +0200
commit36747eb0dad504686560afba51742f782f7c3646 (patch)
tree2a35da31146f0a6693fd9cddfc0c514edefe9c99 /guix/build/emacs-build-system.scm
parentffaf5cbd361b6589daac1912aa5a43abea86e52b (diff)
parent0b7b8fb0456475374de24b6302a6ce3cc5921ed0 (diff)
Merge branch 'master' into staging
Diffstat (limited to 'guix/build/emacs-build-system.scm')
-rw-r--r--guix/build/emacs-build-system.scm36
1 files changed, 27 insertions, 9 deletions
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 44e8b0d31e..50af4be363 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -47,10 +47,12 @@
(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")))
+ (let ((suffix ".el"))
+ (let-values (((name version)
+ (package-name->name+version
+ (basename
+ (strip-store-file-name file) suffix))))
+ (string-append name suffix))))
(define* (unpack #:key source #:allow-other-keys)
"Unpack SOURCE into the build directory. SOURCE may be a compressed
@@ -93,14 +95,30 @@ store in '.el' files."
(substitute-cmd))))
#t))
-(define* (install #:key outputs #:allow-other-keys)
+(define* (install #:key outputs
+ (include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
+ (exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
+ #:allow-other-keys)
"Install the package contents."
+
+ (define source (getcwd))
+
+ (define (install-file? file stat)
+ (let ((stripped-file (string-trim (string-drop file (string-length source)) #\/)))
+ (and (any (cut string-match <> stripped-file) include)
+ (not (any (cut string-match <> stripped-file) exclude)))))
+
(let* ((out (assoc-ref outputs "out"))
(elpa-name-ver (store-directory->elpa-name-version out))
- (src-dir (getcwd))
- (tgt-dir (string-append out %install-suffix "/" elpa-name-ver)))
- (copy-recursively src-dir tgt-dir)
- #t))
+ (target-directory (string-append out %install-suffix "/" elpa-name-ver)))
+ (for-each
+ (lambda (file)
+ (let* ((stripped-file (string-drop file (string-length source)))
+ (target-file (string-append target-directory stripped-file)))
+ (format #t "`~a' -> `~a'~%" file target-file)
+ (install-file file (dirname target-file))))
+ (find-files source install-file?)))
+ #t)
(define* (move-doc #:key outputs #:allow-other-keys)
"Move info files from the ELPA package directory to the info directory."