gnu: emacs-svg-icon: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / mc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
5 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages mc)
23 #:use-module (guix packages)
24 #:use-module (guix licenses)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages aspell)
29 #:use-module (gnu packages ncurses)
30 #:use-module (gnu packages glib)
31 #:use-module (gnu packages ssh)
32 #:use-module (gnu packages pkg-config)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages compression))
36
37 (define-public mc
38 (package
39 (name "mc")
40 (version "4.8.26")
41 (source
42 (origin
43 (method url-fetch)
44 (uri (string-append "https://ftp.midnight-commander.org/mc-"
45 version ".tar.xz"))
46 (sha256
47 (base32 "09vc2vf6k12a8k5gdss6hcskwfcbyalrkhn65nidkwlm0p2svpn6"))))
48 (build-system gnu-build-system)
49 (native-inputs `(("pkg-config" ,pkg-config)
50 ("perl" ,perl)))
51 (inputs `(("aspell" ,aspell)
52 ("ncurses" ,ncurses)
53 ("libssh2" ,libssh2)
54 ("glib" ,glib)
55 ("check" ,check)
56 ("unzip" ,unzip)))
57 (arguments
58 `(#:configure-flags
59 '("--with-screen=ncurses" "--enable-aspell")
60 #:phases
61 (modify-phases %standard-phases
62 (add-after 'patch-source-shebangs 'patch-FHS-file-names
63 (lambda _
64 ;; Patch files to refer to executables in the store or $PATH.
65 (substitute* "misc/mcedit.menu.in"
66 (("#! /bin/sh") (string-append "#!" (which "sh")))
67 (("/bin/bash") (which "bash")))
68 (substitute* "misc/ext.d/misc.sh.in"
69 (("/bin/cat") "cat"))
70 (substitute* (list "lib/utilunix.c"
71 "src/usermenu.c"
72 "src/vfs/fish/fish.c"
73 "tests/src/vfs/extfs/helpers-list/Makefile.in")
74 (("/bin/sh") (which "sh")))
75 (substitute* "src/filemanager/ext.c"
76 (("/bin/rm") "rm")
77 (("/bin/sh") (which "sh")))
78
79 ;; There are other /bin/<shell>s hard-coded in this file, but they
80 ;; are never tried after bash (mc's first choice) is found.
81 (substitute* "lib/shell.c"
82 (("/bin/bash") (which "bash")))
83 #t))
84 (add-before 'check 'fix-tests
85 (lambda _
86 ;; Don't expect a UID or GID of ‘0’ in the build environment.
87 (with-directory-excursion "tests/src/vfs/extfs/helpers-list/data"
88 (substitute* (list "rpm.custom.output"
89 "rpm.glib.output")
90 ((" 0 0") "<<uid>> <<gid>>")))
91 ;; XXX ERROR:mc_realpath.c:99:realpath_test: assertion failed
92 ;; (resolved_path == data->expected_string): ("" == "/usr/bin")
93 (substitute* "tests/lib/mc_realpath.c"
94 (("/usr/bin") "/")
95 (("usr/bin") "/"))
96 #t)))))
97 (home-page "https://www.midnight-commander.org")
98 (synopsis "Graphical file manager")
99 (description
100 "GNU Midnight Commander is a command-line file manager laid out in a
101 common two-pane format. In addition to standard file management tasks such as
102 copying and moving, Midnight Commander also supports viewing the contents of
103 RPM package files and other archives and managing files on other computers via
104 FTP or FISH. It also includes a powerful text editor for opening text
105 files.")
106 (license gpl3+)))