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>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
32 (define-public busybox
39 "https://www.busybox.net/downloads/" name "-"
43 "1dzg45vgy2w1xcd3p6h8d76ykhabbvk1h0lf8yb24ikrwlv8cr4p"))))
44 (build-system gnu-build-system)
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.
52 (substitute* "util-linux/taskset.c"
53 (("default y") "default n"))
56 (lambda _ (invoke "make" "defconfig")))
57 (add-after 'configure 'dont-install-to-usr
59 (substitute* ".config"
60 (("# CONFIG_INSTALL_NO_USR is not set")
61 "CONFIG_INSTALL_NO_USR=y"))
65 (substitute* '("testsuite/du/du-s-works"
66 "testsuite/du/du-works")
67 (("/bin") "/etc")) ; there is no /bin but there is a /etc
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) #\/)))))
75 (substitute* "testsuite/date/date-works-1"
76 (("/bin/date") (which "date")))
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)"))
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")
92 "SKIP_INTERNET_TESTS=1"
95 (lambda* (#:key outputs #:allow-other-keys)
96 (let ((out (assoc-ref outputs "out")))
98 (string-append "CONFIG_PREFIX=" out)
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))
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+
113 (define-public toybox
120 "https://landley.net/toybox/downloads/toybox-"
124 "1mgya8zxgf30i5w3rhsb3n70kwlhifxbajh6wqdsz6rf8kx609ws"))))
125 (build-system gnu-build-system)
128 (modify-phases %standard-phases
129 (add-before 'configure 'set-environment-variables
131 (setenv "CC" (which "gcc"))
132 (setenv "HOSTCC" (which "gcc"))
135 (lambda _ (invoke "make" "defconfig")))
137 (lambda* (#:key outputs #:allow-other-keys)
138 (let ((out (assoc-ref outputs "out")))
140 (string-append "PREFIX=" out)
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"))
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/")