summaryrefslogtreecommitdiff
blob: a4dc62fddce1fffaa6198a1c7858f0c3c22cea8d (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
# Copyright 2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

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

inherit linux-info python-any-r1 systemd toolchain-funcs

DESCRIPTION="OPAL firmware utilities"
HOMEPAGE="https://github.com/open-power/skiboot"
SRC_URI="https://github.com/open-power/skiboot/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~ppc64"
IUSE="doc"

DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND="doc? (
	$(python_gen_any_dep '
		dev-python/sphinx[${PYTHON_USEDEP}]
		dev-python/recommonmark[${PYTHON_USEDEP}]
	')
)"

CONFIG_CHECK="~MTD_POWERNV_FLASH ~OPAL_PRD ~PPC_DT_CPU_FTRS ~SCOM_DEBUGFS"
ERROR_MTD_POWERND_FLASH="CONFIG_MTD_POWERND_FLASH is required to use pflash and opal-gard"
ERROR_OPAL_PRD="CONFIG_OPAL_PRD is required to run opal-prd daemon"
ERROR_SCOM_DEBUGFS="CONFIG_SCOM_DEBUGFS is required to use xscom-utils"

S="${WORKDIR}/skiboot-${PV}"

python_check_deps() {
	has_version "dev-python/recommonmark[${PYTHON_USEDEP}]" &&
	has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
}

pkg_setup() {
	linux-info_pkg_setup
	use doc && python-any-r1_pkg_setup
}

src_prepare() {
	default
	sed -i '/^CFLAGS +=/ s/-g2 -ggdb//' external/opal-prd/Makefile || die
}

src_configure() {
	tc-export CC LD
	export OPAL_PRD_VERSION="${PV}"
	export GARD_VERSION="${PV}"
	export PFLASH_VERSION="${PV}"
	export XSCOM_VERSION="${PV}"
}

src_compile() {
	emake V=1 -C external/opal-prd
	emake V=1 -C external/gard
	emake V=1 -C external/pflash
	emake V=1 -C external/xscom-utils

	use doc && emake V=1 -C doc html
}

src_install() {
	emake -C external/opal-prd DESTDIR="${D}" prefix="${EPREFIX}/usr" install
	emake -C external/gard DESTDIR="${D}" prefix="${EPREFIX}/usr" install
	emake -C external/pflash DESTDIR="${D}" prefix="${EPREFIX}/usr" install
	emake -C external/xscom-utils DESTDIR="${D}" prefix="${EPREFIX}/usr" install

	newinitd "${FILESDIR}"/opal-prd.initd opal-prd
	newconfd "${FILESDIR}"/opal-prd.confd opal-prd

	systemd_dounit external/opal-prd/opal-prd.service

	if use doc; then

		local HTML_DOCS=( doc/_build/html/. )
	fi
	einstalldocs
}