1 { lib, stdenv, fetchFromGitHub, ncurses }:
3 stdenv.mkDerivation rec {
5 version = "0.24-unstable-2021-11-29";
7 src = fetchFromGitHub {
10 rev = "c2c10b8a50fef613c0aacdc5d06a0fa610bf79e9";
11 hash = "sha256-os1yQ6o4m7yBiEZQIPP64diRleIr7FtuQucUbWs4A6k=";
14 makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
16 buildInputs = [ ncurses ];
18 # Silence warnings related to use of implicitly declared library functions and implicit ints.
19 # TODO: Remove and/or fix with patches the next time this package is updated.
20 env = lib.optionalAttrs stdenv.cc.isClang {
21 NIX_CFLAGS_COMPILE = toString [
22 "-Wno-error=implicit-function-declaration"
23 "-Wno-error=implicit-int"
25 } // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
26 NIX_LDFLAGS = "-liconv";
30 sed -i s/gcc/cc/g Makefile
31 sed -i s%ncursesw/ncurses.h%ncurses.h% stfl_internals.h
32 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
33 sed -i s/-soname/-install_name/ Makefile
35 # upstream builds shared library unconditionally. Also, it has no
36 # support for cross-compilation.
37 + lib.optionalString stdenv.hostPlatform.isStatic ''
38 sed -i 's/all:.*/all: libstfl.a stfl.pc/' Makefile
39 sed -i 's/\tar /\t${stdenv.cc.targetPrefix}ar /' Makefile
40 sed -i 's/\tranlib /\t${stdenv.cc.targetPrefix}ranlib /' Makefile
41 sed -i '/install -m 644 libstfl.so./d' Makefile
42 sed -i '/ln -fs libstfl.so./d' Makefile
46 DESTDIR=$out prefix=\"\" make install
48 # some programs rely on libstfl.so.0 to be present, so link it
49 + lib.optionalString (!stdenv.hostPlatform.isStatic) ''
50 ln -s $out/lib/libstfl.so.0.24 $out/lib/libstfl.so.0
54 homepage = "https://web.archive.org/web/20211113222004/http://www.clifford.at/stfl/";
55 description = "Library which implements a curses-based widget set for text terminals";
56 maintainers = with lib.maintainers; [ lovek323 ];
57 license = lib.licenses.lgpl3;
58 platforms = lib.platforms.unix;