sci-libs/spglib: add 2.6.0

port to cmake

use official gh repo, with which the current one does not diverge

subslot : 0/2

iuse : add openmp, fortran, python

test : enabled

Closes: https://bugs.gentoo.org/937609
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Closes: https://github.com/gentoo/gentoo/pull/41042
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2025-03-11 15:32:33 +00:00
committed by Sam James
parent 65ac874e69
commit 2c97b5f0ce
5 changed files with 182 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST spglib-1.14.1.tar.gz 1994323 BLAKE2B 69c16d4b1b7f23b652247df01f88d88917083bf4394e4a5e2e6636b49950ae3e06e395d117ba92ed4fc7c4295f61bab53cda25c2b7b3b7073bc888719ac2dee1 SHA512 77f65af957b1cc956bbd7ab555b5d62297b13228187c54cc4f6e48efba84b0fd60e57f79a4cf22a160a550ca0a19c5d71de0219fccd0b370d2ce413d41a5cfb0
DIST spglib-2.6.0.tar.gz 2438640 BLAKE2B 99befe83edf51fbffdb815315e89e5bc9a882298e08ca79631ce2fbb17d302be529b6f4f326d60ee07bef330b8f217aa0111acaa1ec8f0562f2fb12be498db24 SHA512 a70a318dcfb0cfffca1d68605ec3afea6c5ff18ada6a4a1c0ea1c09f23ab8585d093aaf322939bc83cff28e8bb3b1b42ec65edce9208e4f69288504326e4cf2f

View File

@@ -0,0 +1,48 @@
Always use sources instead of a hypothetical installed package.
diff '--color=auto' -uNr a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
--- a/fortran/CMakeLists.txt 2025-03-12 19:45:47.109635926 -0000
+++ b/fortran/CMakeLists.txt 2025-03-12 19:46:51.964594152 -0000
@@ -77,11 +77,8 @@
# Get Spglib if it's run as stand-alone project
if (NOT TARGET Spglib::symspg)
- find_package(Spglib CONFIG)
- if (NOT Spglib_FOUND)
message(STATUS "Using bundled spglib sources")
add_subdirectory(${PROJECT_SOURCE_DIR}/.. _deps/spglib-build)
- endif ()
endif ()
#[=============================================================================[
diff '--color=auto' -uNr a/python/CMakeLists.txt b/python/CMakeLists.txt
--- a/python/CMakeLists.txt 2025-03-12 19:45:47.113635861 -0000
+++ b/python/CMakeLists.txt 2025-03-12 19:47:13.720244693 -0000
@@ -47,11 +47,8 @@
# Get Spglib if it's run as stand-alone project
if (NOT TARGET Spglib::symspg)
- find_package(Spglib CONFIG)
- if (NOT Spglib_FOUND)
message(STATUS "Using bundled spglib sources")
add_subdirectory(${PROJECT_SOURCE_DIR}/.. _deps/spglib-build)
- endif ()
endif ()
#[=============================================================================[
diff '--color=auto' -uNr a/test/CMakeLists.txt b/test/CMakeLists.txt
--- a/test/CMakeLists.txt 2025-03-12 19:45:47.113635861 -0000
+++ b/test/CMakeLists.txt 2025-03-12 19:47:43.499766319 -0000
@@ -75,13 +75,11 @@
# Get Spglib if it's run as stand-alone project
if (NOT TARGET Spglib::symspg)
- set(spglib_find_package_args)
if (SPGLIB_WITH_Fortran)
list(APPEND
COMPONENTS Fortran
)
endif ()
- find_package(Spglib REQUIRED CONFIG ${spglib_find_package_args})
endif ()
set(BUILD_GMOCK OFF)

View File

@@ -0,0 +1,29 @@
Invalid type for license
Prevent variables relevant only for a standalone python-pkg
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,6 @@
name = "spglib"
requires-python = ">=3.9"
description = "This is the spglib module."
-license = "BSD-3-Clause"
license-files = ["COPYING"]
readme = "python/README.rst"
dynamic = ["version"]
@@ -89,16 +88,6 @@
metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["python/spglib/_version.py"]
-[tool.scikit-build.cmake.define]
-SPGLIB_WITH_Python = "ON"
-SPGLIB_WITH_TESTS = "OFF"
-SPGLIB_USE_OMP = "OFF"
-
-[[tool.scikit-build.overrides]]
-if.env.CIBUILDWHEEL = true
-# Make sure cibuildwheel builds with a bundled spglib
-cmake.define.CMAKE_DISABLE_FIND_PACKAGE_Spglib = "ON"
-
[tool.setuptools_scm]
write_to = "python/spglib/_version.py"

View File

@@ -5,4 +5,8 @@
<email>sci-chemistry@gentoo.org</email>
<name>Gentoo Chemistry Project</name>
</maintainer>
<upstream>
<remote-id type="github">atztogo/spglib</remote-id><!-- old -->
<remote-id type="github">spglib/spglib</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,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
}