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