[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#72406] [PATCH emacs-team WIP v4 01/24] build-system: emacs: Define
From: |
Liliana Marie Prikler |
Subject: |
[bug#72406] [PATCH emacs-team WIP v4 01/24] build-system: emacs: Define package-with-explicit-emacs. |
Date: |
Sun, 11 Aug 2024 14:58:42 +0200 |
* guix/build-system/emacs.scm (package-with-explicit-emacs): New procedure.
---
guix/build-system/emacs.scm | 51 +++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index ebf97a5344..3a11738496 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
+;;; Copyright © 2024 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -128,4 +129,54 @@ (define emacs-build-system
(description "The build system for Emacs packages")
(lower lower)))
+(define* (package-with-explicit-emacs emacs old-prefix new-prefix
+ #:key variant-property)
+ "Return a procedure of one argument, P. The procedure creates a package with
+the same fields as P, which is assumed to use EMACS-BUILD-SYSTEM, such that
+it is compiled with EMACS instead. The inputs are changed recursively
+accordingly. If the name of P starts with OLD-PREFIX, this is replaced by
+NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name.
+
+When VARIANT-PROPERTY is present, it is used as a key to search for
+pre-defined variants of this transformation recorded in the 'properties' field
+of packages. The property value must be the promise of a package. This is a
+convenient way for package writers to force the transformation to use
+pre-defined variants."
+ (define package-variant
+ (if variant-property
+ (lambda (package)
+ (assq-ref (package-properties package)
+ variant-property))
+ (const #f)))
+
+ (define (transform pkg)
+ (cond
+ ;; If VARIANT-PROPERTY is present, use that.
+ ((package-variant pkg)
+ => force)
+
+ ;; Otherwise build the new package object graph.
+ ((eq? (package-build-system pkg) emacs-build-system)
+ (package/inherit pkg
+ (location (package-location pkg))
+ (name (let ((name (package-name pkg)))
+ (string-append new-prefix
+ (if (string-prefix? old-prefix name)
+ (substring name
+ (string-length old-prefix))
+ name))))
+ (arguments
+ (let ((emacs (if (promise? emacs)
+ (force emacs)
+ emacs)))
+ (ensure-keyword-arguments (package-arguments pkg)
+ `(#:emacs ,emacs))))))
+ (else pkg)))
+
+ (define (cut? pkg)
+ (or (not (eq? (package-build-system pkg) emacs-build-system))
+ (package-variant pkg)))
+
+ (package-mapping transform cut?))
+
;;; emacs.scm ends here
--
2.45.2
- [bug#72406] [PATCH emacs-team WIP v4 00/24] Build variants for other Emacsen, Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 01/24] build-system: emacs: Define package-with-explicit-emacs.,
Liliana Marie Prikler <=
- [bug#72406] [PATCH emacs-team WIP v4 06/24] gnu: emacs-libgit: Build variants., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 04/24] build-system: emacs: Handle variants in elpa naming., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 08/24] gnu: emacs-tablist: Define variants., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 07/24] gnu: emacs-eweouz: Build variants., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 02/24] build-system: emacs: Make emacs the default variant., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 12/24] gnu: emacs-dash: Define variants., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 11/24] gnu: emacs-bui: Define variants., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 10/24] gnu: emacs-fontaine: Reindent., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 15/24] gnu: emacs-geiser-guile: Define variants., Liliana Marie Prikler, 2024/08/11
- [bug#72406] [PATCH emacs-team WIP v4 05/24] etc: Provide snippet for defining emacs variants., Liliana Marie Prikler, 2024/08/11