gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / busybox.scm
CommitLineData
95faa107 1;;; GNU Guix --- Functional package management for GNU
2e5505e5 2;;; Copyright © 2014 John Darrington <jmd@gnu.org>
8f330aeb 3;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
c0c747cc 4;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
95faa107
JD
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages busybox)
22 #:use-module (guix licenses)
23 #:use-module (guix packages)
24 #:use-module (guix download)
f769ad12 25 #:use-module (guix utils)
95faa107
JD
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages admin)
42140fd4 29 #:use-module (gnu packages algebra)
148585c2
AI
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages perl))
95faa107
JD
32
33(define-public busybox
34 (package
35 (name "busybox")
60d629d7 36 (version "1.33.0")
95faa107
JD
37 (source (origin
38 (method url-fetch)
39 (uri (string-append
2e5505e5 40 "https://www.busybox.net/downloads/" name "-"
95faa107
JD
41 version ".tar.bz2"))
42 (sha256
43 (base32
60d629d7 44 "1gcg7ggg79apdlp5qnrh9pbjl10fx30yn33p21kxqpm8j4f6hs6m"))
572528e7 45 (patches (search-patches "busybox-CVE-2021-28831.patch"))))
95faa107
JD
46 (build-system gnu-build-system)
47 (arguments
6d96af5e 48 '(#:phases
84d08af6 49 (modify-phases %standard-phases
c37dc30e
DM
50 (add-before 'configure 'disable-timestamps
51 (lambda _
52 (setenv "KCONFIG_NOTIMESTAMP" "1")
53 #t))
e9ab4b40
EF
54 (add-before 'configure 'disable-taskset
55 ;; This feature fails its tests in the build environment,
56 ;; was default 'n' until after 1.26.2.
57 (lambda _
58 (substitute* "util-linux/taskset.c"
59 (("default y") "default n"))
60 #t))
84d08af6 61 (replace 'configure
a7eaaec8
DM
62 (lambda* (#:key make-flags #:allow-other-keys)
63 (apply invoke "make" "defconfig" make-flags)))
505459d7
EF
64 (add-after 'configure 'dont-install-to-usr
65 (lambda _
66 (substitute* ".config"
67 (("# CONFIG_INSTALL_NO_USR is not set")
68 "CONFIG_INSTALL_NO_USR=y"))
69 #t))
84d08af6 70 (replace 'check
a7eaaec8 71 (lambda* (#:key make-flags #:allow-other-keys)
6d96af5e
EF
72 (substitute* '("testsuite/du/du-s-works"
73 "testsuite/du/du-works")
84d08af6 74 (("/bin") "/etc")) ; there is no /bin but there is a /etc
95faa107 75
6d96af5e
EF
76 ;; There is no /usr/bin or /bin - replace it with /gnu/store
77 (substitute* "testsuite/cpio.tests"
84d08af6
EF
78 (("/usr/bin") (%store-directory))
79 (("usr") (car (filter (negate string-null?)
6d96af5e 80 (string-split (%store-directory) #\/)))))
95faa107 81
6d96af5e 82 (substitute* "testsuite/date/date-works-1"
84d08af6 83 (("/bin/date") (which "date")))
95faa107 84
4fdf3a2e
DM
85 (substitute* "testsuite/start-stop-daemon.tests"
86 (("/bin/false") (which "false")))
87
6d96af5e
EF
88 ;; The pidof tests assume that pid 1 is called "init" but that is not
89 ;; true in guix build environment
90 (substitute* "testsuite/pidof.tests"
84d08af6 91 (("-s init") "-s $(cat /proc/1/comm)"))
8f330aeb 92
6d96af5e
EF
93 ;; This test cannot possibly pass.
94 ;; It is trying to test that "which ls" returns "/bin/ls" when PATH is not set.
95 ;; However, this relies on /bin/ls existing. Which it does not in guix.
96 (delete-file "testsuite/which/which-uses-default-path")
97 (rmdir "testsuite/which")
95faa107 98
a7eaaec8 99 (apply invoke "make"
f7705d4c
TGR
100 ;; "V=1"
101 "SKIP_KNOWN_BUGS=1"
102 "SKIP_INTERNET_TESTS=1"
a7eaaec8 103 "check" make-flags)))
84d08af6 104 (replace 'install
a7eaaec8 105 (lambda* (#:key outputs make-flags #:allow-other-keys)
84d08af6 106 (let ((out (assoc-ref outputs "out")))
a7eaaec8 107 (apply invoke "make"
f7705d4c 108 (string-append "CONFIG_PREFIX=" out)
a7eaaec8 109 "install" make-flags)))))))
95faa107
JD
110 (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
111 ;; The following are needed by the tests.
112 ("inetutils" ,inetutils)
2e5505e5 113 ("which" ,(@ (gnu packages base) which))
95faa107
JD
114 ("zip" ,zip)))
115 (synopsis "Many common UNIX utilities in a single executable")
116 (description "BusyBox combines tiny versions of many common UNIX utilities
24753e69
JD
117into a single small executable. It provides a fairly complete environment for
118any small or embedded system.")
2e5505e5 119 (home-page "https://www.busybox.net")
95faa107
JD
120 ;; Some files are gplv2+
121 (license gpl2)))
42140fd4
EF
122
123(define-public toybox
124 (package
125 (name "toybox")
4d89e302 126 (version "0.8.3")
42140fd4
EF
127 (source (origin
128 (method url-fetch)
129 (uri (string-append
130 "https://landley.net/toybox/downloads/toybox-"
131 version ".tar.gz"))
132 (sha256
133 (base32
4d89e302 134 "00aw9d809wj1bqlb2fsssdgz7rj0363ya14py0gfdm0rkp98zcpa"))))
42140fd4
EF
135 (build-system gnu-build-system)
136 (arguments
f769ad12 137 `(#:phases
42140fd4
EF
138 (modify-phases %standard-phases
139 (add-before 'configure 'set-environment-variables
140 (lambda _
f769ad12 141 (setenv "CC" ,(cc-for-target))
42140fd4
EF
142 (setenv "HOSTCC" (which "gcc"))
143 #t))
144 (replace 'configure
145 (lambda _ (invoke "make" "defconfig")))
146 (replace 'install
147 (lambda* (#:key outputs #:allow-other-keys)
148 (let ((out (assoc-ref outputs "out")))
149 (invoke "make"
150 (string-append "PREFIX=" out)
ee0b4733
EF
151 "install"))))
152 (add-after 'install 'remove-usr-directory
153 (lambda* (#:key outputs #:allow-other-keys)
154 (let ((out (assoc-ref outputs "out")))
155 (delete-file-recursively (string-append out "/usr"))
156 #t))))
42140fd4
EF
157 #:test-target "tests"))
158 (native-inputs `(("bc" ,bc)))
159 (synopsis "Many common UNIX utilities in a single executable")
160 (description "ToyBox combines tiny versions of many common UNIX utilities
161into a single small executable. It provides a fairly complete environment for
162any small or embedded system.")
163 (home-page "https://landley.net/toybox/")
164 (license bsd-2)))