Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 56 lines 1.9 kB view raw
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 # Silence warnings related to use of implicitly declared library functions and implicit ints. 17 # TODO: Remove and/or fix with patches the next time this package is updated. 18 env = lib.optionalAttrs stdenv.cc.isClang { 19 NIX_CFLAGS_COMPILE = toString [ 20 "-Wno-error=implicit-function-declaration" 21 "-Wno-error=implicit-int" 22 ]; 23 }; 24 25 preBuild = '' 26 sed -i s/gcc/cc/g Makefile 27 sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h 28 '' + lib.optionalString stdenv.isDarwin '' 29 sed -i s/-soname/-install_name/ Makefile 30 '' 31 # upstream builds shared library unconditionally. Also, it has no 32 # support for cross-compilation. 33 + lib.optionalString stdenv.hostPlatform.isStatic '' 34 sed -i 's/all:.*/all: libstfl.a stfl.pc/' Makefile 35 sed -i 's/\tar /\t${stdenv.cc.targetPrefix}ar /' Makefile 36 sed -i 's/\tranlib /\t${stdenv.cc.targetPrefix}ranlib /' Makefile 37 sed -i '/install -m 644 libstfl.so./d' Makefile 38 sed -i '/ln -fs libstfl.so./d' Makefile 39 '' ; 40 41 installPhase = '' 42 DESTDIR=$out prefix=\"\" make install 43 '' 44 # some programs rely on libstfl.so.0 to be present, so link it 45 + lib.optionalString (!stdenv.hostPlatform.isStatic) '' 46 ln -s $out/lib/libstfl.so.0.24 $out/lib/libstfl.so.0 47 ''; 48 49 meta = { 50 homepage = "http://www.clifford.at/stfl/"; 51 description = "Library which implements a curses-based widget set for text terminals"; 52 maintainers = with lib.maintainers; [ lovek323 ]; 53 license = lib.licenses.lgpl3; 54 platforms = lib.platforms.unix; 55 }; 56}