From 515a9392b8912fbfb067728acb25f84de83d8378 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 22:34:36 +0100 Subject: [PATCH 1/2] gnu: Add package-elisp-from-package Add a function to generate package definitions that packages single elisp files from other packages. * gnu/packages/llvm.scm (package-elisp-from-package): New function --- gnu/packages/llvm.scm | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index b1e41d72f..5518d4d5c 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2018 Marius Bakke ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Efraim Flashner -;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2018, 2019 Tim Gesthuizen ;;; Copyright © 2018 Pierre Neidhardt ;;; ;;; This file is part of GNU Guix. @@ -508,6 +508,36 @@ SOURCE-FILES found in SOURCE-PACKAGE." (append '("." "..") basenames))) #t))))))) +(define (package-elisp-from-package + source-package package-name source-files) + "Return 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))))))) + (define-public emacs-clang-format (package (inherit clang) -- 2.20.1