gnu: sxiv: Install icons.
[jackhill/guix/guix.git] / gnu / packages / genimage.scm
CommitLineData
f7c4853a
DM
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages genimage)
20 #:use-module (guix utils)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix build-system gnu)
25 #:use-module (guix build utils)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages bootloaders)
31 #:use-module (gnu packages cdrom)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages cpio)
34 #:use-module (gnu packages disk)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages mtools)
37 #:use-module (gnu packages pkg-config)
205df739
TGR
38 #:use-module (gnu packages textutils)
39 #:use-module (gnu packages virtualization))
f7c4853a
DM
40
41(define-public genimage
42 (package
43 (name "genimage")
ba6f2bda 44 (version "11")
f7c4853a
DM
45 (source (origin
46 (method git-fetch)
47 (uri (git-reference
b0e7b699 48 (url "https://github.com/pengutronix/genimage")
f7c4853a
DM
49 (commit (string-append "v" version))))
50 (file-name (string-append name "-" version "-checkout"))
51 (sha256
52 (base32
ee7a7c90
AE
53 "15jmh17lvm3jw9c92bjarly7iwhmnfl322d91mprfv10ppb9ip54"))
54 ;; will be shipped with release 14
55 (patches (search-patches "genimage-signedness.patch"))))
f7c4853a
DM
56 (build-system gnu-build-system)
57 (arguments
58 `(#:phases
59 (modify-phases %standard-phases
60 (add-after 'unpack 'guixify
61 (lambda* (#:key inputs #:allow-other-keys)
62 ;; Note to maintainers: Check ".def =" lines in source.
63 (substitute* "config.c"
64 (("\\.def = \"cpio\"")
65 (string-append ".def = \""
66 (assoc-ref inputs "cpio")
67 "/bin/cpio\""))
68 (("\\.def = \"dd\"")
69 (string-append ".def = \""
70 (assoc-ref inputs "coreutils")
71 "/bin/dd\""))
72 (("\\.def = \"debugfs\"")
73 (string-append ".def = \""
74 (assoc-ref inputs "e2fsprogs")
75 "/sbin/debugfs\""))
76 (("\\.def = \"e2fsck\"")
77 (string-append ".def = \""
78 (assoc-ref inputs "e2fsprogs")
79 "/sbin/e2fsck\""))
80 (("\\.def = \"genext2fs\"")
81 (string-append ".def = \""
82 (assoc-ref inputs "genext2fs")
83 "/bin/genext2fs\""))
84 (("\\.def = \"genisoimage\"")
85 (string-append ".def = \""
86 (assoc-ref inputs "cdrkit-libre")
87 "/bin/genisoimage\""))
88 (("\\.def = \"mcopy\"")
89 (string-append ".def = \""
90 (assoc-ref inputs "mtools")
91 "/bin/mcopy\""))
92 (("\\.def = \"mmd\"")
93 (string-append ".def = \""
94 (assoc-ref inputs "mtools")
95 "/bin/mmd\""))
96 ;;; Note: mkcramfs is obsolete.
97 (("\\.def = \"mkdosfs\"")
98 (string-append ".def = \""
99 (assoc-ref inputs "dosfstools")
100 "/sbin/mkfs.fat\""))
101 (("\\.def = \"mke2fs\"")
102 (string-append ".def = \""
103 (assoc-ref inputs "e2fsprogs")
104 "/sbin/mke2fs\""))
105 (("\\.def = \"mkfs\\.jffs2\"")
106 (string-append ".def = \""
107 (assoc-ref inputs "mtd-utils")
108 "/sbin/mkfs.jffs2\""))
109 (("\\.def = \"mkfs\\.ubifs\"")
110 (string-append ".def = \""
111 (assoc-ref inputs "mtd-utils")
112 "/sbin/mkfs.ubifs\""))
113 (("\\.def = \"mksquashfs\"")
114 (string-append ".def = \""
115 (assoc-ref inputs "squashfs-tools")
116 "/bin/mksquashfs\""))
117 (("\\.def = \"qemu-img\"")
118 (string-append ".def = \""
119 (assoc-ref inputs "qemu")
120 "/bin/qemu-img\""))
121 (("\\.def = \"tar\"")
122 (string-append ".def = \""
123 (assoc-ref inputs "tar")
124 "/bin/tar\""))
125 (("\\.def = \"tune2fs\"")
126 (string-append ".def = \""
127 (assoc-ref inputs "e2fsprogs")
128 "/sbin/tune2fs\""))
129 (("\\.def = \"ubinize\"")
130 (string-append ".def = \""
131 (assoc-ref inputs "mtd-utils")
132 "/sbin/ubinize\""))
133 (("\\.def = \"mkimage\"")
134 (string-append ".def = \""
135 (assoc-ref inputs "u-boot-tools")
136 "/bin/mkimage\"")))
137 (substitute* "test/basic-images.test"
138 ;; Work around bug in sharness.sh.
139 (("mkdosfs")
140 "mkfs.fat")
141 ;; Work around bug in sharness.sh.
142 (("dd,mkfs\\.fat,mcopy")
143 "dd,mkfs_fat,mcopy")
144 ;; Should be in the next upstream release.
145 (("qemu_img") "qemu-img"))
146 (substitute* "util.c"
147 (("\"/bin/sh\"")
148 (string-append "\"" (assoc-ref inputs "bash") "/bin/sh\"")))
149 ;; We don't have /etc/passwd so uid 0 is not known as "root".
150 ;; Thus patch it out.
151 (substitute* '("test/ext2test.dump"
152 "test/ext3test.dump"
153 "test/ext4test.dump"
ba6f2bda 154 "test/ext2test-percent.dump"
f7c4853a
DM
155 "test/mke2fs.dump")
156 (("root") "unknown"))
157 #t))
158 (add-before 'check 'setenv-check
159 (lambda _
160 ;; Our container doesn't provide access to /etc/mtab
161 (setenv "EXT2FS_NO_MTAB_OK" "1")
162 ;; Make test reproducible
163 (setenv "GENIMAGE_MKFJFFS2" "mkfs.jffs2 -U")
164 (setenv "GENIMAGE_MKE2FS" "mke2fs -E no_copy_xattrs")
165 #t))
166 (replace 'check
167 (lambda _
168 (invoke "make" "TEST_LOG_COMPILER=" "check"))))))
169 (native-inputs
170 `(("autoconf" ,autoconf)
171 ("automake" ,automake)
172 ;;; Note: cramfs is obsolete.
173 ("dtc" ,dtc) ; for the tests
f7c4853a
DM
174 ("pkg-config" ,pkg-config)
175 ("util-linux" ,util-linux))) ; for the tests
176 (inputs
177 `(("bash" ,bash)
178 ("cdrkit-libre" ,cdrkit-libre)
179 ("cpio" ,cpio)
180 ;; Note: invoked by final executable.
181 ("coreutils" ,coreutils) ; chmod, dd
182 ("dosfstools" ,dosfstools)
183 ("e2fsprogs" ,e2fsprogs)
184 ("genext2fs" ,genext2fs)
185 ("libconfuse" ,libconfuse)
186 ("mtd-utils" ,mtd-utils)
187 ("mtools" ,mtools)
188 ("qemu" ,qemu-minimal)
189 ("squashfs-tools" ,squashfs-tools)
190 ("tar" ,tar)
191 ("u-boot-tools" ,u-boot-tools)))
192 (synopsis "Create Flash images according to specification")
193 (description "@command{genimage} creates Flash images according to a
194specification file.")
195 (home-page "https://github.com/pengutronix/genimage")
196 (license license:gpl2)))