gnu: pocl: Update to 1.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 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2018 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 compression)
29 #:use-module (gnu packages perl))
30
31 (define-public busybox
32 (package
33 (name "busybox")
34 (version "1.29.3")
35 (source (origin
36 (method url-fetch)
37 (uri (string-append
38 "https://www.busybox.net/downloads/" name "-"
39 version ".tar.bz2"))
40 (sha256
41 (base32
42 "1dzg45vgy2w1xcd3p6h8d76ykhabbvk1h0lf8yb24ikrwlv8cr4p"))))
43 (build-system gnu-build-system)
44 (arguments
45 '(#:phases
46 (modify-phases %standard-phases
47 (add-before 'configure 'disable-taskset
48 ;; This feature fails its tests in the build environment,
49 ;; was default 'n' until after 1.26.2.
50 (lambda _
51 (substitute* "util-linux/taskset.c"
52 (("default y") "default n"))
53 #t))
54 (replace 'configure
55 (lambda _ (invoke "make" "defconfig")))
56 (replace 'check
57 (lambda _
58 (substitute* '("testsuite/du/du-s-works"
59 "testsuite/du/du-works")
60 (("/bin") "/etc")) ; there is no /bin but there is a /etc
61
62 ;; There is no /usr/bin or /bin - replace it with /gnu/store
63 (substitute* "testsuite/cpio.tests"
64 (("/usr/bin") (%store-directory))
65 (("usr") (car (filter (negate string-null?)
66 (string-split (%store-directory) #\/)))))
67
68 (substitute* "testsuite/date/date-works-1"
69 (("/bin/date") (which "date")))
70
71 ;; The pidof tests assume that pid 1 is called "init" but that is not
72 ;; true in guix build environment
73 (substitute* "testsuite/pidof.tests"
74 (("-s init") "-s $(cat /proc/1/comm)"))
75
76 ;; This test cannot possibly pass.
77 ;; It is trying to test that "which ls" returns "/bin/ls" when PATH is not set.
78 ;; However, this relies on /bin/ls existing. Which it does not in guix.
79 (delete-file "testsuite/which/which-uses-default-path")
80 (rmdir "testsuite/which")
81
82 (invoke "make"
83 ;; "V=1"
84 "SKIP_KNOWN_BUGS=1"
85 "SKIP_INTERNET_TESTS=1"
86 "check")))
87 (replace 'install
88 (lambda* (#:key outputs #:allow-other-keys)
89 (let ((out (assoc-ref outputs "out")))
90 (invoke "make"
91 (string-append "CONFIG_PREFIX=" out)
92 "install")))))))
93 (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
94 ;; The following are needed by the tests.
95 ("inetutils" ,inetutils)
96 ("which" ,(@ (gnu packages base) which))
97 ("zip" ,zip)))
98 (synopsis "Many common UNIX utilities in a single executable")
99 (description "BusyBox combines tiny versions of many common UNIX utilities
100 into a single small executable. It provides a fairly complete environment for
101 any small or embedded system.")
102 (home-page "https://www.busybox.net")
103 ;; Some files are gplv2+
104 (license gpl2)))