Here's a rudimentary solution for test_optdepends.sh that admittedly turned out uglier than I had hoped. I haven't tested it but I think it should work.
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d\n", $1,$2,$3); }'; }
# Add hypre support
if [ -f "/usr/lib/libHYPRE.so" ]; then
VERSION_MIN=2.14.2
VERSION=$(readlink -f "/usr/lib/libHYPRE.so" | grep -oP '\d+.\d+.\d+')
if [ $(version $VERSION) -lt $(version $VERSION_MIN) ]; then
(>&2 echo "WARNING: COMPILING PETSc WITHOUT HYPRE.")
(>&2 echo "HYPRE $VERSION FOUND BUT AT LEAST $VERSION_MIN IS REQUIRED.")
sleep 3
else
CONFOPTS="${CONFOPTS} --with-hypre=1"
fi
fi
Since the warning goes to stderr it doesn't affect the variable in PKGBUILD.
If you want you can either just take it and add it to test_optdepends.sh or add me as co-maintainer. Both are fine.
Pinned Comments
MartinDiehl commented on 2022-10-06 10:26 (UTC)
@jrohwer
When building PETSc (more specifically, petsc4py), one test (ex100 from ksp) will fail if a previous (major) version is installed. I could not figure out why this happens. The solution would be to build in a clean root (which is a little bit complicated due to dependency on other AUR packages) or simply uninstall the old version before.
Any help to solve this issue is welcomed.