gnu: gromacs: Update to 2025.3.

Also unbundle libtirpc and muparser. The unbundling is now done in a snippet
instead of a build phase.

* gnu/packages/chemistry.scm (gromacs): Update to 2025.3.
[source]: Switch to git-fetch. Add modules and snippet fields.
[arguments]<#:configure-flags>: Add -DGMX_USE_MUPARSER=EXTERNAL and
-DCMAKE_CXX_FLAGS.
[phases]: Adjust 'fixes phase. Use the package source of googletest-1.13.
[inputs]: Add libtirpc and muparser.
* gnu/packages/patches/gromacs-tinyxml2.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): Deregister patch.

Fixes: guix/guix#3584
Signed-off-by: Andreas Enge <andreas@enge.fr>
This commit is contained in:
David Elsing 2025-10-20 15:13:58 +02:00 committed by Andreas Enge
parent ad0c381841
commit ad9d43baa0
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3
3 changed files with 54 additions and 97 deletions

View file

@ -1519,7 +1519,6 @@ dist_patch_DATA = \
%D%/packages/patches/grantlee-register-metaenumvariable.patch \
%D%/packages/patches/grep-timing-sensitive-test.patch \
%D%/packages/patches/grfcodec-gcc-compat.patch \
%D%/packages/patches/gromacs-tinyxml2.patch \
%D%/packages/patches/groovy-add-exceptionutilsgenerator.patch \
%D%/packages/patches/grub-efi-fat-serial-number.patch \
%D%/packages/patches/grub-hurd64.patch \

View file

