gnu: r-fields: Update to 11.4.
[jackhill/guix/guix.git] / gnu / packages / busybox.scm
index 4cdea3a..0a93c64 100644 (file)
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
-;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages perl))
 
 (define-public busybox
   (package
     (name "busybox")
-    (version "1.26.2")
+    (version "1.31.1")
     (source (origin
               (method url-fetch)
               (uri (string-append
                     version ".tar.bz2"))
               (sha256
                (base32
-                "05mg6rh5smkzfwqfcazkpwy6h6555llsazikqnvwkaf17y8l8gns"))))
+                "1659aabzp8w4hayr4z8kcpbk2z1q2wqhw7i1yb0l72b45ykl1yfh"))
+              (patches
+               (search-patches
+                "busybox-1.31.1-fix-build-with-glibc-2.31.patch"))))
     (build-system gnu-build-system)
     (arguments
      '(#:phases
        (modify-phases %standard-phases
+         (add-before 'configure 'disable-timestamps
+           (lambda _
+             (setenv "KCONFIG_NOTIMESTAMP" "1")
+             #t))
+         (add-before 'configure 'disable-taskset
+           ;; This feature fails its tests in the build environment,
+           ;; was default 'n' until after 1.26.2.
+           (lambda _
+             (substitute* "util-linux/taskset.c"
+               (("default y") "default n"))
+             #t))
          (replace 'configure
-           (lambda _ (invoke "make" "defconfig")))
-         (replace 'check
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (apply invoke "make" "defconfig" make-flags)))
+         (add-after 'configure 'dont-install-to-usr
            (lambda _
+             (substitute* ".config"
+               (("# CONFIG_INSTALL_NO_USR is not set")
+                "CONFIG_INSTALL_NO_USR=y"))
+             #t))
+         (replace 'check
+           (lambda* (#:key make-flags #:allow-other-keys)
              (substitute* '("testsuite/du/du-s-works"
                             "testsuite/du/du-works")
                (("/bin") "/etc"))  ; there is no /bin but there is a /etc
@@ -61,6 +83,9 @@
              (substitute* "testsuite/date/date-works-1"
                (("/bin/date") (which "date")))
 
+             (substitute* "testsuite/start-stop-daemon.tests"
+              (("/bin/false") (which "false")))
+
              ;; The pidof tests assume that pid 1 is called "init" but that is not
              ;; true in guix build environment
              (substitute* "testsuite/pidof.tests"
              (delete-file "testsuite/which/which-uses-default-path")
              (rmdir "testsuite/which")
 
-             (invoke "make"
+             (apply invoke "make"
                      ;; "V=1"
                      "SKIP_KNOWN_BUGS=1"
                      "SKIP_INTERNET_TESTS=1"
-                     "check")))
+                     "check" make-flags)))
          (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key outputs make-flags #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
-               (invoke "make"
+               (apply invoke "make"
                        (string-append "CONFIG_PREFIX=" out)
-                       "install")))))))
+                       "install" make-flags)))))))
     (native-inputs `(("perl" ,perl) ; needed to generate the man pages (pod2man)
                      ;; The following are needed by the tests.
                      ("inetutils" ,inetutils)
@@ -95,3 +120,46 @@ any small or embedded system.")
     (home-page "https://www.busybox.net")
     ;; Some files are gplv2+
     (license gpl2)))
+
+(define-public toybox
+  (package
+    (name "toybox")
+    (version "0.8.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://landley.net/toybox/downloads/toybox-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "00aw9d809wj1bqlb2fsssdgz7rj0363ya14py0gfdm0rkp98zcpa"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'set-environment-variables
+           (lambda _
+             (setenv "CC" (which "gcc"))
+             (setenv "HOSTCC" (which "gcc"))
+             #t))
+         (replace 'configure
+           (lambda _ (invoke "make" "defconfig")))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (invoke "make"
+                       (string-append "PREFIX=" out)
+                       "install"))))
+         (add-after 'install 'remove-usr-directory
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (delete-file-recursively (string-append out "/usr"))
+               #t))))
+       #:test-target "tests"))
+    (native-inputs `(("bc" ,bc)))
+    (synopsis "Many common UNIX utilities in a single executable")
+    (description "ToyBox combines tiny versions of many common UNIX utilities
+into a single small executable.  It provides a fairly complete environment for
+any small or embedded system.")
+    (home-page "https://landley.net/toybox/")
+    (license bsd-2)))