libptytty: fix musl and static

* Fixes Cross Compilation, Musl Dynamic and Static.
* Marks broken Musl Static.
This commit is contained in:
superherointj 2023-02-05 23:04:38 -03:00
parent 025d8692b2
commit 476d2bc651

View File

@ -4,6 +4,12 @@
, cmake , cmake
}: }:
let
isCross = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
isStatic = stdenv.hostPlatform.isStatic;
isMusl = stdenv.hostPlatform.isMusl;
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libptytty"; pname = "libptytty";
version = "2.0"; version = "2.0";
@ -15,12 +21,24 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
cmakeFlags = lib.optional isStatic "-DBUILD_SHARED_LIBS=OFF"
++ lib.optional (isCross || isStatic) "-DTTY_GID_SUPPORT=OFF"
# Musl lacks UTMP/WTMP built-in support
++ lib.optionals isMusl [
"-DUTMP_SUPPORT=OFF"
"-DWTMP_SUPPORT=OFF"
"-DLASTLOG_SUPPORT=OFF"
];
meta = with lib; { meta = with lib; {
description = "OS independent and secure pty/tty and utmp/wtmp/lastlog"; description = "OS independent and secure pty/tty and utmp/wtmp/lastlog";
homepage = "http://dist.schmorp.de/libptytty"; homepage = "http://dist.schmorp.de/libptytty";
maintainers = with maintainers; [ rnhmjoj ]; maintainers = with maintainers; [ rnhmjoj ];
platforms = platforms.unix; platforms = platforms.unix;
license = licenses.gpl2; license = licenses.gpl2;
# pkgsMusl.pkgsStatic errors as:
# ln: failed to create symbolic link './include': File exists
broken = isStatic && isMusl;
}; };
} }