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