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

EAPI=8

PYTHON_COMPAT=( python3_{8,9,10} )

inherit python-single-r1 cmake

DESCRIPTION="C library for manipulating polynomials"
HOMEPAGE="https://github.com/SRI-CSL/libpoly/"
SRC_URI="https://github.com/SRI-CSL/${PN}/archive/v${PV}.tar.gz
	-> ${P}.tar.gz"

LICENSE="LGPL-3+"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE="+python"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

RDEPEND="
	dev-libs/gmp:=
	python? (
		${PYTHON_DEPS}
		$(python_gen_cond_dep 'dev-python/sympy[${PYTHON_USEDEP}]')
	)
"
DEPEND="${RDEPEND}"
BDEPEND="dev-util/patchelf"

DOCS=( README.md examples )

pkg_setup() {
	use python && python-single-r1_pkg_setup
}

src_prepare() {
	sed -i "s| -Werror||g"                          \
		"${S}"/src/CMakeLists.txt                   \
		"${S}"/test/polyxx/CMakeLists.txt || die

	cmake_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DLIBPOLY_BUILD_PYTHON_API=$(usex python)
		-DLIBPOLY_BUILD_STATIC=OFF
		-DLIBPOLY_BUILD_STATIC_PIC=OFF
	)
	cmake_src_configure
}

src_install() {
	cmake_src_install

	mv "${D}"/usr/lib "${D}"/usr/$(get_libdir) || die

	if use python ; then
		local sitedir="${D}"/"$(python_get_sitedir)"
		local sopath="${BUILD_DIR}"/python/polypy.so

		patchelf --remove-rpath "${sopath}" || die

		mkdir -p "${sitedir}" || die
		cp "${sopath}" "${sitedir}" || die
	fi
}