Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchpatch, 5 fetchurl, 6 updateAutotoolsGnuConfigScriptsHook, 7 ncurses, 8 termcap, 9 curses-library ? if stdenv.hostPlatform.isWindows then termcap else ncurses, 10}: 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "readline"; 14 version = "8.3p${toString (builtins.length finalAttrs.upstreamPatches)}"; 15 16 src = fetchurl { 17 url = "mirror://gnu/readline/readline-${finalAttrs.meta.branch}.tar.gz"; 18 hash = "sha256-/lODIERngozUle6NHTwDen66E4nCK8agQfYnl2+QYcw="; 19 }; 20 21 outputs = [ 22 "out" 23 "dev" 24 "man" 25 "doc" 26 "info" 27 ]; 28 29 strictDeps = true; 30 propagatedBuildInputs = [ curses-library ]; 31 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; 32 33 patchFlags = [ "-p0" ]; 34 35 upstreamPatches = ( 36 let 37 patch = 38 nr: sha256: 39 fetchurl { 40 url = "mirror://gnu/readline/readline-${finalAttrs.meta.branch}-patches/readline83-${nr}"; 41 inherit sha256; 42 }; 43 in 44 import ./readline-8.3-patches.nix patch 45 ); 46 47 patches = 48 lib.optionals (curses-library.pname == "ncurses") [ 49 ./link-against-ncurses.patch 50 ] 51 ++ [ 52 ./no-arch_only-8.2.patch 53 ] 54 ++ finalAttrs.upstreamPatches 55 ++ lib.optionals stdenv.hostPlatform.isWindows [ 56 (fetchpatch { 57 name = "0001-sigwinch.patch"; 58 url = "https://github.com/msys2/MINGW-packages/raw/90e7536e3b9c3af55c336d929cfcc32468b2f135/mingw-w64-readline/0001-sigwinch.patch"; 59 stripLen = 1; 60 hash = "sha256-sFK6EJrSNl0KLWqFv5zBXaQRuiQoYIZVoZfa8BZqfKA="; 61 }) 62 (fetchpatch { 63 name = "0002-event-hook.patch"; 64 url = "https://github.com/msys2/MINGW-packages/raw/3476319d2751a676b911f3de9e1ec675081c03b8/mingw-w64-readline/0002-event-hook.patch"; 65 stripLen = 1; 66 hash = "sha256-F8ytYuIjBtH83ZCJdf622qjwSw+wZEVyu53E/mPsoAo="; 67 }) 68 (fetchpatch { 69 name = "0003-fd_set.patch"; 70 url = "https://github.com/msys2/MINGW-packages/raw/35830ab27e5ed35c2a8d486961ab607109f5af50/mingw-w64-readline/0003-fd_set.patch"; 71 stripLen = 1; 72 hash = "sha256-UiaXZRPjKecpSaflBMCphI2kqOlcz1JkymlCrtpMng4="; 73 }) 74 (fetchpatch { 75 name = "0004-locale.patch"; 76 url = "https://github.com/msys2/MINGW-packages/raw/f768c4b74708bb397a77e3374cc1e9e6ef647f20/mingw-w64-readline/0004-locale.patch"; 77 stripLen = 1; 78 hash = "sha256-dk4343KP4EWXdRRCs8GRQlBgJFgu1rd79RfjwFD/nJc="; 79 }) 80 ]; 81 82 # Make mingw-w64 provide a dummy alarm() function 83 # 84 # Method borrowed from 85 # https://github.com/msys2/MINGW-packages/commit/35830ab27e5ed35c2a8d486961ab607109f5af50 86 CFLAGS = lib.optionalString stdenv.hostPlatform.isMinGW "-D__USE_MINGW_ALARM -D_POSIX"; 87 88 # This install error is caused by a very old libtool. We can't autoreconfHook this package, 89 # so this is the best we've got! 90 postInstall = lib.optionalString stdenv.hostPlatform.isOpenBSD '' 91 ln -s $out/lib/libhistory.so* $out/lib/libhistory.so 92 ln -s $out/lib/libreadline.so* $out/lib/libreadline.so 93 ''; 94 95 meta = with lib; { 96 description = "Library for interactive line editing"; 97 98 longDescription = '' 99 The GNU Readline library provides a set of functions for use by 100 applications that allow users to edit command lines as they are 101 typed in. Both Emacs and vi editing modes are available. The 102 Readline library includes additional functions to maintain a 103 list of previously-entered command lines, to recall and perhaps 104 reedit those lines, and perform csh-like history expansion on 105 previous commands. 106 107 The history facilities are also placed into a separate library, 108 the History library, as part of the build process. The History 109 library may be used without Readline in applications which 110 desire its capabilities. 111 ''; 112 113 homepage = "https://savannah.gnu.org/projects/readline/"; 114 115 license = licenses.gpl3Plus; 116 117 maintainers = with maintainers; [ dtzWill ]; 118 119 platforms = platforms.unix ++ platforms.windows; 120 branch = "8.3"; 121 }; 122})