2022-05-29 19:00:49 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, pcre
|
|
|
|
, uthash
|
|
|
|
, lua5_4
|
|
|
|
, makeWrapper
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2019-09-17 15:33:10 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mle";
|
2022-05-29 19:00:49 +02:00
|
|
|
version = "1.5.0";
|
2019-09-17 15:33:10 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "adsr";
|
|
|
|
repo = "mle";
|
|
|
|
rev = "v${version}";
|
2022-05-29 19:00:49 +02:00
|
|
|
sha256 = "1nhd00lsx9v12zdmps92magz76c2d8zzln3lxvzl4ng73gbvq3n0";
|
2019-09-17 15:33:10 +02:00
|
|
|
};
|
|
|
|
|
2022-05-29 19:00:49 +02:00
|
|
|
# Bug fixes found after v1.5.0 release
|
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "skip_locale_dep_test.patch";
|
|
|
|
url = "https://github.com/adsr/mle/commit/e4dc4314b02a324701d9ae9873461d34cce041e5.patch";
|
|
|
|
sha256 = "sha256-j3Z/n+2LqB9vEkWzvRVSOrF6yE+hk6f0dvEsTQ74erw=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix_input_trail.patch";
|
|
|
|
url = "https://github.com/adsr/mle/commit/bc05ec0eee4143d824010c6688fce526550ed508.patch";
|
|
|
|
sha256 = "sha256-dM63EBDQfHLAqGZk3C5NtNAv23nCTxXVW8XpLkAeEyQ=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
# Fix location of Lua 5.4 header and library
|
2019-09-17 15:33:10 +02:00
|
|
|
postPatch = ''
|
2022-05-29 19:00:49 +02:00
|
|
|
substituteInPlace Makefile --replace "-llua5.4" "-llua";
|
|
|
|
substituteInPlace mle.h --replace "<lua5.4/" "<";
|
2019-11-16 17:23:06 +01:00
|
|
|
patchShebangs tests/*
|
2019-09-17 15:33:10 +02:00
|
|
|
'';
|
|
|
|
|
2022-05-29 19:00:49 +02:00
|
|
|
# Use select(2) instead of poll(2) (poll is returning POLLINVAL on macOS)
|
|
|
|
# Enable compiler optimization
|
|
|
|
CFLAGS = "-DTB_OPT_SELECT -O2";
|
|
|
|
|
2022-04-18 15:33:51 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
|
|
|
|
2022-05-29 19:00:49 +02:00
|
|
|
buildInputs = [ pcre uthash lua5_4 ];
|
2019-09-17 15:33:10 +02:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
installFlags = [ "prefix=${placeholder "out"}" ];
|
|
|
|
|
2022-04-18 15:33:51 +02:00
|
|
|
postInstall = ''
|
|
|
|
installManPage mle.1
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2022-05-29 19:00:49 +02:00
|
|
|
description = "Small, flexible, terminal-based text editor";
|
2019-09-17 15:33:10 +02:00
|
|
|
homepage = "https://github.com/adsr/mle";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ adsr ];
|
|
|
|
};
|
|
|
|
}
|