| 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 (gnu packages aspell) |
| 24 | #:use-module (gnu packages check) |
| 25 | #:use-module (gnu packages compression) |
| 26 | #:use-module (gnu packages glib) |
| 27 | #:use-module (gnu packages linux) |
| 28 | #:use-module (gnu packages ncurses) |
| 29 | #:use-module (gnu packages perl) |
| 30 | #:use-module (gnu packages pkg-config) |
| 31 | #:use-module (gnu packages ssh) |
| 32 | #:use-module (gnu packages) |
| 33 | #:use-module (guix build-system gnu) |
| 34 | #:use-module (guix download) |
| 35 | #:use-module (guix licenses) |
| 36 | #:use-module (guix packages)) |
| 37 | |
| 38 | (define-public mc |
| 39 | (package |
| 40 | (name "mc") |
| 41 | (version "4.8.27") |
| 42 | (source |
| 43 | (origin |
| 44 | (method url-fetch) |
| 45 | (uri (string-append "https://ftp.osuosl.org/pub/midnightcommander/mc-" |
| 46 | version ".tar.xz")) |
| 47 | (sha256 |
| 48 | (base32 "1x2g5ahgzg951y4ldbsgkv8icni2mgh3p2wsds0j16gsbwi5kgii")))) |
| 49 | (build-system gnu-build-system) |
| 50 | (native-inputs (list perl pkg-config)) |
| 51 | (inputs (list aspell |
| 52 | check |
| 53 | glib |
| 54 | gpm |
| 55 | libssh2 |
| 56 | ncurses |
| 57 | unzip)) |
| 58 | (arguments |
| 59 | `(#:configure-flags |
| 60 | '("--with-screen=ncurses" "--enable-aspell") |
| 61 | #:phases |
| 62 | (modify-phases %standard-phases |
| 63 | (add-after 'patch-source-shebangs 'patch-FHS-file-names |
| 64 | (lambda _ |
| 65 | ;; Patch files to refer to executables in the store or $PATH. |
| 66 | (substitute* "misc/mcedit.menu.in" |
| 67 | (("#! /bin/sh") (string-append "#!" (which "sh"))) |
| 68 | (("/bin/bash") (which "bash"))) |
| 69 | (substitute* "misc/ext.d/misc.sh.in" |
| 70 | (("/bin/cat") "cat")) |
| 71 | (substitute* (list "lib/utilunix.c" |
| 72 | "src/usermenu.c" |
| 73 | "src/vfs/fish/fish.c" |
| 74 | "tests/src/vfs/extfs/helpers-list/Makefile.in") |
| 75 | (("/bin/sh") (which "sh"))) |
| 76 | (substitute* "src/filemanager/ext.c" |
| 77 | (("/bin/rm") "rm") |
| 78 | (("/bin/sh") (which "sh"))) |
| 79 | |
| 80 | ;; There are other /bin/<shell>s hard-coded in this file, but they |
| 81 | ;; are never tried after bash (mc's first choice) is found. |
| 82 | (substitute* "lib/shell.c" |
| 83 | (("/bin/bash") (which "bash"))) |
| 84 | #t)) |
| 85 | (add-before 'check 'fix-tests |
| 86 | (lambda _ |
| 87 | ;; Don't expect a UID or GID of ‘0’ in the build environment. |
| 88 | (with-directory-excursion "tests/src/vfs/extfs/helpers-list/data" |
| 89 | (substitute* (list "rpm.custom.output" |
| 90 | "rpm.glib.output") |
| 91 | ((" 0 0") "<<uid>> <<gid>>"))) |
| 92 | ;; XXX ERROR:mc_realpath.c:99:realpath_test: assertion failed |
| 93 | ;; (resolved_path == data->expected_string): ("" == "/usr/bin") |
| 94 | (substitute* "tests/lib/mc_realpath.c" |
| 95 | (("/usr/bin") "/") |
| 96 | (("usr/bin") "/")) |
| 97 | #t))))) |
| 98 | (home-page "https://www.midnight-commander.org") |
| 99 | (properties |
| 100 | `((release-monitoring-url . "https://ftp.osuosl.org/pub/midnightcommander/"))) |
| 101 | (synopsis "Graphical file manager") |
| 102 | (description |
| 103 | "GNU Midnight Commander is a command-line file manager laid out in a |
| 104 | common two-pane format. In addition to standard file management tasks such as |
| 105 | copying and moving, Midnight Commander also supports viewing the contents of |
| 106 | RPM package files and other archives and managing files on other computers via |
| 107 | FTP or FISH. It also includes a powerful text editor for opening text |
| 108 | files.") |
| 109 | (license gpl3+))) |