summaryrefslogtreecommitdiff
path: root/freerdp_my.nix
blob: 1c3ac658b9449abb738ccd9a316bc69d9cb194ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
{ inputs }:
let
  nixpkgsmaster = import <nixpkgsmaster> { };
  nixpkgs2111 = import <nixpkgs2111> { };
  nixpkgs2105 = import <nixpkgs2105> { };
  nixpkgs2009 = import <nixpkgs2009> { };
  nixpkgs2003 = import <nixpkgs2003> { };
  nixpkgs1809 = import <nixpkgs1809> { };
  cmFlag = flag: if flag then "ON" else "OFF";
in
self: super: {
  freerdp_my =
    with self.lib;
    with super;
    with xorg;
    stdenv.mkDerivation rec {
      pname = "freerdp";
      version = "git";

      src = fetchGit {
        url = "https://github.com/FreeRDP/FreeRDP";
        ref = "master";
        #rev = "7b6023b3400658aa7b303997a221814daccd44fc";
        rev = "598746a26bb528c96009bc83c2b1cebd85542bfa";

      };

      doCheck = false;

      postPatch =
        ''
          export HOME=$TMP

          # skip NIB file generation on darwin
          sed -z 's/NIB file generation.*//' -i client/Mac{,/cli}/CMakeLists.txt

          substituteInPlace "libfreerdp/freerdp.pc.in" \
            --replace "Requires:" "Requires: @WINPR_PKG_CONFIG_FILENAME@"
        ''
        + lib.optionalString (pcsclite != null) ''
          substituteInPlace "winpr/libwinpr/smartcard/smartcard_pcsc.c" \
            --replace "libpcsclite.so" "${lib.getLib pcsclite}/lib/libpcsclite.so"
        '';

      buildInputs = [
        cairo
        faad2
        ffmpeg
        glib
        icu
        libX11
        libXcursor
        libXdamage
        libXdmcp
        libXext
        libXi
        libXinerama
        libXrandr
        libXrender
        libXtst
        libXv
        libjpeg_turbo
        libunwind
        libusb1
        libxkbcommon
        libxkbfile
        openssl
        orc
        pcre2
        zlib
        alsa-lib
        systemd
        krb5
        fuse3
        cjson
      ];

      nativeBuildInputs = [
        cmake
        libxslt
        docbook-xsl-nons
        pkg-config
      ];

      # https://github.com/FreeRDP/FreeRDP/issues/8526#issuecomment-1357134746
      cmakeFlags =
        [
          "-Wno-dev"
          "-DCMAKE_INSTALL_LIBDIR=lib"
          "-DDOCBOOKXSL_DIR=${docbook-xsl-nons}/xml/xsl/docbook"
        ]
        ++ lib.mapAttrsToList (k: v: "-D${k}=${cmFlag v}") {
          BUILD_TESTING = false; # false is recommended by upstream
          WITH_CAIRO = true;
          WITH_CUPS = false;
          WITH_FAAC = false;
          WITH_FAAD2 = true;
          WITH_JPEG = true;
          WITH_OPENH264 = false;
          WITH_OSS = false;
          WITH_PCSC = false;
          WITH_PULSE = false;
          WITH_SERVER = true;
          WITH_VAAPI = false; # false is recommended by upstream
          WITH_X11 = true;
          WITH_CLIENT_SDL = false;
        };

      meta = with lib; {
        description = "A Remote Desktop Protocol Client";
        longDescription = ''
          FreeRDP is a client-side implementation of the Remote Desktop Protocol (RDP)
          following the Microsoft Open Specifications.
        '';
        homepage = "https://www.freerdp.com/";
        license = licenses.asl20;
        platforms = platforms.unix;
      };
    };
}