gnu: ruby-kramdown: Update to 2.3.1 [fixes CVE-2021-28834].
[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")
c0c747cc 36 (version "1.32.1")
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
c0c747cc 44 "1vhd59qmrdyrr1q7rvxmyl96z192mxl089hi87yl0hcp6fyw8mwx"))))
95faa107
JD
45 (build-system gnu-build-system)
46 (arguments
6d96af5e 47 '(#:phases
84d08af6 48 (modify-phases %standard-phases
c37dc30e
DM
49 (add-before 'configure 'disable-timestamps
50 (lambda _
51 (setenv "KCONFIG_NOTIMESTAMP" "1")
52 #t))
e9ab4b40
EF
53 (add-before 'configure 'disable-taskset
54 ;; This feature fails its tests in the build environment,
55 ;; was default 'n' until after 1.26.2.
56 (lambda _
57 (substitute* "util-linux/taskset.c"
58 (("default y") "default n"))
59 #t))
84d08af6 60 (replace 'configure
a7eaaec8
DM
61 (lambda* (#:key make-flags #:allow-other-keys)
62 (apply invoke "make" "defconfig" make-flags)))
505459d7
EF
63 (add-after 'configure 'dont-install-to-usr
64 (lambda _
65 (substitute* ".config"
66 (("# CONFIG_INSTALL_NO_USR is not set")
67 "CONFIG_INSTALL_NO_USR=y"))
68 #t))
84d08af6 69 (replace 'check
a7eaaec8 70 (lambda* (#:key make-flags #:allow-other-keys)
6d96af5e
EF
71 (substitute* '("testsuite/du/du-s-works"
72 "testsuite/du/du-works")
84d08af6 73 (("/bin") "/etc")) ; there is no /bin but there is a /etc
95faa107 74
6d96af5e
EF
75 ;; There is no /usr/bin or /bin - replace it with /gnu/store
76 (substitute* "testsuite/cpio.tests"
84d08af6
EF
77 (("/usr/bin") (%store-directory))
78 (("usr") (car (filter (negate string-null?)
6d96af5e 79 (string-split (%store-directory) #\/)))))
95faa107 80
6d96af5e 81 (substitute* "testsuite/date/date-works-1"
84d08af6 82 (("/bin/date") (which "date")))
95faa107 83
4fdf3a2e
DM
84 (substitute* "testsuite/start-stop-daemon.tests"
85 (("/bin/false") (which "false")))
86
6d96af5e
EF
87 ;; The pidof tests assume that pid 1 is called "init" but that is not
88 ;; true in guix build environment
89 (substitute* "testsuite/pidof.tests"
84d08af6 90 (("-s init") "-s $(cat /proc/1/comm)"))
8f330aeb 91
6d96af5e
EF
92 ;; This test cannot possibly pass.
93 ;; It is trying to test that "which ls" returns "/bin/ls" when PATH is not set.
94 ;; However, this relies on /bin/ls existing. Which it does not in guix.
95 (delete-file "testsuite/which/which-uses-default-path")
96 (rmdir "testsuite/which")
95faa107 97
a7eaaec8 98 (apply invoke "make"
f7705d4c
TGR
99 ;; "V=1"
100 "SKIP_KNOWN_BUGS=1"
101 "SKIP_INTERNET_TESTS=1"
a7eaaec8 102 "check" make-flags)))
84d08af6 103 (replace 'install
a7eaaec8 104 (lambda* (#:key outputs make-flags #:allow-other-keys)
84d08af6 105 (let ((out (assoc-ref outputs "out")))
a7eaaec8 106 (apply invoke "make"
f7705d4c 107 (string-append "CONFIG_PREFIX=" out)
a7eaaec8 108 "install" make-flags)))))))
95faa107
JD
109 (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
110 ;; The following are needed by the tests.
111 ("inetutils" ,inetutils)
2e5505e5 112 ("which" ,(@ (gnu packages base) which))
95faa107
JD
113 ("zip" ,zip)))
114 (synopsis "Many common UNIX utilities in a single executable")
115 (description "BusyBox combines tiny versions of many common UNIX utilities
24753e69
JD
116into a single small executable. It provides a fairly complete environment for
117any small or embedded system.")
2e5505e5 118 (home-page "https://www.busybox.net")
95faa107
JD
119 ;; Some files are gplv2+
120 (license gpl2)))
42140fd4
EF
121
122(define-public toybox
123 (package
124 (name "toybox")
4d89e302 125 (version "0.8.3")
42140fd4
EF
126 (source (origin
127 (method url-fetch)
128 (uri (string-append
129 "https://landley.net/toybox/downloads/toybox-"
130 version ".tar.gz"))
131 (sha256
132 (base32
4d89e302 133 "00aw9d809wj1bqlb2fsssdgz7rj0363ya14py0gfdm0rkp98zcpa"))))
42140fd4
EF
134 (build-system gnu-build-system)
135 (arguments
f769ad12 136 `(#:phases
42140fd4
EF
137 (modify-phases %standard-phases
138 (add-before 'configure 'set-environment-variables
139 (lambda _
f769ad12 140 (setenv "CC" ,(cc-for-target))
42140fd4
EF
141 (setenv "HOSTCC" (which "gcc"))
142 #t))
143 (replace 'configure
144 (lambda _ (invoke "make" "defconfig")))
145 (replace 'install
146 (lambda* (#:key outputs #:allow-other-keys)
147 (let ((out (assoc-ref outputs "out")))
148 (invoke "make"
149 (string-append "PREFIX=" out)
ee0b4733
EF
150 "install"))))
151 (add-after 'install 'remove-usr-directory
152 (lambda* (#:key outputs #:allow-other-keys)
153 (let ((out (assoc-ref outputs "out")))
154 (delete-file-recursively (string-append out "/usr"))
155 #t))))
42140fd4
EF
156 #:test-target "tests"))
157 (native-inputs `(("bc" ,bc)))
158 (synopsis "Many common UNIX utilities in a single executable")
159 (description "ToyBox combines tiny versions of many common UNIX utilities
160into a single small executable. It provides a fairly complete environment for
161any small or embedded system.")
162 (home-page "https://landley.net/toybox/")
163 (license bsd-2)))