Skip to content

Porting

Zhihao Yuan edited this page Jan 23, 2023 · 5 revisions

Porting Instructions

Background

Nvi2 is a POSIX-compatible Vi implementation written for the modern BSDs, including FreeBSD, NetBSD, OpenBSD, DragonFly BSD, and other OSs based on them. The main goal of the project is to replace the old nvi-1.79 or nvi-1.81.6 in their base systems. Since Mac OS X already choose vim-lite as its vi implementation, some parts in this article may not apply to that platform.

Requirements

  • CMake >= 3.9;
  • POSIX.1-2008-compatible libc;
  • libiconv (for USE_ICONV);
  • libncursesw (for USE_WIDECHAR);
  • libutil;
  • uudecode(1) with -m option (Base64);
  • Anything required by a minimal nvi-1.79, notably:
    • Berkeley DB1 in libc;
    • /var/tmp/vi.recover/ with mode 41777.

Building

Program
Run cmake -B build -DCMAKE_BUILD_TYPE=Release under the source tree, followed by ccmake build/ to confirm all the options and libraries. Upon success, build the nvi binary with make -C build/.
Catalog
cd to the catalog/ directory under the source tree, run make.

Installation

Program
Install build/nvi to /usr/bin/, and point the symbol links, nex nview vi ex and view to it.
Manpage
Install man/vi.1 to /usr/share/man/man1, and point the symbol links nvi.1 nex.1 nview.1 ex.1 and view.1 to it.
Catalog
Install the files, dutch english french german polish ru_RU.KOI8-R spanish swedish tr_TR.ISO8859-9 tr_TR.UTF-8 uk_UA.KOI8-U zh_CN.GB2312, under the catalog/ directory to /usr/share/vi/catalog/, and create sufficient symbol links with the POSIX locale(1) names and point them to the corresponding catalog files. For example, en_US.ISO8859-1 -> english, zh_CN.GBK -> zh_CN.GB2312.
Recovery script
build/recover shows the basic logic of sending the recovery notification emails to the users. A system-wide rc.d script, /etc/rc.d/virecover, for example, need to be prepared. Note that the recovery files start to use the new X-vi-data: header, in the form of X-vi-data: <file|path>;<MIME folding base64 sequence>, since nvi-2.1.0, so the logic in the old rc.d scripts need to be changed.

Afterword

Ask me if you have any questions. I'm a BSD guy.

Author: Zhihao Yuan
Email: [email protected]
Clone this wiki locally