blob: 41e008c55e7dc657104f407c85b084b3b45134dc (
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
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_OPTIONAL=1
DISTUTILS_SINGLE_IMPL=1
DISTUTILS_USE_PEP517=scikit-build-core
PYTHON_COMPAT=( python3_{10..13} )
FORTRAN_NEEDED=fortran
inherit cmake distutils-r1 fortran-2 toolchain-funcs
DESCRIPTION="Spglib is a C library for finding and handling crystal symmetries"
HOMEPAGE="https://github.com/spglib/spglib/"
SRC_URI="https://github.com/spglib/spglib/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD"
SLOT="0/2"
KEYWORDS="~amd64 ~x86"
IUSE="fortran openmp python test"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
RESTRICT="!test? ( test )"
RDEPEND="
python? (
${PYTHON_DEPS}
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/ruamel-yaml[${PYTHON_USEDEP}]
')
$(python_gen_cond_dep '
dev-python/typing-extensions[${PYTHON_USEDEP}]
' 3.10 3.11 3.12)
)
"
DEPEND="${RDEPEND}"
BDEPEND="
python? (
${DISTUTILS_DEPS}
${PYTHON_DEPS}
test? ( $(python_gen_cond_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]') )
)
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}"/${PN}-2.6.0-pyproject.patch
"${FILESDIR}"/${PN}-2.6.0-dist_sources.patch
)
distutils_enable_tests pytest
pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
use fortran && fortran-2_pkg_setup
use python && python-single-r1_pkg_setup
}
src_prepare() {
cmake_src_prepare
use python && distutils-r1_src_prepare
}
src_configure() {
local mycmakeargs=(
-DCMAKE_SKIP_RPATH=ON
-DSPGLIB_SHARED_LIBS=ON
-DSPGLIB_USE_OMP="$(usex openmp)"
-DSPGLIB_WITH_Fortran="$(usex fortran)"
-DSPGLIB_WITH_Python="$(usex python)"
-DSPGLIB_WITH_TESTS="$(usex test)"
)
cmake_src_configure
}
src_compile() {
cmake_src_compile
use python && distutils-r1_src_compile
}
src_test() {
local -x LD_LIBRARY_PATH="${BUILD_DIR}"
cmake_src_test
use python && distutils-r1_src_test
}
src_install() {
cmake_src_install
if use python; then
distutils-r1_src_install
# remove duplicate headers/lib
rm -r "${ED}"/$(python_get_sitedir)/spglib/{$(get_libdir),include} || die
fi
}
|