gnu: e2fsprogs: Install the libext2fs Info manual.
[jackhill/guix/guix.git] / gnu / packages / linux.scm
index e1668b1..72b445f 100644 (file)
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
+;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (gnu packages attr)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages texinfo)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
-  #:use-module (guix build-system python))
+  #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial))
 
 (define-public (system->linux-architecture arch)
   "Return the Linux architecture name for ARCH, a Guix system name such as
     (license gpl2+)))
 
 (define-public linux-libre
-  (let* ((version "3.13")
+  (let* ((version "3.13.7")
          (build-phase
           '(lambda* (#:key system #:allow-other-keys #:rest args)
              (let ((arch (car (string-split system #\-))))
              (let ((build (assoc-ref %standard-phases 'build)))
                (and (zero? (system* "make" "defconfig"))
                     (begin
-                      (format #t "enabling additional modules...~%")
-                      (substitute* ".config"
-                        (("^# CONFIG_CIFS.*$")
-                         "CONFIG_CIFS=m\n")
-                        (("^# CONFIG_([[:graph:]]*)VIRTIO([[:graph:]]*) .*$"
-                          _ before after)
-                         (string-append "CONFIG_" before "VIRTIO"
-                                        after "=m\n")))
-
-                      ;; XXX: For some reason, some virtio modules need to be
-                      ;; explicitly added.
+                      ;; Appending works even when the option wasn't in the
+                      ;; file.  The last one prevails if duplicated.
                       (let ((port (open-file ".config" "a")))
-                        (display (string-append "CONFIG_NET_9P_VIRTIO=m\n"
-                                                "CONFIG_NET_9P=m\n"
-                                                "CONFIG_9P_FS=m\n"
-                                                "CONFIG_VIRTIO_NET=m\n"
+                        (display (string-append "CONFIG_NET_9P=m\n"
+                                                "CONFIG_NET_9P_VIRTIO=m\n"
                                                 "CONFIG_VIRTIO_BLK=m\n"
-                                                "CONFIG_VIRTIO_BALLOON=m\n")
+                                                "CONFIG_SATA_SIS=y\n"
+                                                "CONFIG_VIRTIO_NET=m\n"
+                                                "CONFIG_SIS190=y\n"
+                                                ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
+                                                "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
+                                                "CONFIG_VIRTIO_PCI=m\n"
+                                                "CONFIG_VIRTIO_BALLOON=m\n"
+                                                "CONFIG_VIRTIO_MMIO=m\n"
+                                                "CONFIG_FUSE_FS=m\n"
+                                                "CONFIG_CIFS=m\n"
+                                                "CONFIG_9P_FS=m\n")
                                  port)
                         (close-port port))
 
              (uri (linux-libre-urls version))
              (sha256
               (base32
-               "15pdizzxnnvpxmdb1lbi01kpingmdvj17b01vzbyjymi4vwfws3f"))))
+               "0j28dg0zq4vlbk4ady4fq021i8dxx2h8h90n26mzigr9hky86n8d"))))
     (build-system gnu-build-system)
     (native-inputs `(("perl" ,perl)
                      ("bc" ,bc)
@@ -324,7 +326,8 @@ providing the system administrator with some help in common tasks.")
         "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:configure-flags '("--disable-use-tty-group")
+     `(#:configure-flags '("--disable-use-tty-group"
+                           "--enable-ddate")
        #:phases (alist-cons-after
                  'install 'patch-chkdupexe
                  (lambda* (#:key outputs #:allow-other-keys)
@@ -439,7 +442,8 @@ slabtop, and skill.")
                "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
     (build-system gnu-build-system)
     (inputs `(("util-linux" ,util-linux)))
-    (native-inputs `(("pkg-config" ,pkg-config)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("texinfo" ,texinfo)))    ; for the libext2fs Info manual
     (arguments
      '(#:phases (alist-cons-before
                  'configure 'patch-shells
@@ -465,6 +469,39 @@ slabtop, and skill.")
                    lgpl2.0                        ; libext2fs
                    x11))))                        ; libuuid
 
+(define-public e2fsck/static
+  (package
+    (name "e2fsck-static")
+    (version (package-version e2fsprogs))
+    (build-system trivial-build-system)
+    (source #f)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (ice-9 ftw)
+                      (srfi srfi-26))
+
+         (let ((source (string-append (assoc-ref %build-inputs "e2fsprogs")
+                                      "/sbin"))
+               (bin    (string-append (assoc-ref %outputs "out") "/sbin")))
+           (mkdir-p bin)
+           (with-directory-excursion bin
+             (for-each (lambda (file)
+                         (copy-file (string-append source "/" file)
+                                    file)
+                         (remove-store-references file)
+                         (chmod file #o555))
+                       (scandir source (cut string-prefix? "fsck." <>))))))))
+    (inputs `(("e2fsprogs" ,(static-package e2fsprogs))))
+    (synopsis "Statically-linked fsck.* commands from e2fsprogs")
+    (description
+     "This package provides statically-linked command of fsck.ext[234] taken
+from the e2fsprogs package.  It is meant to be used in initrds.")
+    (home-page (package-home-page e2fsprogs))
+    (license (package-license e2fsprogs))))
+
 (define-public strace
   (package
     (name "strace")
@@ -688,9 +725,11 @@ manpages.")
        #:parallel-build? #f
 
        #:tests? #f                                ; no test suite
-       #:make-flags (list "CC=gcc"
-                          (string-append "BASEDIR="
-                                         (assoc-ref %outputs "out")))))
+       #:make-flags (let ((out (assoc-ref %outputs "out")))
+                      (list "CC=gcc"
+                            (string-append "BASEDIR=" out)
+                            (string-append "INSTALLNLSDIR=" out "/share/locale")
+                            (string-append "mandir=/share/man")))))
 
     ;; Use the big Debian patch set (the thing does not even compile out of
     ;; the box.)
@@ -899,7 +938,7 @@ processes currently causing I/O.")
                (base32
                 "071r6xjgssy8vwdn6m28qq1bqxsd2bphcd2mzhq0grf5ybm87sqb"))))
     (build-system gnu-build-system)
-    (native-inputs `(("util-linux" ,util-linux)))
+    (inputs `(("util-linux" ,util-linux)))
     (arguments
      '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
                                               (assoc-ref %outputs "out")
@@ -909,7 +948,20 @@ processes currently causing I/O.")
                                               "/etc/init.d")
                                (string-append "UDEV_RULES_PATH="
                                               (assoc-ref %outputs "out")
-                                              "/etc/udev"))))
+                                              "/etc/udev"))
+      #:phases (alist-cons-before
+                'build 'set-file-names
+                (lambda* (#:key inputs #:allow-other-keys)
+                  ;; libfuse calls out to mount(8) and umount(8).  Make sure
+                  ;; it refers to the right ones.
+                  (substitute* '("lib/mount_util.c" "util/mount_util.c")
+                    (("/bin/(u?)mount" _ maybe-u)
+                     (string-append (assoc-ref inputs "util-linux")
+                                    "/bin/" maybe-u "mount")))
+                  (substitute* '("util/mount.fuse.c")
+                    (("/bin/sh")
+                     (which "sh"))))
+                %standard-phases)))
     (home-page "http://fuse.sourceforge.net/")
     (synopsis "Support file systems implemented in user space")
     (description
@@ -945,3 +997,37 @@ space, using the FUSE library.  Mounting a union file system allows you to
 \"aggregate\" the contents of several directories into a single mount point.
 UnionFS-FUSE additionally supports copy-on-write.")
     (license bsd-3)))
+
+(define fuse-static
+  (package (inherit fuse)
+    (name "fuse-static")
+    (source (origin (inherit (package-source fuse))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Normally libfuse invokes mount(8) so that /etc/mtab is
+               ;; updated.  Change calls to 'mtab_needs_update' to 0 so that
+               ;; it doesn't do that, allowing us to remove the dependency on
+               ;; util-linux (something that is useful in initrds.)
+               '(substitute* '("lib/mount_util.c"
+                               "util/mount_util.c")
+                  (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
+                   "0")
+                  (("/bin/")
+                   "")))))))
+
+(define-public unionfs-fuse/static
+  (package (inherit unionfs-fuse)
+    (synopsis "User-space union file system (statically linked)")
+    (name (string-append (package-name unionfs-fuse) "-static"))
+    (source (origin (inherit (package-source unionfs-fuse))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Add -ldl to the libraries, because libfuse.a needs that.
+               '(substitute* "src/CMakeLists.txt"
+                  (("target_link_libraries(.*)\\)" _ libs)
+                   (string-append "target_link_libraries"
+                                  libs " dl)"))))))
+    (arguments
+     '(#:tests? #f
+       #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")))
+    (inputs `(("fuse" ,fuse-static)))))