elvis: modernize

- finalAttrs
- extra download place
- name for the patch
- --replace-fail
- use installShellFiles
- more meta info
This commit is contained in:
Anderson Torres 2024-09-14 22:24:38 -03:00
parent bd780a5040
commit 1fec673f11

View File

@ -1,49 +1,75 @@
{ fetchurl, fetchpatch, lib, stdenv, ncurses }:
{
lib,
fetchurl,
fetchpatch,
installShellFiles,
ncurses,
stdenv,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "elvis";
version = "2.2_0";
src = fetchurl {
url = "http://www.the-little-red-haired-girl.org/pub/elvis/elvis-${version}.tar.gz";
sha256 = "182fj9qzyq6cjq1r849gpam6nq9smwv9f9xwaq84961p56r6d14s";
urls = [
"http://www.the-little-red-haired-girl.org/pub/elvis/elvis-${finalAttrs.version}.tar.gz"
"http://www.the-little-red-haired-girl.org/pub/elvis/old/elvis-${finalAttrs.version}.tar.gz"
];
hash = "sha256-moRmsik3mEQQVrwnlzavOmFrqrovEZQDlsxg/3GSTqA=";
};
buildInputs = [ ncurses ];
patches = [
(fetchpatch {
name = "0000-resolve-stdio-getline-naming-conflict.patch";
url = "https://github.com/mbert/elvis/commit/076cf4ad5cc993be0c6195ec0d5d57e5ad8ac1eb.patch";
sha256 = "0yzkc1mxjwg09mfmrk20ksa0vfnb2x83ndybwvawq4xjm1qkcahc";
hash = "sha256-DCo2caiyE8zV5ss3O1AXy7oNlJ5AzFxdTeBx2Wtg83s=";
})
];
outputs = [
"out"
"man"
];
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ ncurses ];
configureFlags = [ "--ioctl=termios" ];
strictDeps = false;
postPatch = ''
substituteInPlace configure \
--replace '-lcurses' '-lncurses'
'';
preConfigure = ''
mkdir -p $out/share/man/man1
--replace-fail '-lcurses' '-lncurses'
'';
installPhase = ''
mkdir -p $out/bin $out/share/elvis $out/share/elvis/doc
cp elvis ref elvtags elvfmt $out/bin
cp -R data/* $out/share/elvis
cp doc/* $out/share/elvis/doc
runHook preInstall
mkdir -p $out/share/man/man1
for a in doc/*.man; do
cp $a $out/share/man/man1/`basename $a .man`.1
installBin elvis ref elvtags elvfmt
pushd doc
for page in *.man; do
installManPage $page
rm $page
done
'';
popd
configureFlags = [ "--ioctl=termios" ];
mkdir -p $out/share/doc/elvis-${finalAttrs.version}/ $out/share/elvis/
cp -R data/* $out/share/elvis/
cp doc/* $out/share/doc/elvis-${finalAttrs.version}/
runHook postInstall
'';
meta = {
homepage = "http://elvis.the-little-red-haired-girl.org/";
description = "Vi clone for Unix and other operating systems";
license = lib.licenses.free;
mainProgram = "elvis";
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.unix;
};
}
})