*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / sys-apps / fwupd / fwupd-1.2.11.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7} )
7
8 inherit meson python-single-r1 vala xdg-utils
9
10 DESCRIPTION="Aims to make updating firmware on Linux automatic, safe and reliable"
11 HOMEPAGE="https://fwupd.org"
12 SRC_URI="https://github.com/hughsie/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
13
14 LICENSE="LGPL-2.1+"
15 SLOT="0"
16 KEYWORDS="amd64 ~arm x86"
17 IUSE="agent colorhug consolekit dell doc elogind +gpg +man nvme pkcs7 redfish systemd test thunderbolt uefi"
18 RESTRICT="!test? ( test )"
19
20 REQUIRED_USE="${PYTHON_REQUIRED_USE}
21         ^^ ( consolekit elogind systemd )
22         dell? ( uefi )
23 "
24
25 RDEPEND="${PYTHON_DEPS}
26         app-arch/gcab
27         app-arch/libarchive:=
28         dev-db/sqlite
29         >=dev-libs/glib-2.45.8:2
30         dev-libs/json-glib
31         dev-libs/libgpg-error
32         dev-libs/libgudev:=
33         >=dev-libs/libgusb-0.2.9[introspection]
34         >=dev-libs/libxmlb-0.1.7
35         dev-python/pillow[${PYTHON_USEDEP}]
36         dev-python/pycairo[${PYTHON_USEDEP}]
37         dev-python/pygobject:3[cairo,${PYTHON_USEDEP}]
38         >=net-libs/libsoup-2.51.92:2.4[introspection]
39         >=sys-auth/polkit-0.103
40         virtual/libelf:0=
41         colorhug? ( >=x11-misc/colord-1.2.12:0= )
42         consolekit? ( >=sys-auth/consolekit-1.0.0 )
43         dell? (
44                 sys-libs/efivar
45                 >=sys-libs/libsmbios-2.4.0
46         )
47         elogind? ( sys-auth/elogind )
48         gpg? (
49                 app-crypt/gpgme
50                 dev-libs/libgpg-error
51         )
52         nvme? ( sys-libs/efivar )
53         pkcs7? ( >=net-libs/gnutls-3.4.4.1:= )
54         redfish? ( sys-libs/efivar )
55         systemd? ( >=sys-apps/systemd-211 )
56         thunderbolt? ( sys-apps/thunderbolt-software-user-space )
57         uefi? (
58                 media-libs/fontconfig
59                 media-libs/freetype
60                 sys-boot/gnu-efi
61                 >=sys-libs/efivar-33
62                 x11-libs/cairo
63         )
64 "
65 DEPEND="${RDEPEND}
66         $(vala_depend)
67         x11-libs/pango[introspection]
68         nvme? ( >=sys-kernel/linux-headers-4.4 )
69         test? ( net-libs/gnutls[tools] )
70 "
71 BDEPEND="
72         >=dev-util/meson-0.47.0
73         virtual/pkgconfig
74         doc? ( dev-util/gtk-doc )
75         man? (
76                 app-text/docbook-sgml-utils
77                 sys-apps/help2man
78         )
79 "
80
81 # required for fwupd daemon to run.
82 # NOT a build time dependency. The build system does not check for dbus.
83 PDEPEND="sys-apps/dbus"
84
85 src_prepare() {
86         default
87         sed -e "s/'--create'/'--absolute-name', '--create'/" \
88                 -i data/tests/builder/meson.build || die
89         sed -e "/'-Werror',/d" \
90                 -i plugins/uefi/efi/meson.build || die
91         vala_src_prepare
92 }
93
94 src_configure() {
95         xdg_environment_reset
96         local emesonargs=(
97                 --localstatedir "${EPREFIX}"/var
98                 -Dagent="$(usex agent true false)"
99                 -Dconsolekit="$(usex consolekit true false)"
100                 -Dgtkdoc="$(usex doc true false)"
101                 -Delogind="$(usex elogind true false)"
102                 -Dgpg="$(usex gpg true false)"
103                 -Dman="$(usex man true false)"
104                 -Dpkcs7="$(usex pkcs7 true false)"
105                 -Dplugin_dell="$(usex dell true false)"
106                 # Requires libflashrom which our sys-apps/flashrom
107                 # package does not provide
108                 -Dplugin_flashrom="false"
109                 # Dependencies are not available (yet?)
110                 -Dplugin_modem_manager="false"
111                 -Dplugin_nvme="$(usex nvme true false)"
112                 -Dplugin_redfish="$(usex redfish true false)"
113                 -Dplugin_synaptics="$(usex dell true false)"
114                 -Dplugin_thunderbolt="$(usex thunderbolt true false)"
115                 -Dplugin_uefi="$(usex uefi true false)"
116                 -Dsystemd="$(usex systemd true false)"
117                 -Dtests="$(usex test true false)"
118         )
119
120         meson_src_configure
121 }
122
123 src_install() {
124         meson_src_install
125
126         sed "s@%SEAT_MANAGER%@$(usex elogind elogind consolekit)@" \
127                 "${FILESDIR}"/${PN}-r1 \
128                 > "${T}"/${PN} || die
129         doinitd "${T}"/${PN}
130
131         if ! use systemd ; then
132                 # Don't timeout when fwupd is running (#673140)
133                 sed '/^IdleTimeout=/s@=[[:digit:]]\+@=0@' \
134                         -i "${ED}"/etc/${PN}/daemon.conf || die
135         fi
136 }
137
138 pkg_postinst() {
139         elog "In case you are using openrc as init system"
140         elog "and you're upgrading from <fwupd-1.1.0, you"
141         elog "need to start the fwupd daemon via the openrc"
142         elog "init script that comes with this package."
143 }