blob: 7ec6ae15f6786eb188eb54b8ba54e8fec3dd360b [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "An open source remote desktop protocol(rdp) server."
2
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://COPYING;md5=72cfbe4e7bd33a0a1de9630c91195c21 \
5"
6
7inherit features_check autotools pkgconfig useradd systemd
8
9DEPENDS = "openssl virtual/libx11 libxfixes libxrandr libpam nasm-native imlib2 pixman libsm"
10
11REQUIRED_DISTRO_FEATURES = "x11 pam"
12
13SRC_URI = "https://github.com/neutrinolabs/${BPN}/releases/download/v${PV}/${BPN}-${PV}.tar.gz \
14 file://xrdp.sysconfig \
15 file://0001-Added-req_distinguished_name-in-etc-xrdp-openssl.con.patch \
16 file://0001-Fix-the-compile-error.patch \
17 file://0001-arch-Define-NO_NEED_ALIGN-on-ppc64.patch \
18 "
19
20SRC_URI[sha256sum] = "c5eea0af055fac90c632e44fb667f1a25c55de2e34b37127e4cb0aabaef90a0f"
21
22CFLAGS += " -Wno-deprecated-declarations"
23
24PACKAGECONFIG ??= ""
25PACKAGECONFIG[fuse] = " --enable-fuse, --disable-fuse, fuse"
26
27USERADD_PACKAGES = "${PN}"
28GROUPADD_PARAM:${PN} = "--system xrdp"
29USERADD_PARAM:${PN} = "--system --home /var/run/xrdp -g xrdp \
30 --no-create-home --shell /bin/false xrdp"
31
32FILES:${PN} += "${datadir}/dbus-1/services/*.service \
33 ${datadir}/dbus-1/accessibility-services/*.service "
34
35FILES:${PN}-dev += "${libdir}/xrdp/libcommon.so \
36 ${libdir}/xrdp/libxrdp.so \
37 ${libdir}/xrdp/libscp.so \
38 ${libdir}/xrdp/libxrdpapi.so "
39
40EXTRA_OECONF = "--enable-pam-config=suse --enable-fuse \
41 --enable-pixman --enable-painter --enable-vsock \
42 --enable-ipv6 --with-imlib2 --with-socketdir=${localstatedir}/run/${PN}"
43
44do_configure:prepend() {
45 cd ${S}
46 ./bootstrap
47 cd -
48}
49
50do_compile:prepend() {
51 sed -i 's/(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am/(MAKE) $(AM_MAKEFLAGS) install-exec-am/g' ${S}/keygen/Makefile.in
52}
53
54do_install:append() {
55
56 # deal with systemd unit files
57 install -d ${D}${systemd_unitdir}/system
58 install -m 0644 ${S}/instfiles/xrdp.service.in ${D}${systemd_unitdir}/system/xrdp.service
59 install -m 0644 ${S}/instfiles/xrdp-sesman.service.in ${D}${systemd_unitdir}/system/xrdp-sesman.service
60 sed -i -e 's,@localstatedir@,${localstatedir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
61 sed -i -e 's,@sysconfdir@,${sysconfdir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
62 sed -i -e 's,@sbindir@,${sbindir},g' ${D}${systemd_unitdir}/system/xrdp.service ${D}${systemd_unitdir}/system/xrdp-sesman.service
63
64 install -d ${D}${sysconfdir}/sysconfig/xrdp
65 install -m 0644 ${S}/instfiles/*.ini ${D}${sysconfdir}/xrdp/
66 install -m 0644 ${S}/keygen/openssl.conf ${D}${sysconfdir}/xrdp/
67 install -m 0644 ${WORKDIR}/xrdp.sysconfig ${D}${sysconfdir}/sysconfig/xrdp/
68 chown xrdp:xrdp ${D}${sysconfdir}/xrdp
69}
70
71SYSTEMD_SERVICE:${PN} = "xrdp.service xrdp-sesman.service"
72
73pkg_postinst:${PN}() {
74 if test -z "$D"
75 then
76 if test -x ${bindir}/xrdp-keygen
77 then
78 ${bindir}/xrdp-keygen xrdp ${sysconfdir}/xrdp/rsakeys.ini >/dev/null
79 fi
80 if test ! -s ${sysconfdir}/xrdp/cert.pem
81 then
82 openssl req -x509 -newkey rsa:2048 -sha256 -nodes -days 3652 \
83 -keyout ${sysconfdir}/xrdp/key.pem \
84 -out ${sysconfdir}/xrdp/cert.pem \
85 -config ${sysconfdir}/xrdp/openssl.conf >/dev/null 2>&1
86 chmod 400 ${sysconfdir}/xrdp/key.pem
87 fi
88 fi
89}