Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, ncurses, libiconv }:
2
3stdenv.mkDerivation rec {
4 pname = "stfl";
5 version = "0.24";
6
7 src = fetchurl {
8 url = "http://www.clifford.at/stfl/stfl-${version}.tar.gz";
9 sha256 = "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl";
10 };
11
12 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
13
14 buildInputs = [ ncurses libiconv ];
15
16 preBuild = ''
17 sed -i s/gcc/cc/g Makefile
18 sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h
19 '' + lib.optionalString stdenv.isDarwin ''
20 sed -i s/-soname/-install_name/ Makefile
21 ''
22 # upstream builds shared library unconditionally. Also, it has no
23 # support for cross-compilation.
24 + lib.optionalString stdenv.hostPlatform.isStatic ''
25 sed -i 's/all:.*/all: libstfl.a stfl.pc/' Makefile
26 sed -i 's/\tar /\t${stdenv.cc.targetPrefix}ar /' Makefile
27 sed -i 's/\tranlib /\t${stdenv.cc.targetPrefix}ranlib /' Makefile
28 sed -i '/install -m 644 libstfl.so./d' Makefile
29 sed -i '/ln -fs libstfl.so./d' Makefile
30 '' ;
31
32 installPhase = ''
33 DESTDIR=$out prefix=\"\" make install
34 ''
35 # some programs rely on libstfl.so.0 to be present, so link it
36 + lib.optionalString (!stdenv.hostPlatform.isStatic) ''
37 ln -s $out/lib/libstfl.so.0.24 $out/lib/libstfl.so.0
38 '';
39
40 meta = {
41 homepage = "http://www.clifford.at/stfl/";
42 description = "A library which implements a curses-based widget set for text terminals";
43 maintainers = with lib.maintainers; [ lovek323 ];
44 license = lib.licenses.lgpl3;
45 platforms = lib.platforms.unix;
46 };
47}