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