1{ stdenv
2, lib
3, fetchurl
4, cmake
5}:
6
7let
8 isCross = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
9 isStatic = stdenv.hostPlatform.isStatic;
10 isMusl = stdenv.hostPlatform.isMusl;
11in
12
13stdenv.mkDerivation rec {
14 pname = "libptytty";
15 version = "2.0";
16
17 src = fetchurl {
18 url = "http://dist.schmorp.de/libptytty/${pname}-${version}.tar.gz";
19 sha256 = "1xrikmrsdkxhdy9ggc0ci6kg5b1hn3bz44ag1mk5k1zjmlxfscw0";
20 };
21
22 nativeBuildInputs = [ cmake ];
23
24 cmakeFlags = lib.optional isStatic "-DBUILD_SHARED_LIBS=OFF"
25 ++ lib.optional (isCross || isStatic) "-DTTY_GID_SUPPORT=OFF"
26 # Musl lacks UTMP/WTMP built-in support
27 ++ lib.optionals isMusl [
28 "-DUTMP_SUPPORT=OFF"
29 "-DWTMP_SUPPORT=OFF"
30 "-DLASTLOG_SUPPORT=OFF"
31 ];
32
33 meta = with lib; {
34 description = "OS independent and secure pty/tty and utmp/wtmp/lastlog";
35 homepage = "http://dist.schmorp.de/libptytty";
36 maintainers = with maintainers; [ rnhmjoj ];
37 platforms = platforms.unix;
38 license = licenses.gpl2;
39 # pkgsMusl.pkgsStatic errors as:
40 # ln: failed to create symbolic link './include': File exists
41 broken = isStatic && isMusl;
42 };
43
44}