Commit | Line | Data |
---|---|---|
95faa107 | 1 | ;;; GNU Guix --- Functional package management for GNU |
2e5505e5 | 2 | ;;; Copyright © 2014 John Darrington <jmd@gnu.org> |
8f330aeb | 3 | ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il> |
a927a9e2 | 4 | ;;; Copyright © 2018–2022 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) | |
24b04f5d | 22 | #:use-module (guix gexp) |
95faa107 JD |
23 | #:use-module (guix licenses) |
24 | #:use-module (guix packages) | |
25 | #:use-module (guix download) | |
f769ad12 | 26 | #:use-module (guix utils) |
95faa107 JD |
27 | #:use-module (guix build-system gnu) |
28 | #:use-module (gnu packages) | |
29 | #:use-module (gnu packages admin) | |
42140fd4 | 30 | #:use-module (gnu packages algebra) |
148585c2 AI |
31 | #:use-module (gnu packages compression) |
32 | #:use-module (gnu packages perl)) | |
95faa107 JD |
33 | |
34 | (define-public busybox | |
35 | (package | |
36 | (name "busybox") | |
a927a9e2 | 37 | (version "1.34.1") |
95faa107 JD |
38 | (source (origin |
39 | (method url-fetch) | |
40 | (uri (string-append | |
2e5505e5 | 41 | "https://www.busybox.net/downloads/" name "-" |
95faa107 JD |
42 | version ".tar.bz2")) |
43 | (sha256 | |
44 | (base32 | |
a927a9e2 | 45 | "0jfm9fik7nv4w21zqdg830pddgkdjmplmna9yjn9ck1lwn4vsps1")))) |
95faa107 JD |
46 | (build-system gnu-build-system) |
47 | (arguments | |
6d96af5e | 48 | '(#:phases |
84d08af6 | 49 | (modify-phases %standard-phases |
c37dc30e DM |
50 | (add-before 'configure 'disable-timestamps |
51 | (lambda _ | |
a927a9e2 | 52 | (setenv "KCONFIG_NOTIMESTAMP" "1"))) |
e9ab4b40 EF |
53 | (add-before 'configure 'disable-taskset |
54 | ;; This feature fails its tests in the build environment, | |
55 | ;; was default 'n' until after 1.26.2. | |
56 | (lambda _ | |
57 | (substitute* "util-linux/taskset.c" | |
a927a9e2 | 58 | (("default y") "default n")))) |
84d08af6 | 59 | (replace 'configure |
a7eaaec8 DM |
60 | (lambda* (#:key make-flags #:allow-other-keys) |
61 | (apply invoke "make" "defconfig" make-flags))) | |
505459d7 EF |
62 | (add-after 'configure 'dont-install-to-usr |
63 | (lambda _ | |
64 | (substitute* ".config" | |
65 | (("# CONFIG_INSTALL_NO_USR is not set") | |
a927a9e2 | 66 | "CONFIG_INSTALL_NO_USR=y")))) |
84d08af6 | 67 | (replace 'check |
a7eaaec8 | 68 | (lambda* (#:key make-flags #:allow-other-keys) |
6d96af5e EF |
69 | (substitute* '("testsuite/du/du-s-works" |
70 | "testsuite/du/du-works") | |
84d08af6 | 71 | (("/bin") "/etc")) ; there is no /bin but there is a /etc |
95faa107 | 72 | |
6d96af5e EF |
73 | ;; There is no /usr/bin or /bin - replace it with /gnu/store |
74 | (substitute* "testsuite/cpio.tests" | |
84d08af6 EF |
75 | (("/usr/bin") (%store-directory)) |
76 | (("usr") (car (filter (negate string-null?) | |
6d96af5e | 77 | (string-split (%store-directory) #\/))))) |
95faa107 | 78 | |
6d96af5e | 79 | (substitute* "testsuite/date/date-works-1" |
84d08af6 | 80 | (("/bin/date") (which "date"))) |
95faa107 | 81 | |
4fdf3a2e DM |
82 | (substitute* "testsuite/start-stop-daemon.tests" |
83 | (("/bin/false") (which "false"))) | |
84 | ||
6d96af5e EF |
85 | ;; The pidof tests assume that pid 1 is called "init" but that is not |
86 | ;; true in guix build environment | |
87 | (substitute* "testsuite/pidof.tests" | |
84d08af6 | 88 | (("-s init") "-s $(cat /proc/1/comm)")) |
8f330aeb | 89 | |
6d96af5e EF |
90 | ;; This test cannot possibly pass. |
91 | ;; It is trying to test that "which ls" returns "/bin/ls" when PATH is not set. | |
92 | ;; However, this relies on /bin/ls existing. Which it does not in guix. | |
93 | (delete-file "testsuite/which/which-uses-default-path") | |
94 | (rmdir "testsuite/which") | |
95faa107 | 95 | |
a7eaaec8 | 96 | (apply invoke "make" |
f7705d4c TGR |
97 | ;; "V=1" |
98 | "SKIP_KNOWN_BUGS=1" | |
99 | "SKIP_INTERNET_TESTS=1" | |
a7eaaec8 | 100 | "check" make-flags))) |
84d08af6 | 101 | (replace 'install |
a7eaaec8 | 102 | (lambda* (#:key outputs make-flags #:allow-other-keys) |
84d08af6 | 103 | (let ((out (assoc-ref outputs "out"))) |
a7eaaec8 | 104 | (apply invoke "make" |
f7705d4c | 105 | (string-append "CONFIG_PREFIX=" out) |
a7eaaec8 | 106 | "install" make-flags))))))) |
8394619b LC |
107 | (native-inputs (list perl ; needed to generate the man pages (pod2man) |
108 | ;; The following are needed by the tests. | |
109 | inetutils | |
110 | (@ (gnu packages base) which) | |
111 | zip)) | |
95faa107 JD |
112 | (synopsis "Many common UNIX utilities in a single executable") |
113 | (description "BusyBox combines tiny versions of many common UNIX utilities | |
24753e69 JD |
114 | into a single small executable. It provides a fairly complete environment for |
115 | any small or embedded system.") | |
2e5505e5 | 116 | (home-page "https://www.busybox.net") |
95faa107 JD |
117 | ;; Some files are gplv2+ |
118 | (license gpl2))) | |
42140fd4 EF |
119 | |
120 | (define-public toybox | |
121 | (package | |
122 | (name "toybox") | |
b55d0f55 | 123 | (version "0.8.7") |
42140fd4 EF |
124 | (source (origin |
125 | (method url-fetch) | |
126 | (uri (string-append | |
127 | "https://landley.net/toybox/downloads/toybox-" | |
128 | version ".tar.gz")) | |
129 | (sha256 | |
130 | (base32 | |
b55d0f55 | 131 | "150lvp7hf9ndafvmr42kb8xi86hxjd2zj4binwwhgjw2dwrvy25m")))) |
42140fd4 EF |
132 | (build-system gnu-build-system) |
133 | (arguments | |
38787e36 TGR |
134 | (list #:make-flags |
135 | #~(list (string-append "CC=" #$(cc-for-target)) | |
136 | (string-append "HOSTCC=gcc") | |
137 | (string-append "PREFIX=" #$output)) | |
138 | #:phases | |
24b04f5d | 139 | #~(modify-phases %standard-phases |
24b04f5d | 140 | (replace 'configure |
38787e36 TGR |
141 | (lambda* (#:key make-flags #:allow-other-keys) |
142 | (apply invoke "make" "defconfig" make-flags))) | |
24b04f5d TGR |
143 | (add-before 'check 'fix-or-skip-broken-tests |
144 | (lambda _ | |
145 | ;; Some tests expect $USER to magically be the current user. | |
146 | (setenv "USER" (passwd:name (getpwnam (geteuid)))) | |
147 | ;; This expects directories to be exactly 4K. They aren't! | |
148 | (delete-file "tests/du.test") | |
149 | ;; Delete tests that expect a root or 0 user to exist. | |
150 | (substitute* "tests/id.test" | |
151 | (("^testing .*[ \\(]root.*") "")))) | |
24b04f5d TGR |
152 | (add-after 'install 'remove-usr-directory |
153 | (lambda* (#:key outputs #:allow-other-keys) | |
154 | (delete-file-recursively (string-append #$output "/usr"))))) | |
155 | #:test-target "tests")) | |
8394619b | 156 | (native-inputs (list bc)) |
42140fd4 EF |
157 | (synopsis "Many common UNIX utilities in a single executable") |
158 | (description "ToyBox combines tiny versions of many common UNIX utilities | |
159 | into a single small executable. It provides a fairly complete environment for | |
160 | any small or embedded system.") | |
161 | (home-page "https://landley.net/toybox/") | |
162 | (license bsd-2))) |