1{lib, stdenv, fetchurl, pkg-config, glib, ncurses, gpm}:
2stdenv.mkDerivation rec {
3 pname = "libviper";
4 version = "1.4.6";
5
6 src = fetchurl {
7 url = "mirror://sourceforge/libviper/libviper-${version}.tar.gz";
8 sha256 = "1jvm7wdgw6ixyhl0pcfr9lnr9g6sg6whyrs9ihjiz0agvqrgvxwc";
9 };
10
11 postPatch = ''
12 sed -i -e s@/usr/local@$out@ -e /ldconfig/d -e '/cd vdk/d' Makefile
13
14 # Fix pending upstream inclusion for ncurses-6.3 support:
15 # https://github.com/TragicWarrior/libviper/pull/16
16 # Not applied as it due to unrelated code changes in context.
17 substituteInPlace viper_msgbox.c --replace \
18 'mvwprintw(window,height-3,tmp,prompt);' \
19 'mvwprintw(window,height-3,tmp,"%s",prompt);'
20 substituteInPlace w_decorate.c --replace \
21 'mvwprintw(window,0,x,title);' \
22 'mvwprintw(window,0,x,"%s",title);'
23 '';
24
25 preInstall = ''
26 mkdir -p $out/include
27 mkdir -p $out/lib
28 '';
29
30 nativeBuildInputs = [ pkg-config ];
31 buildInputs = [ glib ncurses gpm];
32
33 meta = with lib; {
34 homepage = "http://libviper.sourceforge.net/";
35 description = "Simple window creation and management facilities for the console";
36 license = licenses.gpl2Plus;
37 platforms = platforms.linux;
38 };
39}