btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / li / libedit / package.nix
blob90d69aa6db2095245387aca3fd2a9c601dd3a288
1 { lib
2 , stdenv
3 , fetchurl
4 , ncurses
5 }:
7 stdenv.mkDerivation (finalAttrs: {
8   pname = "libedit";
9   version = "20240808-3.1";
11   src = fetchurl {
12     url = "https://thrysoee.dk/editline/libedit-${finalAttrs.version}.tar.gz";
13     hash = "sha256-XwVzNJ13xKSJZxkc3WY03Xql9jmMalf+A3zAJpbWCZ8=";
14   };
16   outputs = [ "out" "dev" "man" ];
18   patches = [
19     ./01-cygwin.patch
20   ];
22   propagatedBuildInputs = [
23     ncurses
24   ];
26   # GCC automatically include `stdc-predefs.h` while Clang does not do this by
27   # default. While Musl is ISO 10646 compliant, it does not define
28   # __STDC_ISO_10646__.
29   # This definition is in `stdc-predefs.h` -- that's why libedit builds just
30   # fine with GCC and Musl.
31   # There is a DR to fix this issue with Clang which is not merged yet.
32   # https://reviews.llvm.org/D137043
33   env.NIX_CFLAGS_COMPILE =
34     lib.optionalString (stdenv.targetPlatform.isMusl && stdenv.cc.isClang)
35       "-D__STDC_ISO_10646__=201103L";
37   postFixup = ''
38     find $out/lib -type f | \
39       grep '\.\(la\|pc\)''$' | \
40       xargs sed -i -e 's,-lncurses[a-z]*,-L${ncurses.out}/lib -lncursesw,g'
41   '';
43   meta = {
44     homepage = "http://www.thrysoee.dk/editline/";
45     changelog = "https://www.thrysoee.dk/editline/#changelog";
46     description = "Port of the NetBSD Editline library (libedit)";
47     longDescription = ''
48        This is an autotool- and libtoolized port of the NetBSD Editline library
49        (libedit). This Berkeley-style licensed command line editor library
50        provides generic line editing, history, and tokenization functions,
51        similar to those found in GNU Readline.
52     '';
53     license = with lib.licenses; [ bsd3 ];
54     maintainers = with lib.maintainers; [ AndersonTorres ];
55     platforms = lib.platforms.all;
56   };