summary refs log tree commit diff
path: root/pkgs/development/libraries/slang/default.nix
blob: d1cafbce117461a2edd8d4734194160e7765c09a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ stdenv, fetchurl, ncurses, pcre, libpng, zlib, readline, libiconv }:

stdenv.mkDerivation rec {
  name = "slang-2.3.2";
  src = fetchurl {
    url = "https://www.jedsoft.org/releases/slang/${name}.tar.bz2";
    sha256 = "06p379fqn6w38rdpqi98irxi2bf4llb0rja3dlgkqz7nqh7kp7pw";
  };

  outputs = [ "out" "dev" "man" "doc" ];

  patches = [ ./terminfo-dirs.patch ];

  # Fix some wrong hardcoded paths
  preConfigure = ''
    sed -i -e "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" configure
    sed -i -e "s|/usr/lib/terminfo|${ncurses.out}/lib/terminfo|" src/sltermin.c
    sed -i -e "s|/bin/ln|ln|" src/Makefile.in
    sed -i -e "s|-ltermcap|-lncurses|" ./configure
  '';

  configureFlags = [
    "--with-png=${libpng.dev}"
    "--with-z=${zlib.dev}"
    "--with-pcre=${pcre.dev}"
    "--with-readline=${readline.dev}"
  ];

  buildInputs = [
    pcre libpng zlib readline
  ] ++ stdenv.lib.optionals (stdenv.isDarwin) [ libiconv ];

  propagatedBuildInputs = [ ncurses ];

  # slang 2.3.2 does not support parallel building
  enableParallelBuilding = false;

  postInstall = ''
    find "$out"/lib/ -name '*.so' -exec chmod +x "{}" \;
    sed '/^Libs:/s/$/ -lncurses/' -i "$dev"/lib/pkgconfig/slang.pc
  '';

  meta = with stdenv.lib; {
    description = "A multi-platform programmer's library designed to allow a developer to create robust software";
    homepage = http://www.jedsoft.org/slang/;
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ ];
    platforms = platforms.unix;
  };
}