gnu: libretro-lowresnx: Update to 1.2.
[jackhill/guix/guix.git] / gnu / packages / nvi.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Marek Benc <merkur32@gmail.com>
3 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages nvi)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages autotools)
23 #:use-module (gnu packages dbm)
24 #:use-module (gnu packages ncurses)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix licenses)
29 #:use-module (guix utils))
30
31 (define-public nvi
32 (package
33 (name "nvi")
34 (version "1.81.6")
35 (source
36 (origin
37 (method url-fetch)
38 (uri ;; sites.google.coma/bostic.com/keithbostic/vi is stale.
39 (string-append "http://harrier.slackbuilds.org/misc/nvi-" version
40 ".tar.bz2"))
41 (sha256
42 (base32 "0nbbs1inyrqds0ywn3ln5slv54v5zraq7lszkg8nsavv4kivhh9l"))
43 (patches (search-patches "nvi-assume-preserve-path.patch"
44 "nvi-dbpagesize-binpower.patch"
45 "nvi-db4.patch"))
46 (modules '((guix build utils)))
47 (snippet
48 ;; Create a wrapper for the configure script, make it executable.
49 '(let ((conf-wrap (open-output-file "configure")))
50 (display "#!/bin/sh" conf-wrap)
51 (newline conf-wrap)
52 (display
53 "../nvi-1.81.6/dist/configure --srcdir=../nvi-1.81.6/dist $@"
54 conf-wrap)
55 (newline conf-wrap)
56 (close-output-port conf-wrap)
57 (chmod "configure" #o0755)
58
59 ;; Glibc 2.30 removed the deprecated <sys/stropts.h>, so fall back
60 ;; to the internal PTY allocation logic.
61 (substitute* "ex/ex_script.c"
62 (("#ifdef HAVE_SYS5_PTY")
63 "#if defined(HAVE_SYS5_PTY) && !defined(__GLIBC__)"))
64 #t))))
65
66 (build-system gnu-build-system)
67 (arguments
68 `(#:out-of-source? #t
69 #:configure-flags
70 '("--enable-widechar"
71 ,@(if (%current-target-system)
72 '("vi_cv_sprintf_count=yes")
73 '()))
74 #:phases
75 (modify-phases %standard-phases
76 (add-before 'configure 'fix-configure
77 (lambda* (#:key inputs native-inputs #:allow-other-keys)
78 ;; Replace outdated config.sub and config.guess:
79 (with-directory-excursion "dist"
80 (for-each (lambda (file)
81 (chmod file #o755)
82 (install-file
83 (string-append
84 (assoc-ref
85 (or native-inputs inputs) "automake")
86 "/share/automake-"
87 ,(version-major+minor
88 (package-version automake))
89 "/" file) "."))
90 '("config.sub")))
91 #t)))))
92 (inputs
93 `(("bdb" ,bdb)
94 ("ncurses" ,ncurses)))
95 (native-inputs
96 `(("automake" ,automake))) ;Up to date 'config.guess' and 'config.sub'.
97 (synopsis "The Berkeley Vi Editor")
98 (description
99 "Vi is the original screen based text editor for Unix systems. It is
100 considered the standard text editor, and is available on almost all Unix
101 systems. Nvi is intended as a \"bug-for-bug compatible\" clone of the
102 original BSD vi editor. As such, it doesn't have a lot of snazzy features as
103 do some of the other vi clones such as elvis and vim. However, if all you
104 want is vi, this is the one to get.")
105 (home-page "https://sites.google.com/a/bostic.com/keithbostic/vi")
106 (license bsd-3)))