sci-physics/espresso: make live work, sorta

A couple things of note:
- new option to enable fftw
- all build options renamed with the package name, because cmake
  brainworms :)
- find_package(Python) has changed the case sensitivity for setting the
  executable (PythonInterp was used previously). "yay"
- upstream restricts cython versions and should not. It works fine with
  cython 3.1, and probably will for a while; easier to detect in
  tinderboxing than via "version check in src_configure :P

Most notably, this has two new deps, and violates network-sandbox if not
installed to the system. They aren't packaged yet in Gentoo. This
package "helpfully" builds *and installs* them if needed, assuming you
experiment with FEATURES="-network-sandbox", which is not suitable for a
keyworded package but does serve to verify that the other changes in
this commit are headed in the right direction. They are:

- heFFTe
- HighFive

A task for another day, perhaps.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
This commit is contained in:
Eli Schwartz 2025-09-09 21:42:57 -04:00
parent 8a3427d005
commit 2051e335a0
No known key found for this signature in database
GPG Key ID: 84A7D12B700D2F57
2 changed files with 60 additions and 7 deletions

View File

@ -55,24 +55,32 @@ DEPEND="${RDEPEND}
DOCS=( AUTHORS NEWS Readme.md ChangeLog )
PATCHES=(
"${FILESDIR}"/${P}-test-deps-only.patch
)
src_prepare() {
use cuda && cuda_src_prepare
cmake_src_prepare
# allow cython 3.1
sed -i '/Cython/{s/3\.1\.0/4.0/}' CMakeLists.txt || die
# These produce tests that aren't run by "make check", but ctest picks
# them up by default, against upstream's intention.
cd testsuite || die
cmake_comment_add_subdirectory cmake scripts
cmake_comment_add_subdirectory cmake scripts tutorials samples benchmarks
}
src_configure() {
local mycmakeargs=(
-DWITH_CUDA=$(usex cuda)
-DPYTHON_EXECUTABLE="${PYTHON}"
-DWITH_TESTS=$(usex test)
-DESPRESSO_BUILD_WITH_CUDA=$(usex cuda)
-DPython_EXECUTABLE="${PYTHON}"
# ignores site-packages dir and replaces with CMAKE_INSTALL_LIBDIR
-DESPRESSO_INSTALL_PYTHON="$(python_get_sitedir)"
-DESPRESSO_BUILD_TESTS=$(usex test)
-DINSTALL_PYPRESSO=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_FFTW3=$(usex !fftw)
-DWITH_HDF5=$(usex hdf5)
-DESPRESSO_BUILD_WITH_FFTW=$(usex fftw)
-DESPRESSO_BUILD_WITH_HDF5=$(usex hdf5)
)
cmake_src_configure
}
@ -99,7 +107,7 @@ src_install() {
insinto /usr/share/${PN}/
doins "${BUILD_DIR}/myconfig-sample.hpp"
save_config "${BUILD_DIR}/src/config/myconfig-final.hpp"
save_config "${BUILD_DIR}/src/config/include/config/myconfig-final.hpp"
if use doc; then
dodoc -r "${BUILD_DIR}/doc/doxygen/html"

View File

@ -0,0 +1,45 @@
From 007a29960d91b03be501a9a3ef1cb79e31e81bb4 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@gentoo.org>
Date: Tue, 2 Sep 2025 19:47:46 -0400
Subject: [PATCH] allow building test deps without running ctest indirectly
---
src/CMakeLists.txt | 4 +---
testsuite/python/CMakeLists.txt | 7 +------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 600a4ffa2..02f4cbb1e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,9 +22,7 @@
if(ESPRESSO_BUILD_TESTS)
# Target for the unit tests
add_custom_target(
- check_unit_tests
- COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${ESPRESSO_TEST_TIMEOUT}
- ${ESPRESSO_CTEST_ARGS} --output-on-failure)
+ check_unit_tests)
# Run unit tests on check
add_dependencies(check check_unit_tests)
diff --git a/testsuite/python/CMakeLists.txt b/testsuite/python/CMakeLists.txt
index d06a42aa5..ce39c5c7f 100644
--- a/testsuite/python/CMakeLists.txt
+++ b/testsuite/python/CMakeLists.txt
@@ -482,11 +482,6 @@ add_custom_target(
add_dependencies(check_python_skip_long pypresso python_test_data)
add_custom_target(
- check_python
- JOB_POOL console
- COMMAND
- ${CMAKE_CTEST_COMMAND} --timeout ${ESPRESSO_TEST_TIMEOUT}
- --resource-spec-file ${ESPRESSO_CTEST_RESOURCE_SPEC_FILE}
- ${ESPRESSO_CTEST_ARGS} --output-on-failure)
+ check_python)
add_dependencies(check_python pypresso python_test_data)
add_dependencies(check check_python)
--
2.49.1