xref: /OK3568_Linux_fs/buildroot/package/freerdp/freerdp.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# freerdp
4#
5################################################################################
6
7FREERDP_VERSION = 2.8.0
8FREERDP_SITE = https://pub.freerdp.com/releases
9FREERDP_DEPENDENCIES = libglib2 openssl zlib
10FREERDP_LICENSE = Apache-2.0
11FREERDP_LICENSE_FILES = LICENSE
12FREERDP_CPE_ID_VENDOR = freerdp
13
14FREERDP_INSTALL_STAGING = YES
15
16FREERDP_CONF_OPTS = -DWITH_MANPAGES=OFF -Wno-dev -DWITH_GSTREAMER_0_10=OFF
17
18ifeq ($(BR2_PACKAGE_FREERDP_GSTREAMER1),y)
19FREERDP_CONF_OPTS += -DWITH_GSTREAMER_1_0=ON
20FREERDP_DEPENDENCIES += gstreamer1 gst1-plugins-base
21else
22FREERDP_CONF_OPTS += -DWITH_GSTREAMER_1_0=OFF
23endif
24
25ifeq ($(BR2_PACKAGE_CUPS),y)
26FREERDP_CONF_OPTS += -DWITH_CUPS=ON
27FREERDP_DEPENDENCIES += cups
28else
29FREERDP_CONF_OPTS += -DWITH_CUPS=OFF
30endif
31
32ifeq ($(BR2_PACKAGE_FFMPEG),y)
33FREERDP_CONF_OPTS += -DWITH_FFMPEG=ON
34FREERDP_DEPENDENCIES += ffmpeg
35else
36FREERDP_CONF_OPTS += -DWITH_FFMPEG=OFF
37endif
38
39ifeq ($(BR2_PACKAGE_ALSA_LIB_MIXER),y)
40FREERDP_CONF_OPTS += -DWITH_ALSA=ON
41FREERDP_DEPENDENCIES += alsa-lib
42else
43FREERDP_CONF_OPTS += -DWITH_ALSA=OFF
44endif
45
46ifeq ($(BR2_PACKAGE_LIBEXECINFO),y)
47FREERDP_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-lexecinfo
48FREERDP_DEPENDENCIES += libexecinfo
49endif
50
51ifeq ($(BR2_PACKAGE_LIBUSB),y)
52FREERDP_CONF_OPTS += -DCHANNEL_URBDRC=ON
53FREERDP_DEPENDENCIES += libusb
54else
55FREERDP_CONF_OPTS += -DCHANNEL_URBDRC=OFF
56endif
57
58ifeq ($(BR2_PACKAGE_PULSEAUDIO),y)
59FREERDP_CONF_OPTS += -DWITH_PULSE=ON
60FREERDP_DEPENDENCIES += pulseaudio
61else
62FREERDP_CONF_OPTS += -DWITH_PULSE=OFF
63endif
64
65# For the systemd journal
66ifeq ($(BR2_PACKAGE_SYSTEMD),y)
67FREERDP_CONF_OPTS += -DWITH_LIBSYSTEMD=ON
68FREERDP_DEPENDENCIES += systemd
69else
70FREERDP_CONF_OPTS += -DWITH_LIBSYSTEMD=OFF
71endif
72
73ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
74FREERDP_CONF_OPTS += -DWITH_NEON=ON
75else
76FREERDP_CONF_OPTS += -DWITH_NEON=OFF
77endif
78
79ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
80FREERDP_CONF_OPTS += -DWITH_SSE2=ON
81else
82FREERDP_CONF_OPTS += -DWITH_SSE2=OFF
83endif
84
85ifeq ($(BR2_arm)$(BR2_armeb),y)
86FREERDP_CONF_OPTS += -DARM_FP_ABI=$(GCC_TARGET_FLOAT_ABI)
87endif
88
89#---------------------------------------
90# Enabling server and/or client
91
92# Clients and server interface must always be enabled to build the
93# corresponding libraries.
94FREERDP_CONF_OPTS += -DWITH_SERVER_INTERFACE=ON
95FREERDP_CONF_OPTS += -DWITH_CLIENT_INTERFACE=ON
96
97ifeq ($(BR2_PACKAGE_FREERDP_SERVER),y)
98FREERDP_CONF_OPTS += -DWITH_SERVER=ON
99endif
100
101ifneq ($(BR2_PACKAGE_FREERDP_CLIENT_X11)$(BR2_PACKAGE_FREERDP_CLIENT_WL),)
102FREERDP_CONF_OPTS += -DWITH_CLIENT=ON
103endif
104
105#---------------------------------------
106# Libraries for client and/or server
107
108# The FreeRDP buildsystem uses non-orthogonal options. For example it
109# is not possible to build the server and the wayland client without
110# also building the X client. That's because the dependencies of the
111# server (the X libraries) are a superset of those of the X client.
112# So, as soon as FreeRDP is configured for the server and the wayland
113# client, it will believe it also has to build the X client, because
114# the libraries it needs are enabled.
115#
116# Furthermore, the shadow server is always built, even if there's nothing
117# it can serve (i.e. the X libs are disabled).
118#
119# So, we do not care whether we build too much; we remove, as
120# post-install hooks, whatever we do not want.
121
122# If Xorg is enabled, and the server or the X client are, then libX11
123# and libXext are forcibly enabled at the Kconfig level. However, if
124# Xorg is enabled but neither the server nor the X client are, then
125# there's nothing that guarantees those two libs are enabled. So we
126# really must check for them.
127ifeq ($(BR2_PACKAGE_XLIB_LIBX11)$(BR2_PACKAGE_XLIB_LIBXEXT),yy)
128FREERDP_DEPENDENCIES += xlib_libX11 xlib_libXext
129FREERDP_CONF_OPTS += -DWITH_X11=ON
130else
131FREERDP_CONF_OPTS += -DWITH_X11=OFF
132endif
133
134# The following libs are either optional or mandatory only for either
135# the server or the client. A mandatory library for either one is
136# selected from Kconfig, so we can make it conditional here
137ifeq ($(BR2_PACKAGE_XLIB_LIBXCURSOR),y)
138FREERDP_CONF_OPTS += -DWITH_XCURSOR=ON
139FREERDP_DEPENDENCIES += xlib_libXcursor
140else
141FREERDP_CONF_OPTS += -DWITH_XCURSOR=OFF
142endif
143
144ifeq ($(BR2_PACKAGE_XLIB_LIBXDAMAGE),y)
145FREERDP_CONF_OPTS += -DWITH_XDAMAGE=ON
146FREERDP_DEPENDENCIES += xlib_libXdamage
147else
148FREERDP_CONF_OPTS += -DWITH_XDAMAGE=OFF
149endif
150
151ifeq ($(BR2_PACKAGE_XLIB_LIBXFIXES),y)
152FREERDP_CONF_OPTS += -DWITH_XFIXES=ON
153FREERDP_DEPENDENCIES += xlib_libXfixes
154else
155FREERDP_CONF_OPTS += -DWITH_XFIXES=OFF
156endif
157
158ifeq ($(BR2_PACKAGE_XLIB_LIBXI),y)
159FREERDP_CONF_OPTS += -DWITH_XI=ON
160FREERDP_DEPENDENCIES += xlib_libXi
161else
162FREERDP_CONF_OPTS += -DWITH_XI=OFF
163endif
164
165ifeq ($(BR2_PACKAGE_XLIB_LIBXINERAMA),y)
166FREERDP_CONF_OPTS += -DWITH_XINERAMA=ON
167FREERDP_DEPENDENCIES += xlib_libXinerama
168else
169FREERDP_CONF_OPTS += -DWITH_XINERAMA=OFF
170endif
171
172ifeq ($(BR2_PACKAGE_XLIB_LIBXKBFILE),y)
173FREERDP_CONF_OPTS += -DWITH_XKBFILE=ON
174FREERDP_DEPENDENCIES += xlib_libxkbfile
175else
176FREERDP_CONF_OPTS += -DWITH_XKBFILE=OFF
177endif
178
179ifeq ($(BR2_PACKAGE_XLIB_LIBXRANDR),y)
180FREERDP_CONF_OPTS += -DWITH_XRANDR=ON
181FREERDP_DEPENDENCIES += xlib_libXrandr
182else
183FREERDP_CONF_OPTS += -DWITH_XRANDR=OFF
184endif
185
186ifeq ($(BR2_PACKAGE_XLIB_LIBXRENDER),y)
187FREERDP_CONF_OPTS += -DWITH_XRENDER=ON
188FREERDP_DEPENDENCIES += xlib_libXrender
189else
190FREERDP_CONF_OPTS += -DWITH_XRENDER=OFF
191endif
192
193ifeq ($(BR2_PACKAGE_XLIB_LIBXTST),y)
194FREERDP_CONF_OPTS += -DWITH_XTEST=ON
195FREERDP_DEPENDENCIES += xlib_libXtst
196else
197FREERDP_CONF_OPTS += -DWITH_XTEST=OFF
198endif
199
200ifeq ($(BR2_PACKAGE_XLIB_LIBXV),y)
201FREERDP_CONF_OPTS += -DWITH_XV=ON
202FREERDP_DEPENDENCIES += xlib_libXv
203else
204FREERDP_CONF_OPTS += -DWITH_XV=OFF
205endif
206
207ifeq ($(BR2_PACKAGE_FREERDP_CLIENT_WL),y)
208FREERDP_DEPENDENCIES += wayland libxkbcommon
209FREERDP_CONF_OPTS += \
210	-DWITH_WAYLAND=ON \
211	-DWAYLAND_SCANNER=$(HOST_DIR)/bin/wayland-scanner
212else
213FREERDP_CONF_OPTS += -DWITH_WAYLAND=OFF
214endif
215
216#---------------------------------------
217# Post-install hooks to cleanup and install missing stuff
218
219# Shadow server is always installed, no matter what, so we manually
220# remove it if the user does not want the server.
221ifeq ($(BR2_PACKAGE_FREERDP_SERVER),)
222define FREERDP_RM_SHADOW_SERVER
223	rm -f $(TARGET_DIR)/usr/bin/freerdp-shadow
224endef
225FREERDP_POST_INSTALL_TARGET_HOOKS += FREERDP_RM_SHADOW_SERVER
226endif # ! server
227
228# X client is always built as soon as a client is enabled and the
229# necessary libs are enabled (e.g. because of the server), so manually
230# remove it if the user does not want it.
231ifeq ($(BR2_PACKAGE_FREERDP_CLIENT_X11),)
232define FREERDP_RM_CLIENT_X11
233	rm -f $(TARGET_DIR)/usr/bin/xfreerdp
234	rm -f $(TARGET_DIR)/usr/lib/libxfreerdp-client*
235endef
236FREERDP_POST_INSTALL_TARGET_HOOKS += FREERDP_RM_CLIENT_X11
237define FREERDP_RM_CLIENT_X11_LIB
238	rm -f $(STAGING_DIR)/usr/lib/libxfreerdp-client*
239endef
240FREERDP_POST_INSTALL_STAGING_HOOKS += FREERDP_RM_CLIENT_X11_LIB
241endif # ! X client
242
243# Wayland client is always built as soon as wayland is enabled, so
244# manually remove it if the user does not want it.
245ifeq ($(BR2_PACKAGE_FREERDP_CLIENT_WL),)
246define FREERDP_RM_CLIENT_WL
247	rm -f $(TARGET_DIR)/usr/bin/wlfreerdp
248endef
249FREERDP_POST_INSTALL_TARGET_HOOKS += FREERDP_RM_CLIENT_WL
250endif
251
252# Remove static libraries in unusual dir
253define FREERDP_CLEANUP
254	rm -rf $(TARGET_DIR)/usr/lib/freerdp
255endef
256FREERDP_POST_INSTALL_TARGET_HOOKS += FREERDP_CLEANUP
257
258# Install the server key and certificate, so that a client can connect.
259# A user can override them with its own in a post-build script, if needed.
260# We install them even if the server is not enabled, since another server
261# can be built and linked with libfreerdp (e.g. weston with the  RDP
262# backend). Key and cert are installed world-readable, so non-root users
263# can start a server.
264define FREERDP_INSTALL_KEYS
265	$(INSTALL) -m 0644 -D $(@D)/server/Sample/server.key \
266		$(TARGET_DIR)/etc/freerdp/keys/server.key
267	$(INSTALL) -m 0644 -D $(@D)/server/Sample/server.crt \
268		$(TARGET_DIR)/etc/freerdp/keys/server.crt
269endef
270FREERDP_POST_INSTALL_TARGET_HOOKS += FREERDP_INSTALL_KEYS
271
272$(eval $(cmake-package))
273