aboutsummaryrefslogtreecommitdiff
blob: d11f16a42926fe60d2b8957a73d99ff74cf466a6 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{6..8} )

inherit cmake python-single-r1

DESCRIPTION="Open source C implementation of OPC UA"
HOMEPAGE="https://open62541.org/"
SRC_URI="https://github.com/open62541/open62541/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MPL-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc examples mbedtls pubsub test tools"
RESTRICT="!test? ( test )"

REQUIRED_USE="${PYTHON_REQUIRED_USE}"

BDEPEND="
	${PYTHON_DEPS}
	virtual/pkgconfig
	doc? (
		media-gfx/graphviz
		$(python_gen_cond_dep '
			dev-python/sphinx[${PYTHON_MULTI_USEDEP}]
			dev-python/sphinx_rtd_theme[${PYTHON_MULTI_USEDEP}]
		')
	)
	test? (
		dev-libs/check
		$(python_gen_cond_dep '
			dev-python/subunit[${PYTHON_MULTI_USEDEP}]
		')
	)
"
DEPEND="
	mbedtls? ( net-libs/mbedtls:= )
"
RDEPEND="
	${PYTHON_DEPS}
	${DEPEND}
"

PATCHES=( "${FILESDIR}/${P}-tests.patch" )

src_configure() {
	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=ON
		-DOPEN62541_VERSION=v${PV}
		-DUA_BUILD_EXAMPLES=OFF
		-DUA_BUILD_TOOLS=$(usex tools)
		-DUA_BUILD_UNIT_TESTS=$(usex test)
		-UUA_ENABLE_ENCRYPTION=$(usex mbedtls)
		-DUA_ENABLE_PUBSUB=$(usex pubsub)
	)

	cmake_src_configure
}

src_compile() {
	cmake_src_compile
	use doc && cmake_build doc
}

src_install() {
	use doc && local HTML_DOCS=( "${WORKDIR}"/${P}_build/doc/. )
	cmake_src_install

	if use examples; then
		docompress -x /usr/share/doc/${PF}/examples
		dodoc -r examples/
	fi

	python_fix_shebang "${ED}"
}

src_test() {
	cmake_src_test -j1
}