summaryrefslogtreecommitdiff
blob: a1fa4440793967408b4663de5492ef10b7f6640d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{5,6,7} )

inherit meson python-single-r1 vala xdg-utils

DESCRIPTION="Aims to make updating firmware on Linux automatic, safe and reliable"
HOMEPAGE="https://fwupd.org"
SRC_URI="https://github.com/hughsie/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="LGPL-2.1+"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="agent colorhug dell doc elogind +gpg +man nvme pkcs7 redfish systemd test thunderbolt uefi"

REQUIRED_USE="${PYTHON_REQUIRED_USE}
	?? ( elogind systemd )
	dell? ( uefi )
"

RDEPEND="${PYTHON_DEPS}
	app-arch/gcab
	app-arch/libarchive:=
	dev-db/sqlite
	>=dev-libs/glib-2.45.8:2
	dev-libs/json-glib
	dev-libs/libgpg-error
	dev-libs/libgudev:=
	>=dev-libs/libgusb-0.2.9[introspection]
	>=dev-libs/libxmlb-0.1.5
	dev-python/pillow[${PYTHON_USEDEP}]
	dev-python/pycairo[${PYTHON_USEDEP}]
	dev-python/pygobject:3[cairo,${PYTHON_USEDEP}]
	>=net-libs/libsoup-2.51.92:2.4[introspection]
	>=sys-auth/polkit-0.103
	virtual/libelf:0=
	colorhug? ( >=x11-misc/colord-1.2.12:0= )
	dell? (
		sys-libs/efivar
		>=sys-libs/libsmbios-2.4.0
	)
	gpg? (
		app-crypt/gpgme
		dev-libs/libgpg-error
	)
	nvme? ( sys-libs/efivar )
	pkcs7? ( >=net-libs/gnutls-3.4.4.1:= )
	redfish? ( sys-libs/efivar )
	!systemd? (
		!elogind? ( >=sys-auth/consolekit-1.0.0 )
		elogind? ( sys-auth/elogind )
	)
	systemd? ( >=sys-apps/systemd-211 )
	thunderbolt? ( sys-apps/thunderbolt-software-user-space )
	uefi? (
		media-libs/fontconfig
		media-libs/freetype
		sys-boot/gnu-efi
		>=sys-libs/efivar-33
		x11-libs/cairo
	)
"
DEPEND="${RDEPEND}
	$(vala_depend)
	x11-libs/pango[introspection]
	nvme? (	>=sys-kernel/linux-headers-4.4 )
	test? ( net-libs/gnutls[tools] )
"
BDEPEND="
	>=dev-util/meson-0.47.0
	virtual/pkgconfig
	doc? ( dev-util/gtk-doc )
	man? ( app-text/docbook-sgml-utils )
"

# required for fwupd daemon to run.
# NOT a build time dependency. The build system does not check for dbus.
PDEPEND="sys-apps/dbus"

src_prepare() {
	default
	sed -e "s/'--create'/'--absolute-name', '--create'/" \
		-i data/tests/builder/meson.build || die
	sed -e "/'-Werror',/d" \
		-i plugins/uefi/efi/meson.build || die
	vala_src_prepare
}

src_configure() {
	xdg_environment_reset
	local emesonargs=(
		--localstatedir "${EPREFIX}"/var
		-Dagent="$(usex agent true false)"
		-Dgtkdoc="$(usex doc true false)"
		-Delogind="$(usex elogind true false)"
		-Dgpg="$(usex gpg true false)"
		-Dman="$(usex man true false)"
		-Dpkcs7="$(usex pkcs7 true false)"
		-Dplugin_dell="$(usex dell true false)"
		# Dependencies are not available (yet?)
		-Dplugin_modem_manager="false"
		-Dplugin_nvme="$(usex nvme true false)"
		-Dplugin_redfish="$(usex redfish true false)"
		-Dplugin_synaptics="$(usex dell true false)"
		-Dplugin_thunderbolt="$(usex thunderbolt true false)"
		-Dplugin_uefi="$(usex uefi true false)"
		-Dsystemd="$(usex systemd true false)"
		-Dtests="$(usex test true false)"
	)

	if use elogind || use systemd ; then
		emesonargs+=( -Dconsolekit=false )
	else
		emesonargs+=( -Dconsolekit=true )
	fi

	meson_src_configure
}

src_install() {
	meson_src_install

	sed "s@%SEAT_MANAGER%@$(usex elogind elogind consolekit)@" \
		"${FILESDIR}"/${PN}-r1 \
		> "${T}"/${PN} || die
	doinitd "${T}"/${PN}

	if ! use systemd ; then
		# Don't timeout when fwupd is running (#673140)
		sed '/^IdleTimeout=/s@=[[:digit:]]\+@=0@' \
			-i "${ED}"/etc/${PN}/daemon.conf || die
	fi
}

pkg_postinst() {
	elog "In case you are using openrc as init system"
	elog "and you're upgrading from <fwupd-1.1.0, you"
	elog "need to start the fwupd daemon via the openrc"
	elog "init script that comes with this package."
}