gnu: Add texlive-latex-etoolbox.
[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 Efraim Flashner <efraim@flashner.co.il>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages busybox)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages admin)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages perl))
29
30 (define-public busybox
31 (package
32 (name "busybox")
33 (version "1.26.2")
34 (source (origin
35 (method url-fetch)
36 (uri (string-append
37 "https://www.busybox.net/downloads/" name "-"
38 version ".tar.bz2"))
39 (sha256
40 (base32
41 "05mg6rh5smkzfwqfcazkpwy6h6555llsazikqnvwkaf17y8l8gns"))))
42 (build-system gnu-build-system)
43 (arguments
44 '(#:phases
45 (modify-phases %standard-phases
46 (replace 'configure
47 (lambda _ (zero? (system* "make" "defconfig"))))
48 (replace 'check
49 (lambda _
50 (substitute* '("testsuite/du/du-s-works"
51 "testsuite/du/du-works")
52 (("/bin") "/etc")) ; there is no /bin but there is a /etc
53
54 ;; There is no /usr/bin or /bin - replace it with /gnu/store
55 (substitute* "testsuite/cpio.tests"
56 (("/usr/bin") (%store-directory))
57 (("usr") (car (filter (negate string-null?)
58 (string-split (%store-directory) #\/)))))
59
60 (substitute* "testsuite/date/date-works-1"
61 (("/bin/date") (which "date")))
62
63 ;; The pidof tests assume that pid 1 is called "init" but that is not
64 ;; true in guix build environment
65 (substitute* "testsuite/pidof.tests"
66 (("-s init") "-s $(cat /proc/1/comm)"))
67
68 ;; This test cannot possibly pass.
69 ;; It is trying to test that "which ls" returns "/bin/ls" when PATH is not set.
70 ;; However, this relies on /bin/ls existing. Which it does not in guix.
71 (delete-file "testsuite/which/which-uses-default-path")
72 (rmdir "testsuite/which")
73
74 (zero? (system* "make"
75 ;; "V=1"
76 "SKIP_KNOWN_BUGS=1"
77 "SKIP_INTERNET_TESTS=1"
78 "check"))))
79 (replace 'install
80 (lambda* (#:key outputs #:allow-other-keys)
81 (let ((out (assoc-ref outputs "out")))
82 (zero?
83 (system* "make"
84 (string-append "CONFIG_PREFIX=" out)
85 "install"))))))))
86 (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
87 ;; The following are needed by the tests.
88 ("inetutils" ,inetutils)
89 ("which" ,(@ (gnu packages base) which))
90 ("zip" ,zip)))
91 (synopsis "Many common UNIX utilities in a single executable")
92 (description "BusyBox combines tiny versions of many common UNIX utilities
93 into a single small executable. It provides a fairly complete environment for
94 any small or embedded system.")
95 (home-page "https://www.busybox.net")
96 ;; Some files are gplv2+
97 (license gpl2)))