nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 writableTmpDirAsHomeHook,
7 docbook-xsl-nons,
8 libxslt,
9 pkg-config,
10 alsa-lib,
11 faac,
12 faad2,
13 ffmpeg,
14 fuse3,
15 glib,
16 openh264,
17 openssl,
18 pcre2,
19 pkcs11helper,
20 uriparser,
21 zlib,
22 libX11,
23 libXcursor,
24 libXdamage,
25 libXdmcp,
26 libXext,
27 libXi,
28 libXinerama,
29 libXrandr,
30 libXrender,
31 libXtst,
32 libXv,
33 libxkbcommon,
34 libxkbfile,
35 wayland,
36 wayland-scanner,
37 icu,
38 libunwind,
39 orc,
40 cairo,
41 cjson,
42 libusb1,
43 libpulseaudio,
44 cups,
45 pcsclite,
46 SDL2,
47 SDL2_ttf,
48 SDL2_image,
49 sdl3,
50 sdl3-ttf,
51 sdl3-image,
52 systemd,
53 libjpeg_turbo,
54 libkrb5,
55 libopus,
56 buildServer ? true,
57 nocaps ? false,
58 withUnfree ? false,
59 withWaylandSupport ? false,
60 withSDL2 ? false,
61 makeWrapper,
62
63 # tries to compile and run generate_argument_docbook.c
64 withManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
65
66 gnome-remote-desktop,
67 remmina,
68 nix-update-script,
69}:
70
71stdenv.mkDerivation (finalAttrs: {
72 pname = "freerdp";
73 version = "3.21.0";
74
75 src = fetchFromGitHub {
76 owner = "FreeRDP";
77 repo = "FreeRDP";
78 rev = finalAttrs.version;
79 hash = "sha256-oIws2HO2usOCtVDe6OTIdIDHYgb9tBIEctvCW6/Woxc=";
80 };
81
82 postPatch = ''
83 # skip NIB file generation on darwin
84 substituteInPlace "client/Mac/CMakeLists.txt" "client/Mac/cli/CMakeLists.txt" \
85 --replace-fail "if(NOT IS_XCODE)" "if(FALSE)"
86
87 substituteInPlace "libfreerdp/freerdp.pc.in" \
88 --replace-fail "Requires:" "Requires: @WINPR_PKG_CONFIG_FILENAME@"
89
90 substituteInPlace client/SDL/SDL2/dialogs/{sdl_input.cpp,sdl_select.cpp,sdl_widget.cpp,sdl_widget.hpp} \
91 --replace-fail "<SDL_ttf.h>" "<SDL2/SDL_ttf.h>"
92 ''
93 + lib.optionalString (pcsclite != null) ''
94 substituteInPlace "winpr/libwinpr/smartcard/smartcard_pcsc.c" \
95 --replace-fail "libpcsclite.so" "${lib.getLib pcsclite}/lib/libpcsclite.so"
96 ''
97 + lib.optionalString nocaps ''
98 substituteInPlace "libfreerdp/locale/keyboard_xkbfile.c" \
99 --replace-fail "RDP_SCANCODE_CAPSLOCK" "RDP_SCANCODE_LCONTROL"
100 '';
101
102 nativeBuildInputs = [
103 cmake
104 libxslt
105 docbook-xsl-nons
106 pkg-config
107 wayland-scanner
108 writableTmpDirAsHomeHook
109 makeWrapper
110 ];
111
112 buildInputs = [
113 cairo
114 cjson
115 cups
116 faad2
117 ffmpeg
118 glib
119 icu
120 libX11
121 libXcursor
122 libXdamage
123 libXdmcp
124 libXext
125 libXi
126 libXinerama
127 libXrandr
128 libXrender
129 libXtst
130 libXv
131 libjpeg_turbo
132 libkrb5
133 libopus
134 libpulseaudio
135 libunwind
136 libusb1
137 libxkbcommon
138 libxkbfile
139 openh264
140 openssl
141 orc
142 pcre2
143 pcsclite
144 pkcs11helper
145 sdl3
146 sdl3-ttf
147 sdl3-image
148 uriparser
149 zlib
150 ]
151 ++ lib.optionals stdenv.hostPlatform.isLinux [
152 alsa-lib
153 fuse3
154 systemd
155 wayland
156 wayland-scanner
157 ]
158 ++ lib.optionals withSDL2 [
159 SDL2
160 SDL2_ttf
161 SDL2_image
162 ]
163 ++ lib.optionals withUnfree [
164 faac
165 ];
166
167 # https://github.com/FreeRDP/FreeRDP/issues/8526#issuecomment-1357134746
168 cmakeFlags = [
169 "-Wno-dev"
170 (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
171 (lib.cmakeFeature "DOCBOOKXSL_DIR" "${docbook-xsl-nons}/xml/xsl/docbook")
172 ]
173 ++ lib.mapAttrsToList lib.cmakeBool (
174 {
175 BUILD_TESTING = false; # false is recommended by upstream
176 WITH_CAIRO = cairo != null;
177 WITH_CUPS = cups != null;
178 WITH_FAAC = withUnfree && faac != null;
179 WITH_FAAD2 = faad2 != null;
180 WITH_FUSE = stdenv.hostPlatform.isLinux && fuse3 != null;
181 WITH_JPEG = libjpeg_turbo != null;
182 WITH_KRB5 = libkrb5 != null;
183 WITH_OPENH264 = openh264 != null;
184 WITH_OPUS = libopus != null;
185 WITH_OSS = false;
186 WITH_MANPAGES = withManPages;
187 WITH_PCSC = pcsclite != null;
188 WITH_PULSE = libpulseaudio != null;
189 WITH_SERVER = buildServer;
190 WITH_WEBVIEW = false; # avoid introducing webkit2gtk-4.0
191 WITH_VAAPI = false; # false is recommended by upstream
192 }
193 // lib.filterAttrs (name: value: value) {
194 # Only select one
195 WITH_X11 = !withWaylandSupport;
196 WITH_WAYLAND = withWaylandSupport;
197 }
198 )
199 ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
200 (lib.cmakeBool "SDL_USE_COMPILED_RESOURCES" false)
201 ];
202
203 env.NIX_CFLAGS_COMPILE = toString (
204 lib.optionals stdenv.hostPlatform.isDarwin [
205 "-include AudioToolbox/AudioToolbox.h"
206 ]
207 ++ lib.optionals stdenv.cc.isClang [
208 "-Wno-error=incompatible-function-pointer-types"
209 ]
210 );
211
212 postFixup = lib.optionalString (withWaylandSupport && withSDL2) ''
213 wrapProgram $out/bin/sdl2-freerdp \
214 --set SDL_VIDEODRIVER wayland
215 '';
216
217 passthru = {
218 tests = {
219 inherit gnome-remote-desktop remmina;
220 };
221 updateScript = nix-update-script { };
222 };
223
224 meta = {
225 description = "Remote Desktop Protocol Client";
226 longDescription = ''
227 FreeRDP is a client-side implementation of the Remote Desktop Protocol (RDP)
228 following the Microsoft Open Specifications.
229 '';
230 homepage = "https://www.freerdp.com/";
231 license = lib.licenses.asl20;
232 maintainers = with lib.maintainers; [ deimelias ];
233 platforms = lib.platforms.unix;
234 };
235})