@ -60,6 +60,7 @@
#:use-module (gnu packages lisp)
#:use-module (gnu packages maths)
#:use-module (gnu packages mpi)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
@ -493,23 +494,47 @@ stored with user-specified precision.")
(define-public gromacs
(package
(name "gromacs")
(version "2022.4")
(source (origin
(method url-fetch)
(uri (string-append "http://ftp.gromacs.org/pub/gromacs/gromacs-"
version ".tar.gz"))
(sha256
(base32
"15vjwasxjq0h18dmzacjkdim51zrvr0ni42hbc30557j5xhbw4f5"))
;; Our version of tinyxml2 is far newer than the bundled one and
;; require fixing `testutils' code. See patch header for more info
(patches (search-patches "gromacs-tinyxml2.patch"))))
(version "2025.3")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.com/gromacs/gromacs")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1p9vvlbrysh8lwnbgy845pgx664k6mkw8p66f8bx468f7z2rp900"))
(modules '((guix build utils)))
(snippet
'(begin
;; Still bundled: part of gromacs, source behind registration
;; but free software anyways
;;(delete-file-recursively "src/external/vmd_molfile")
;; Still bundled: threads-based OpenMPI-compatible fallback
;; designed to be bundled like that
;;(delete-file-recursively "src/external/thread_mpi")
;; Still bundled: Colvars is intended to be built as part of a
;; molecular simulation program.
;;(delete-file-recursively "src/external/colvars")
;; Unbundling
(delete-file-recursively "src/external/lmfit")
(delete-file-recursively "src/external/clFFT")
(delete-file-recursively "src/external/fftpack")
(delete-file-recursively "src/external/build-fftw")
(delete-file-recursively "src/external/tng_io")
(delete-file-recursively "src/external/tinyxml2")
(delete-file-recursively "src/external/googletest")
(delete-file-recursively "src/external/muparser")
(delete-file-recursively "src/external/rpc_xdr")
(delete-file-recursively "src/external/vkfft")))))
(build-system cmake-build-system)
(arguments
(list #:configure-flags
#~(list "-DGMX_DEVELOPER_BUILD=on" ; Needed to run tests
;; Unbundling
"-DGMX_USE_LMFIT=EXTERNAL"
"-DGMX_USE_MUPARSER=EXTERNAL"
"-DGMX_BUILD_OWN_FFTW=off"
"-DGMX_EXTERNAL_BLAS=on"
"-DGMX_EXTERNAL_LAPACK=on"
@ -521,31 +546,29 @@ stored with user-specified precision.")
;; Workaround for cmake/FindSphinx.cmake version parsing that does
;; not understand the guix-wrapped `sphinx-build --version' answer
(string-append "-DSPHINX_EXECUTABLE_VERSION="
#$(package-version python-sphinx)))
#$(package-version python-sphinx))
(string-append
"-DCMAKE_CXX_FLAGS=-I"
(search-input-directory %build-inputs "/include/tirpc")))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fixes
(lambda* (#:key inputs #:allow-other-keys)
;; Still bundled: part of gromacs, source behind registration
;; but free software anyways
;;(delete-file-recursively "src/external/vmd_molfile")
;; Still bundled: threads-based OpenMPI-compatible fallback
;; designed to be bundled like that
;;(delete-file-recursively "src/external/thread_mpi")
;; Unbundling
(delete-file-recursively "src/external/lmfit")
(delete-file-recursively "src/external/clFFT")
(delete-file-recursively "src/external/fftpack")
(delete-file-recursively "src/external/build-fftw")
(delete-file-recursively "src/external/tng_io")
(delete-file-recursively "src/external/tinyxml2")
(delete-file-recursively "src/external/googletest")
(copy-recursively #$(package-source googletest)
(lambda _
(copy-recursively #$(package-source googletest-1.13)
"src/external/googletest")
;; This test warns about the build host hardware, disable
(substitute* "src/gromacs/hardware/tests/hardwaretopology.cpp"
(("TEST\\(HardwareTopologyTest, HwlocExecute\\)")
"void __guix_disabled()")))))))
"void __guix_disabled()"))
(substitute* "cmake/gmxTestXDR.cmake"
(("TestXDR\\.cpp\"" orig)
(string-append orig " LINK_LIBRARIES -ltirpc")))
(substitute* "CMakeLists.txt"
(("set\\(GMX_EXTRA_LIBRARIES.*" orig)
(string-append
orig "\nlist(APPEND GMX_EXTRA_LIBRARIES \"-ltirpc\")\n")))
(substitute* "src/external/CMakeLists.txt"
(("add_subdirectory\\(rpc_xdr\\)") "")))))))
(native-inputs
(list doxygen
graphviz
@ -556,7 +579,9 @@ stored with user-specified precision.")
(inputs
(list fftwf
`(,hwloc-2 "lib")
libtirpc
lmfit
muparser
openblas
perl
tinyxml2

View file

@ -1,67 +0,0 @@
Unbundling tinyxml2 from gromacs and using our own, which is newer, broke gromacs
build.
This patch fixes this issue:
- Error handling API changed, fix the testutils/refdata_xml.cpp code by using the
new API: document.ErrorStr() & tinyxml2::XML_SUCCESS.
Those fixes will be submitted for inclusion to upstream, but may not be suitable
there as long as they still keep the old version bundled.
First hunk has already been requested for merging. Third is in discussion. Second
will only be sent if third is OK'ed.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cd748c9..1e90c95 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -539,9 +539,6 @@ if(GMX_EXTERNAL_TINYXML2)
if(NOT HAVE_TINYXML2)
message(FATAL_ERROR "External TinyXML-2 could not be found, please adjust your search paths")
endif()
- if (TinyXML2_FOUND AND TinyXML2_VERSION VERSION_GREATER "6")
- message(FATAL_ERROR "External TinyXML-2 is later than the highest supported version 6. Please adjust your search paths to include a supported version")
- endif()
endif()
option(GMX_EXTRAE "Add support for tracing using EXTRAE" OFF)
diff --git a/src/testutils/refdata_xml.cpp b/src/testutils/refdata_xml.cpp
index 0eb2209..57cebff 100644
--- a/src/testutils/refdata_xml.cpp
+++ b/src/testutils/refdata_xml.cpp
@@ -206,21 +206,12 @@ ReferenceDataEntry::EntryPointer readReferenceDataFile(const std::string& path)
document.LoadFile(path.c_str());
if (document.Error())
{
- const char* errorStr1 = document.GetErrorStr1();
- const char* errorStr2 = document.GetErrorStr2();
+ const char* errorStr = document.ErrorStr();
std::string errorString("Error was ");
- if (errorStr1)
- {
- errorString += errorStr1;
- }
- if (errorStr2)
- {
- errorString += errorStr2;
- }
- if (!errorStr1 && !errorStr2)
- {
+ if (errorStr)
+ errorString += errorStr;
+ else
errorString += "not specified.";
- }
GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n."
+ errorString + "\n"));
}
@@ -371,7 +362,7 @@ void writeReferenceDataFile(const std::string& path, const ReferenceDataEntry& r
XMLElementPtr rootElement = createRootElement(&document);
createChildElements(rootElement, rootEntry);
- if (document.SaveFile(path.c_str()) != tinyxml2::XML_NO_ERROR)
+ if (document.SaveFile(path.c_str()) != tinyxml2::XML_SUCCESS)
{
GMX_THROW(TestException("Reference data saving failed in " + path));
}