Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, fetchurl, stdenv, slang, popt, python }:
2
3let
4 pythonIncludePath = "${lib.getDev python}/include/python";
5in
6stdenv.mkDerivation rec {
7 pname = "newt";
8 version = "0.52.23";
9
10 src = fetchurl {
11 url = "https://releases.pagure.org/${pname}/${pname}-${version}.tar.gz";
12 sha256 = "sha256-yqNykHsU7Oz+KY8NUSpi9B0zspBhAkSliu0Hu8WtoSo=";
13 };
14
15 postPatch = ''
16 sed -i -e s,/usr/bin/install,install, -e s,-I/usr/include/slang,, Makefile.in po/Makefile
17
18 substituteInPlace configure \
19 --replace "/usr/include/python" "${pythonIncludePath}"
20 substituteInPlace configure.ac \
21 --replace "/usr/include/python" "${pythonIncludePath}"
22
23 substituteInPlace Makefile.in \
24 --replace "ar rv" "${stdenv.cc.targetPrefix}ar rv"
25 '';
26
27 strictDeps = true;
28 nativeBuildInputs = [ python ];
29 buildInputs = [ slang popt ];
30
31 NIX_LDFLAGS = "-lncurses";
32
33 preConfigure = ''
34 # If CPP is set explicitly, configure and make will not agree about which
35 # programs to use at different stages.
36 unset CPP
37 '';
38
39 configureFlags = lib.optionals stdenv.isDarwin [
40 "--disable-nls"
41 ];
42
43 makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
44 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
45 ];
46
47 postFixup = lib.optionalString stdenv.isDarwin ''
48 install_name_tool -id $out/lib/libnewt.so.${version} $out/lib/libnewt.so.${version}
49 install_name_tool -change libnewt.so.${version} $out/lib/libnewt.so.${version} $out/bin/whiptail
50 '';
51
52 meta = with lib; {
53 homepage = "https://pagure.io/newt";
54 description = "Library for color text mode, widget based user interfaces";
55
56 license = licenses.lgpl2;
57 platforms = platforms.unix;
58 maintainers = [ maintainers.viric ];
59 };
60}