projects/guix·blob javascript-team · refs

225 lines · 8.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019 Danny Milosavljevic <[email protected]>
3;;; Copyright © 2019, 2026 Efraim Flashner <[email protected]>
4;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2021 Vincent Legoll <[email protected]>
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages efi)
23 #:use-module (gnu packages autotools)
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages linux)
26 #:use-module (gnu packages man)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages pkg-config)
29 #:use-module (gnu packages tls)
30 #:use-module (gnu packages)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix download)
34 #:use-module (guix gexp)
35 #:use-module (guix git-download)
36 #:use-module (guix packages)
37 #:use-module (guix utils)
38 #:use-module (ice-9 match))
39
40(define-public gnu-efi
41 (package
42 (name "gnu-efi")
43 (version "4.0.4")
44 (source
45 (origin
46 (method git-fetch)
47 (uri (git-reference
48 (url "https://github.com/ncroxon/gnu-efi")
49 (commit version)))
50 (file-name (git-file-name name version))
51 (sha256
52 (base32 "02hhl7xqiiicp0pra99vb0w3hqnyf9fxpzd5nsx1d9v1bk6dsjbp"))))
53 (build-system gnu-build-system)
54 (arguments
55 (list
56 #:tests? #f ;no tests
57 #:make-flags
58 #~(list (string-append "PREFIX=" #$output))
59 #:phases
60 #~(modify-phases %standard-phases
61 (delete 'configure))))
62 (home-page "https://github.com/ncroxon/gnu-efi")
63 (synopsis "EFI build environment with GNU toolchain")
64 (description
65 "This package provides a development environment for building programs
66targeting the @acronym{UEFI, Unified Extensible Firmware Interface}
67using the GNU toolchain.")
68 ;; Distribution is allowed only when accepting all those licenses.
69 (license (list license:bsd-2 license:bsd-3 license:bsd-4 license:expat))))
70
71(define-public gnu-efi-3
72 (package/inherit gnu-efi
73 (name (package-name gnu-efi))
74 (version "3.0.19")
75 (source
76 (origin
77 (method git-fetch)
78 (uri (git-reference
79 (url "https://github.com/ncroxon/gnu-efi")
80 (commit version)))
81 (file-name (git-file-name name version))
82 (sha256
83 (base32 "05jip30fcc49hfzjp1q63i73l8xkrskbdz1gjswdk6ypaa18mn66"))))))
84
85(define-public efi-analyzer
86 ;; No public releases; this is the master tip since 2026-01-28.
87 (let ((commit "8b6527eec8fa6d66d5208983cf6a906aad464c6d")
88 (revision "1"))
89 (package
90 (name "efi-analyzer")
91 (version (git-version "0.0.0" revision commit))
92 (source
93 (origin
94 (method git-fetch)
95 (uri (git-reference
96 (url "https://github.com/xypron/efi_analyzer")
97 (commit commit)))
98 (file-name (git-file-name name version))
99 (sha256
100 (base32 "0i9gg3fk7cq41pg6jf2xyfw60fp9wsavyvxafbf7x031vbgf1wyk"))))
101 (build-system gnu-build-system)
102 (arguments
103 (list
104 #:make-flags
105 #~(list (string-append "prefix=" #$output))
106 #:phases
107 #~(modify-phases %standard-phases
108 (add-after 'unpack 'support-cross-compilation
109 (lambda _
110 (substitute* "Makefile"
111 (("gcc") #$(cc-for-target)))))
112 (delete 'configure))))
113 (home-page "https://github.com/xypron/efi_analyzer")
114 (synopsis "Analyze EFI binaries")
115 (description
116 "The EFI Analyzer checks EFI binaries and prints out header and section
117information.")
118 (license license:bsd-2))))
119
120(define-public sbsigntools
121 (package
122 (name "sbsigntools")
123 (version "0.9.5")
124 (source
125 (origin
126 (method git-fetch)
127 (uri
128 (git-reference
129 (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git")
130 (commit (string-append "v" version))
131 (recursive? #t)))
132 (file-name (git-file-name name version))
133 (sha256
134 (base32 "060n6w0dx1mrilhdv482ncckanqz6pdv53piimiki0bm15d2fcp4"))))
135 (build-system gnu-build-system)
136 (arguments
137 (list
138 #:phases
139 #~(modify-phases %standard-phases
140 (add-after 'unpack 'patch-more-shebangs
141 (lambda* (#:key inputs native-inputs #:allow-other-keys)
142 (substitute* "lib/ccan.git/tools/create-ccan-tree"
143 (("#!/bin/bash")
144 (string-append "#!"
145 (search-input-file (or native-inputs inputs)
146 "/bin/bash"))))))
147 (add-after 'unpack 'patch
148 (lambda _
149 (substitute* '("configure.ac"
150 "tests/Makefile.am")
151 (("/usr/include/efi")
152 (string-append #$(this-package-input "gnu-efi")
153 "/include/efi"))
154 (("/usr/lib/gnuefi")
155 (string-append #$(this-package-input "gnu-efi")
156 "/lib")))))
157 (add-after 'unpack 'setenv
158 (lambda _
159 (setenv "CC" #$(cc-for-target)))))))
160 (native-inputs
161 (list autoconf
162 automake
163 bash
164 help2man
165 pkg-config
166 util-linux)) ; getopt
167 (inputs
168 (list gnu-efi
169 `(,util-linux "lib") ; libuuid
170 openssl))
171 (synopsis "EFI signing tools")
172 (description "This package provides tools for signing EFI binaries.")
173 (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/")
174 (license license:gpl3+)))
175
176(define-public efitools
177 (package
178 (name "efitools")
179 (version "1.9.2")
180 (source
181 (origin
182 (method git-fetch)
183 (uri (git-reference
184 (url "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git")
185 (commit (string-append "v" version))))
186 (file-name (git-file-name name version))
187 (sha256
188 (base32 "0jabgl2pxvfl780yvghq131ylpf82k7banjz0ksjhlm66ik8gb1i"))
189 (patches (search-patches "efitools-riscv64-support.patch"))))
190 (build-system gnu-build-system)
191 (arguments
192 (list
193 #:tests? #f ; No tests exist.
194 #:parallel-build? #f ; Makefile contains a race condition.
195 #:make-flags
196 #~(list "CC=gcc -g -O2 -Wno-error=implicit-function-declaration")
197 #:phases
198 #~(modify-phases %standard-phases
199 (add-after 'unpack 'patch
200 (lambda _
201 (let ((gnu-efi (assoc-ref %build-inputs "gnu-efi")))
202 (substitute* "Make.rules"
203 (("/usr/include/efi")
204 (string-append gnu-efi "/include/efi"))
205 (("\\$\\(DESTDIR\\)/usr")
206 #$output)
207 (("/usr/lib/gnuefi")
208 (string-append gnu-efi "/lib"))))))
209 (add-after 'unpack 'patch-more-shebangs
210 (lambda _
211 (substitute* "xxdi.pl"
212 (("/usr/bin/env perl")
213 (search-input-file %build-inputs "/bin/perl")))))
214 (delete 'configure))))
215 (native-inputs (list help2man perl perl-file-slurp sbsigntools))
216 (inputs (list gnu-efi openssl))
217 (synopsis "EFI tools (key management, variable management)")
218 (description "This package provides EFI tools for EFI key management
219and EFI variable management.")
220 (home-page
221 "https://blog.hansenpartnership.com/efitools-1-4-with-linux-key-manipulation-utilities-released/")
222 ;; Programs are under GPL 2.
223 ;; Library routines (in lib/) are under LGPL 2.1.
224 ;; Compiling/linking/using OpenSSL is permitted.
225 (license (list license:gpl2 license:lgpl2.1))))