gnu: deutex: Update to 5.2.1.
[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>
51e31aa8 4;;; Copyright © 2018, 2019 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")
56c18075 35 (version "1.29.3")
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
56c18075 43 "1dzg45vgy2w1xcd3p6h8d76ykhabbvk1h0lf8yb24ikrwlv8cr4p"))))
95faa107
JD
44 (build-system gnu-build-system)
45 (arguments
6d96af5e 46 '(#:phases
84d08af6 47 (modify-phases %standard-phases
e9ab4b40
EF
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))
84d08af6 55 (replace 'configure
f7705d4c 56 (lambda _ (invoke "make" "defconfig")))
505459d7
EF
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))
84d08af6
EF
63 (replace 'check
64 (lambda _
6d96af5e
EF
65 (substitute* '("testsuite/du/du-s-works"
66 "testsuite/du/du-works")
84d08af6 67 (("/bin") "/etc")) ; there is no /bin but there is a /etc
95faa107 68
6d96af5e
EF
69 ;; There is no /usr/bin or /bin - replace it with /gnu/store
70 (substitute* "testsuite/cpio.tests"
84d08af6
EF
71 (("/usr/bin") (%store-directory))
72 (("usr") (car (filter (negate string-null?)
6d96af5e 73 (string-split (%store-directory) #\/)))))
95faa107 74
6d96af5e 75 (substitute* "testsuite/date/date-works-1"
84d08af6 76 (("/bin/date") (which "date")))
95faa107 77
6d96af5e
EF
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"
84d08af6 81 (("-s init") "-s $(cat /proc/1/comm)"))
6d96af5e
EF
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")
95faa107 88
f7705d4c
TGR
89 (invoke "make"
90 ;; "V=1"
91 "SKIP_KNOWN_BUGS=1"
92 "SKIP_INTERNET_TESTS=1"
93 "check")))
84d08af6
EF
94 (replace 'install
95 (lambda* (#:key outputs #:allow-other-keys)
96 (let ((out (assoc-ref outputs "out")))
f7705d4c
TGR
97 (invoke "make"
98 (string-append "CONFIG_PREFIX=" out)
99 "install")))))))
95faa107
JD
100 (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
101 ;; The following are needed by the tests.
102 ("inetutils" ,inetutils)
2e5505e5 103 ("which" ,(@ (gnu packages base) which))
95faa107
JD
104 ("zip" ,zip)))
105 (synopsis "Many common UNIX utilities in a single executable")
106 (description "BusyBox combines tiny versions of many common UNIX utilities
24753e69
JD
107into a single small executable. It provides a fairly complete environment for
108any small or embedded system.")
2e5505e5 109 (home-page "https://www.busybox.net")
95faa107
JD
110 ;; Some files are gplv2+
111 (license gpl2)))
42140fd4
EF
112
113(define-public toybox
114 (package
115 (name "toybox")
111f7c01 116 (version "0.8.2")
42140fd4
EF
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
111f7c01 124 "1mgya8zxgf30i5w3rhsb3n70kwlhifxbajh6wqdsz6rf8kx609ws"))))
42140fd4
EF
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)
ee0b4733
EF
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))))
42140fd4
EF
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
151into a single small executable. It provides a fairly complete environment for
152any small or embedded system.")
153 (home-page "https://landley.net/toybox/")
154 (license bsd-2)))