*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / sys-apps / fwupd / fwupd-1.3.5.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,8} )
7
8 inherit linux-info meson python-single-r1 vala xdg toolchain-funcs
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 amt consolekit dell gtk-doc elogind minimal +gpg introspection +man nvme pkcs7 redfish synaptics systemd test thunderbolt uefi"
18 REQUIRED_USE="${PYTHON_REQUIRED_USE}
19         ^^ ( consolekit elogind minimal systemd )
20         dell? ( uefi )
21         minimal? ( !introspection )
22 "
23 RESTRICT="!test? ( test )"
24
25 BDEPEND="$(vala_depend)
26         virtual/pkgconfig
27         gtk-doc? ( dev-util/gtk-doc )
28         introspection? ( dev-libs/gobject-introspection )
29         man? (
30                 app-text/docbook-sgml-utils
31                 sys-apps/help2man
32         )
33         test? (
34                 thunderbolt? ( dev-util/umockdev )
35                 net-libs/gnutls[tools]
36         )
37 "
38 DEPEND="${PYTHON_DEPS}
39         >=app-arch/gcab-1.0
40         app-arch/libarchive:=
41         dev-db/sqlite
42         >=dev-libs/glib-2.45.8:2
43         dev-libs/json-glib
44         dev-libs/libgpg-error
45         dev-libs/libgudev:=
46         >=dev-libs/libgusb-0.2.9[introspection?]
47         >=dev-libs/libxmlb-0.1.13
48         dev-python/pillow[${PYTHON_USEDEP}]
49         dev-python/pycairo[${PYTHON_USEDEP}]
50         dev-python/pygobject:3[cairo,${PYTHON_USEDEP}]
51         >=net-libs/libsoup-2.51.92:2.4[introspection?]
52         virtual/libelf:0=
53         virtual/udev
54         consolekit? ( >=sys-auth/consolekit-1.0.0 )
55         dell? (
56                 sys-libs/efivar
57                 >=sys-libs/libsmbios-2.4.0
58         )
59         elogind? ( sys-auth/elogind )
60         gpg? (
61                 app-crypt/gpgme
62                 dev-libs/libgpg-error
63         )
64         !minimal? (
65                 >=sys-auth/polkit-0.103
66         )
67         nvme? ( sys-libs/efivar )
68         pkcs7? ( >=net-libs/gnutls-3.4.4.1:= )
69         redfish? ( sys-libs/efivar )
70         systemd? ( >=sys-apps/systemd-211 )
71         thunderbolt? (
72                 sys-apps/thunderbolt-software-user-space
73         )
74         uefi? (
75                 app-crypt/tpm2-tss
76                 media-libs/fontconfig
77                 media-libs/freetype
78                 sys-boot/gnu-efi
79                 sys-boot/efibootmgr
80                 >=sys-libs/efivar-33
81                 x11-libs/cairo
82         )
83 "
84 RDEPEND="
85         ${DEPEND}
86         sys-apps/dbus
87 "
88
89 pkg_setup() {
90         tc-ld-disable-gold # bug https://github.com/fwupd/fwupd/issues/1530
91
92         python-single-r1_pkg_setup
93         if use nvme; then
94                 kernel_is -ge 4 4 || die "NVMe support requires kernel >= 4.4"
95         fi
96 }
97
98 src_prepare() {
99         default
100         # c.f. https://github.com/fwupd/fwupd/issues/1414
101         sed -e "/test('thunderbolt-self-test', e, env: test_env, timeout : 120)/d" \
102                 -i plugins/thunderbolt/meson.build || die
103         vala_src_prepare
104 }
105
106 src_configure() {
107         local emesonargs=(
108                 --localstatedir "${EPREFIX}"/var
109                 -Dbuild="$(usex minimal standalone all)"
110                 $(meson_use agent)
111                 $(meson_use amt plugin_amt)
112                 $(meson_use consolekit)
113                 $(meson_use dell plugin_dell)
114                 $(meson_use elogind)
115                 $(meson_use gpg)
116                 $(meson_use gtk-doc gtkdoc)
117                 $(meson_use man)
118                 $(meson_use nvme plugin_nvme)
119                 $(meson_use pkcs7)
120                 $(meson_use redfish plugin_redfish)
121                 $(meson_use synaptics plugin_synaptics)
122                 $(meson_use systemd)
123                 $(meson_use test tests)
124                 $(meson_use thunderbolt plugin_thunderbolt)
125                 $(meson_use uefi plugin_uefi)
126                 # Requires libflashrom which our sys-apps/flashrom
127                 # package does not provide
128                 -Dplugin_flashrom="false"
129                 # Dependencies are not available (yet?)
130                 -Dplugin_modem_manager="false"
131         )
132         export CACHE_DIRECTORY="${T}"
133         meson_src_configure
134 }
135
136 src_install() {
137         meson_src_install
138
139         if ! use minimal ; then
140                 sed "s@%SEAT_MANAGER%@$(usex elogind elogind consolekit)@" \
141                         "${FILESDIR}"/${PN}-r1 \
142                         > "${T}"/${PN} || die
143                 doinitd "${T}"/${PN}
144
145                 if ! use systemd ; then
146                         # Don't timeout when fwupd is running (#673140)
147                         sed '/^IdleTimeout=/s@=[[:digit:]]\+@=0@' \
148                                 -i "${ED}"/etc/${PN}/daemon.conf || die
149                 fi
150         fi
151 }
152
153 pkg_postinst() {
154         xdg_pkg_postinst
155         elog "In case you are using openrc as init system"
156         elog "and you're upgrading from <fwupd-1.1.0, you"
157         elog "need to start the fwupd daemon via the openrc"
158         elog "init script that comes with this package."
159 }