public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sci-libs/spglib/files/, sci-libs/spglib/
@ 2025-03-24  5:34 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2025-03-24  5:34 UTC (permalink / raw
  To: gentoo-commits

commit:     2c97b5f0ceb2ada240f70e6852a4747c020b9683
Author:     Nicolas PARLANT <nicolas.parlant <AT> parhuet <DOT> fr>
AuthorDate: Tue Mar 11 15:32:33 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 24 05:33:37 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c97b5f0

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 <AT> parhuet.fr>
Closes: https://github.com/gentoo/gentoo/pull/41042
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-libs/spglib/Manifest                           |   1 +
 .../spglib/files/spglib-2.6.0-dist_sources.patch   |  48 ++++++++++
 sci-libs/spglib/files/spglib-2.6.0-pyproject.patch |  29 ++++++
 sci-libs/spglib/metadata.xml                       |   4 +
 sci-libs/spglib/spglib-2.6.0.ebuild                | 100 +++++++++++++++++++++
 5 files changed, 182 insertions(+)

diff --git a/sci-libs/spglib/Manifest b/sci-libs/spglib/Manifest
index f948d5c7059b..2d149c08003e 100644
--- a/sci-libs/spglib/Manifest
+++ b/sci-libs/spglib/Manifest
@@ -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

diff --git a/sci-libs/spglib/files/spglib-2.6.0-dist_sources.patch b/sci-libs/spglib/files/spglib-2.6.0-dist_sources.patch
new file mode 100644
index 000000000000..4b628ba2fae7
--- /dev/null
+++ b/sci-libs/spglib/files/spglib-2.6.0-dist_sources.patch
@@ -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)

diff --git a/sci-libs/spglib/files/spglib-2.6.0-pyproject.patch b/sci-libs/spglib/files/spglib-2.6.0-pyproject.patch
new file mode 100644
index 000000000000..523d55c3baa5
--- /dev/null
+++ b/sci-libs/spglib/files/spglib-2.6.0-pyproject.patch
@@ -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"
+ 

diff --git a/sci-libs/spglib/metadata.xml b/sci-libs/spglib/metadata.xml
index d4ff1000a775..9363fa8ccdbe 100644
--- a/sci-libs/spglib/metadata.xml
+++ b/sci-libs/spglib/metadata.xml
@@ -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>

diff --git a/sci-libs/spglib/spglib-2.6.0.ebuild b/sci-libs/spglib/spglib-2.6.0.ebuild
new file mode 100644
index 000000000000..41e008c55e7d
--- /dev/null
+++ b/sci-libs/spglib/spglib-2.6.0.ebuild
@@ -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
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-24  5:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-24  5:34 [gentoo-commits] repo/gentoo:master commit in: sci-libs/spglib/files/, sci-libs/spglib/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox