build-system: emacs: Install only a subset of files.
* guix/build/emacs-build-system.scm (install): Install files matching #:include while excluding files matching #:exclude. * guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include and #:exclude.
This commit is contained in:
parent
0dc4a498a3
commit
d879685176
2 changed files with 25 additions and 5 deletions
|
@ -83,6 +83,8 @@
|
||||||
(phases '(@ (guix build emacs-build-system)
|
(phases '(@ (guix build emacs-build-system)
|
||||||
%standard-phases))
|
%standard-phases))
|
||||||
(outputs '("out"))
|
(outputs '("out"))
|
||||||
|
(include ''("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
|
||||||
|
(exclude ''("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
|
||||||
(search-paths '())
|
(search-paths '())
|
||||||
(system (%current-system))
|
(system (%current-system))
|
||||||
(guile #f)
|
(guile #f)
|
||||||
|
@ -108,6 +110,8 @@
|
||||||
#:tests? ,tests?
|
#:tests? ,tests?
|
||||||
#:phases ,phases
|
#:phases ,phases
|
||||||
#:outputs %outputs
|
#:outputs %outputs
|
||||||
|
#:include ,include
|
||||||
|
#:exclude ,exclude
|
||||||
#:search-paths ',(map search-path-specification->sexp
|
#:search-paths ',(map search-path-specification->sexp
|
||||||
search-paths)
|
search-paths)
|
||||||
#:inputs %build-inputs)))
|
#:inputs %build-inputs)))
|
||||||
|
|
|
@ -95,14 +95,30 @@ store in '.el' files."
|
||||||
(substitute-cmd))))
|
(substitute-cmd))))
|
||||||
#t))
|
#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."
|
"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"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(elpa-name-ver (store-directory->elpa-name-version out))
|
(elpa-name-ver (store-directory->elpa-name-version out))
|
||||||
(src-dir (getcwd))
|
(target-directory (string-append out %install-suffix "/" elpa-name-ver)))
|
||||||
(tgt-dir (string-append out %install-suffix "/" elpa-name-ver)))
|
(for-each
|
||||||
(copy-recursively src-dir tgt-dir)
|
(lambda (file)
|
||||||
#t))
|
(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)
|
(define* (move-doc #:key outputs #:allow-other-keys)
|
||||||
"Move info files from the ELPA package directory to the info directory."
|
"Move info files from the ELPA package directory to the info directory."
|
||||||
|
|
Reference in a new issue