From 7d5856bd4570a6c5a3cf1daf6273b638e09b6d50 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 22:34:36 +0100 Subject: gnu: Add package-elisp-from-package Add a function to generate package definitions that packages single elisp files from other packages. * gnu/packages/emacs.scm (package-elisp-from-package): New function --- gnu/packages/emacs.scm | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index ec67f278c9..cbfec8f70a 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -35,7 +35,7 @@ ;;; Copyright © 2018 Sohom Bhattacharjee ;;; Copyright © 2018 Mathieu Lirzin ;;; Copyright © 2018 Pierre Neidhardt -;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2018, 2019 Tim Gesthuizen ;;; Copyright © 2018 Jack Hill ;;; Copyright © 2018 Pierre-Antoine Rouby ;;; Copyright © 2018 Alex Branham @@ -331,6 +331,36 @@ editor (without an X toolkit)" ) (lambda _ (invoke "mkdir" "-p" "src/deps"))))))))) +(define-public (package-elisp-from-package + source-package package-name source-files) + "Returns a package definition that packages emacs-lisp files from the +SOURCE-PACKAGEs source. The package has the name PACKAGE-NAME and packages +the files SOURCE-FILES from the source in its root directory." + (let ((orig (package-source source-package))) + (package + (inherit source-package) + (name package-name) + (build-system emacs-build-system) + (source (origin + (method (origin-method orig)) + (uri (origin-uri orig)) + (sha256 (origin-sha256 orig)) + (file-name (string-append package-name "-" + (package-version source-package))) + (modules '((guix build utils) + (srfi srfi-1) + (ice-9 ftw))) + (snippet + `(let* ((source-files (quote ,source-files)) + (basenames (map basename source-files))) + (map copy-file + source-files basenames) + (map delete-file-recursively + (fold delete + (scandir ".") + (append '("." "..") basenames))) + #t))))))) + ;;; ;;; Emacs hacking. -- cgit v1.2.3