diff mbox series

[bug#72457,v3,08/15] gnu: packages: Add pesign.

Message ID 1a0a6070dd97d88544a22c58d208cba64915ff5c.1722803521.git.lilah@lunabee.space
State New
Headers show
Series Rewrite bootloader subsystem. | expand

Commit Message

Lilah Tascheter Aug. 4, 2024, 8:31 p.m. UTC
* gnu/packages/efi.scm (pesign): New variable.

Change-Id: I00fcc679d9514c85d508183b9ec7e121e0a814db
---
 gnu/packages/efi.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/efi.scm b/gnu/packages/efi.scm
index 499745eba1..417b70d91b 100644
--- a/gnu/packages/efi.scm
+++ b/gnu/packages/efi.scm
@@ -24,8 +24,10 @@  (define-module (gnu packages efi)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages nss)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages popt)
   #:use-module (gnu packages tls)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
@@ -153,6 +155,51 @@  (define-public sbsigntools
     (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/")
     (license license:gpl3+)))
 
+(define-public pesign
+  (package
+    (name "pesign")
+    (version "116")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://github.com/rhboot/pesign")
+                     (commit version)))
+              (snippet #~(substitute* "Make.defaults"
+                           (("pkg-config-ccldflags") "pkg-config-ldflags")))
+              (modules '((guix build utils)))
+              (sha256
+                (base32
+                  "0fnqfiivj46bha4hsnwiqy8vq8b4i3w2dig0h9h2k4j7yq7r5qvj"))))
+    (build-system gnu-build-system)
+    (arguments
+      (list #:tests? #f
+            #:modules '((guix build gnu-build-system)
+                        (guix build utils)
+                        (ice-9 match))
+            #:phases #~(modify-phases %standard-phases (delete 'configure))
+            #:make-flags
+            (let ((system (%current-system)) (target (%current-target-system)))
+              (define (arch s) (match (string-split s #\-)
+                                 (("i386" _ ...) "ia32")
+                                 (("i486" _ ...) "ia32")
+                                 (("i586" _ ...) "ia32")
+                                 (("i686" _ ...) "ia32")
+                                 ((x _ ...) x)))
+              #~(list "prefix=/" "libdir=/lib/"
+                      (string-append "DESTDIR=" #$output)
+                      (string-append "HOSTARCH=" #$(arch system))
+                      (string-append "ARCH=" #$(arch (or target system)))
+                      (string-append "CROSS_COMPILE="
+                        #$@(if target (list target "-gcc") '()))))))
+    (inputs (list efivar nspr nss popt `(,util-linux "lib")))
+    (native-inputs (list mandoc pkg-config))
+    (synopsis "PE-COFF binary signing tools")
+    (description "Supports EFI keygen and subsequent signing of PE-COFF
+binaries.  Contains the tools authvar, efikeygen, pesigcheck, pesign,
+pesign-client, and pesum.")
+    (home-page "https://github.com/rhboot/pesign")
+    (license license:gpl2+)))
+
 (define-public efitools
   (package
     (name "efitools")