git: 2e76962a16fd - main - science/cp2k: Update 7.1.0-20200518 -> 9.1.0

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 24 May 2022 01:34:21 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2e76962a16fdd60ce35a4f9db7a55fd255679b78

commit 2e76962a16fdd60ce35a4f9db7a55fd255679b78
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-05-24 01:31:34 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-05-24 01:34:18 +0000

    science/cp2k: Update 7.1.0-20200518 -> 9.1.0
---
 science/cp2k/Makefile                              | 80 ++++++++++++++------
 science/cp2k/distinfo                              | 16 ++--
 science/cp2k/files/patch-Makefile                  | 88 ++++++++++------------
 science/cp2k/files/patch-exts_Makefile.inc         | 30 ++++++--
 .../cp2k/files/patch-exts_build__dbcsr_Makefile    | 11 +++
 5 files changed, 139 insertions(+), 86 deletions(-)

diff --git a/science/cp2k/Makefile b/science/cp2k/Makefile
index 5e6ace92de2b..2ab7472836f2 100644
--- a/science/cp2k/Makefile
+++ b/science/cp2k/Makefile
@@ -1,57 +1,78 @@
 PORTNAME=	cp2k
 DISTVERSIONPREFIX=	v
-DISTVERSION=	7.1.0-20200518
+DISTVERSION=	9.1.0
 CATEGORIES=	science
 
 MAINTAINER=	yuri@FreeBSD.org
 COMMENT=	Quantum chemistry and solid state physics software package
 
 LICENSE=	GPLv2+
+LICENSE_FILE=	${WRKSRC}/LICENSE
 
+BUILD_DEPENDS=	fypp:devel/py-fypp@${PY_FLAVOR}
 LIB_DEPENDS=	libblas.so:math/blas \
 		libfftw3.so:math/fftw3 \
 		liblapack.so:math/lapack
 RUN_DEPENDS=	cp2k-data>0:science/cp2k-data
+TEST_DEPENDS=	bash:shells/bash
+
+USES=		fortran gmake localbase:ldflags python:build shebangfix tar:bz2
 
-USES=		fortran gmake localbase:ldflags python:build tar:bz2
 USE_GITHUB=	yes
-GH_TAGNAME=	2e995eec7fd208c8a72d9544807bd8b8ba8cd1cc
-GH_TUPLE=	cp2k:dbcsr:f385868eec7c89f40ac9d6d9783fc34a05d2f68e:cp2k_dbcsr/exts/dbcsr \
-		pseewald:fprettify:2b2801bf91dd651c417c232bb891d407bf81085c:pseewald_fprettify/tools/prettify/fprettify \
-		aradi:fypp:7895a7efb7d2f07dc284cece6cc9474297b8dc55:aradi_fypp/exts/dbcsr/tools/build_utils/fypp
+GH_TUPLE=	cp2k:dbcsr:f4df17b:cp2k_dbcsr/exts/dbcsr \
+		pseewald:fprettify:71781aa:pseewald_fprettify/tools/prettify/fprettify
+
+SHEBANG_FILES=	tools/regtesting/do_regtest
+
+GCC_VERSION=	${GCC_DEFAULT} # ${_USE_GCC}
 
-MAKE_ARGS=	XARCH=FreeBSD-gfortran VERSION=${VERSION} FC=gfortran${GCC_DEFAULT} CC=${CC} LD=gfortran${GCC_DEFAULT} \
+MAKE_ARGS=	XARCH=FreeBSD-gfortran VERSION=${VERSION} FC=gfortran${GCC_VERSION} CC=${CC} LD=gfortran${GCC_VERSION} \
 		DATA_DIR=${DATADIR}
 
-BINARY_ALIAS=	python=${PYTHON_CMD}
+BINARY_ALIAS=	python=${PYTHON_CMD} python3=${PYTHON_CMD} make=${GMAKE} # make - only for tests
 
 OPTIONS_DEFINE=		LIBINT
 OPTIONS_SINGLE=		MULTIPROCESSING
-OPTIONS_SINGLE_MULTIPROCESSING=		SERIAL OPENMP MPI OPENMP_MPI # for the complete list see "3a. ARCH files" in https://www.cp2k.org/howto:compile
-OPTIONS_DEFAULT=	LIBINT SERIAL
+OPTIONS_SINGLE_MULTIPROCESSING=		SERIAL OPENMP MPI OPENMP_MPI # for the complete list see https://github.com/cp2k/cp2k/blob/master/INSTALL.md
+OPTIONS_DEFAULT=	LIBINT OPENMP
 MULTIPROCESSING_DESC=	Multiprocessing
 
 LIBINT_DESC=		Use libint to evaluate integrals
 LIBINT_LIB_DEPENDS=	libint.so:science/libint
 
 SERIAL_DESC=		Single core (no multiprocessing)
-SERIAL_VARS=		VERSION=sopt
-
-OPENMP_VARS=		VERSION=ssmp
-
-MPI_VARS=		VERSION=popt
+SERIAL_VARS=		VERSION=sopt EFFECTIVE_VERSION=ssmp # now is a flavor of ssmp with NUM_THEADS=1
+SERIAL_CFLAGS=		${OPENMP_CFLAGS}
+SERIAL_CXXFLAGS=	${OPENMP_CXXFLAGS}
+SERIAL_LDFLAGS=		${OPENMP_LDFLAGS}
+SERIAL_PLIST_FILES=	${EXECUTABLES_CORE:C/(.*)/bin\/\1.${VERSION}/} # symlinks
+
+OPENMP_VARS=		VERSION=ssmp EFFECTIVE_VERSION=ssmp
+OPENMP_CFLAGS=		-fopenmp
+OPENMP_CXXFLAGS=	-fopenmp
+OPENMP_LDFLAGS=		/usr/lib/libgomp.so
+
+MPI_VARS=		VERSION=popt EFFECTIVE_VERSION=psmp # now is a flavor of psmp with NUM_THEADS=1
 MPI_LIB_DEPENDS=	libmpich.so:net/mpich \
 			libscalapack.so:math/scalapack
 MPI_LDFLAGS=		-lmpifort
+MPI_PLIST_FILES=	${EXECUTABLES_CORE:C/(.*)/bin\/\1.${VERSION}/} # symlinks
+MPI_BROKEN=		https://github.com/cp2k/cp2k/issues/2128
 
 OPENMP_MPI_DESC=	Enable both OpenMP and MPI
-OPENMP_MPI_VARS=	VERSION=psmp
+OPENMP_MPI_VARS=	VERSION=psmp EFFECTIVE_VERSION=psmp
+OPENMP_MPI_CFLAGS=	${OPENMP_CFLAGS}
+OPENMP_MPI_CXXFLAGS=	${OPENMP_CXXFLAGS}
+OPENMP_MPI_LDFLAGS=	${OPENMP_LDFLAGS}
 OPENMP_MPI_LIB_DEPENDS=	${MPI_LIB_DEPENDS}
 OPENMP_MPI_LDFLAGS=	${MPI_LDFLAGS}
+OPENMP_MPI_BROKEN=	https://github.com/cp2k/cp2k/issues/2128
 
-EXECUTABLES=		cp2k graph cp2k_shell
+EXECUTABLES_CORE=	cp2k cp2k_shell
+EXECUTABLES_EXTRA=	dumpdcd graph grid_miniapp xyz2dcd
+EXECUTABLES=		${EXECUTABLES_CORE} ${EXECUTABLES_EXTRA}
 
-PLIST_FILES=		${EXECUTABLES:C/(.*)/bin\/\1.${VERSION}/}
+PLIST_FILES=		${EXECUTABLES:C/(.*)/bin\/\1.${EFFECTIVE_VERSION}/}
 
 .include <bsd.port.options.mk>
 
@@ -64,10 +85,6 @@ pre-configure:
 	fi
 .endif
 
-.if ${GCC_DEFAULT} >= 10
-BROKEN=		fails to build with GCC 10: Element of assumed-shape or pointer array as actual argument at (1) cannot correspond to actual argument at (2)
-.endif
-
 post-patch:
 	@${REINPLACE_CMD} -i '' 's|LIBS.*=.*|& ${LDFLAGS}|; s|^FCFLAGS.*=.*|& -I${LOCALBASE}/include|; s| -march=native||' ${WRKSRC}/arch/FreeBSD-*
 
@@ -76,7 +93,22 @@ pre-build:
 
 do-install:
 .for e in ${EXECUTABLES}
-	${INSTALL_PROGRAM} ${WRKSRC}/exe/*/${e}.${VERSION} ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_PROGRAM} ${WRKSRC}/exe/*/${e}.${EFFECTIVE_VERSION} ${STAGEDIR}${PREFIX}/bin
+.endfor
+
+do-install-SERIAL-on:
+.for e in ${EXECUTABLES_CORE}
+	cd ${STAGEDIR}${PREFIX}/bin && ${LN} -s ${e}.${EFFECTIVE_VERSION} ${e}.${VERSION}
 .endfor
 
-.include <bsd.port.mk>
+do-test: # fails to run: some Linux-only commands are present
+	@cd ${WRKSRC} && \
+		${SETENV} ${MAKE_ENV} ./tools/regtesting/do_regtest -maxtasks 8
+
+.include <bsd.port.pre.mk>
+
+.  if ${GCC_DEFAULT} >= 10 # only needed when MPI is on, but flags aren't passed into DBCSR sub-project, see https://github.com/cp2k/cp2k/issues/2128
+FCFLAGS+=	-fallow-argument-mismatch
+.  endif
+
+.include <bsd.port.post.mk>
diff --git a/science/cp2k/distinfo b/science/cp2k/distinfo
index a24abbf253f6..7a156377fd8e 100644
--- a/science/cp2k/distinfo
+++ b/science/cp2k/distinfo
@@ -1,9 +1,7 @@
-TIMESTAMP = 1589936057
-SHA256 (cp2k-cp2k-v7.1.0-20200518-2e995eec7fd208c8a72d9544807bd8b8ba8cd1cc_GH0.tar.gz) = ce00cbce951176c925b82ece1fb1a417fcc308a609eb4ca38f86b7a617dd148d
-SIZE (cp2k-cp2k-v7.1.0-20200518-2e995eec7fd208c8a72d9544807bd8b8ba8cd1cc_GH0.tar.gz) = 79390777
-SHA256 (cp2k-dbcsr-f385868eec7c89f40ac9d6d9783fc34a05d2f68e_GH0.tar.gz) = 0ac2ca5cf7269b218c77ce291cb7bd15f1c0e9ed4e0301b9036897251e20d9d5
-SIZE (cp2k-dbcsr-f385868eec7c89f40ac9d6d9783fc34a05d2f68e_GH0.tar.gz) = 2555185
-SHA256 (pseewald-fprettify-2b2801bf91dd651c417c232bb891d407bf81085c_GH0.tar.gz) = e20c0645150f990cd9ef381f5cbbd6825cc7eb0433cfb625b997e02ac34ed00c
-SIZE (pseewald-fprettify-2b2801bf91dd651c417c232bb891d407bf81085c_GH0.tar.gz) = 142451
-SHA256 (aradi-fypp-7895a7efb7d2f07dc284cece6cc9474297b8dc55_GH0.tar.gz) = 2c50b6b6f0a88e65b060d542b5b0500ca6573c27caf46c31a4c53c4624ab2ff4
-SIZE (aradi-fypp-7895a7efb7d2f07dc284cece6cc9474297b8dc55_GH0.tar.gz) = 65419
+TIMESTAMP = 1653344192
+SHA256 (cp2k-cp2k-v9.1.0_GH0.tar.gz) = e0cd859e506435a38454eeaaa3bc2c1656ffd5d22698062957c84f8b4f426126
+SIZE (cp2k-cp2k-v9.1.0_GH0.tar.gz) = 76638939
+SHA256 (cp2k-dbcsr-f4df17b_GH0.tar.gz) = 997d143729028cb43c165c7bab85159a2ab485e9b9f2076129156c69eb67d82d
+SIZE (cp2k-dbcsr-f4df17b_GH0.tar.gz) = 2663121
+SHA256 (pseewald-fprettify-71781aa_GH0.tar.gz) = 4115e800c24cc66da569245bee97ea4db18833c8a63d97769c866d2384cbbfb5
+SIZE (pseewald-fprettify-71781aa_GH0.tar.gz) = 155272
diff --git a/science/cp2k/files/patch-Makefile b/science/cp2k/files/patch-Makefile
index 72c5609601e2..056ff23a727e 100644
--- a/science/cp2k/files/patch-Makefile
+++ b/science/cp2k/files/patch-Makefile
@@ -1,18 +1,15 @@
---- Makefile.orig	2020-05-20 01:09:16 UTC
+--- Makefile.orig	2021-12-31 09:29:59 UTC
 +++ Makefile
-@@ -13,9 +13,9 @@ endif
- 
- ifneq ($(SPACK_COMPILER_SPEC),)
-  # SPACK_COMPILER_SPEC is set when running in a Spack build-env
-- ARCH         := $(shell spack arch)-$(shell echo $${SPACK_COMPILER_SPEC%%@*})
-+ XARCH         := $(shell spack arch)-$(shell echo $${SPACK_COMPILER_SPEC%%@*})
- else
-- ARCH         := local
-+ XARCH         := local
+@@ -11,7 +11,7 @@ CP2KHOME     := $(abspath $(shell pwd))
+ export CP2KHOME
  endif
  
- export VERSION=sopt
-@@ -32,7 +32,7 @@ PRETTYOBJDIR := $(CP2KHOME)/obj/prettified
+-ARCH         := local
++XARCH         := local
+ export VERSION=ssmp
+ 
+ MAKEFILE     := $(CP2KHOME)/Makefile
+@@ -26,7 +26,7 @@ PRETTYOBJDIR := $(CP2KHOME)/obj/prettified
  DOXIFYOBJDIR := $(CP2KHOME)/obj/doxified
  TOOLSRC      := $(CP2KHOME)/tools
  SRCDIR       := $(CP2KHOME)/src
@@ -21,7 +18,7 @@
  REVISION     := $(shell $(CP2KHOME)/tools/build_utils/get_revision_number $(SRCDIR))
  
  EXTSDIR      := exts
-@@ -54,13 +54,13 @@ EXE_NAMES := $(basename $(notdir $(ALL_EXE_FILES)))
+@@ -48,15 +48,15 @@ EXE_NAMES := $(basename $(notdir $(ALL_EXE_FILES)))
  # this only happens on stage 3 and 4
  ifneq ($(ONEVERSION),)
  MODDEPS = "lower"
@@ -29,6 +26,8 @@
 -LIBDIR  := $(MAINLIBDIR)/$(ARCH)/$(ONEVERSION)
 +include $(ARCHDIR)/$(XARCH).$(ONEVERSION)
 +LIBDIR  := $(MAINLIBDIR)/$(XARCH)/$(ONEVERSION)
+ PKGCONFIGDIR  := $(LIBDIR)/pkgconfig
+ PKGCONFIG  := $(PKGCONFIGDIR)/libcp2k.pc
  LIBEXTSDIR := $(LIBDIR)/$(EXTSDIR)
 -OBJDIR  := $(MAINOBJDIR)/$(ARCH)/$(ONEVERSION)
 +OBJDIR  := $(MAINOBJDIR)/$(XARCH)/$(ONEVERSION)
@@ -36,77 +35,72 @@
  OBJEXTSINCL := $(foreach dir,$(EXTSPACKAGES),-I'$(OBJEXTSDIR)/$(dir)')
 -TSTDIR     := $(MAINTSTDIR)/$(ARCH)/$(ONEVERSION)
 +TSTDIR     := $(MAINTSTDIR)/$(XARCH)/$(ONEVERSION)
- ifeq ($(NVCC),)
+ ifeq ($(OFFLOAD_CC),)
  EXE_NAMES := $(basename $(notdir $(filter-out %.cu, $(ALL_EXE_FILES))))
  endif
-@@ -142,7 +142,7 @@ all: makedep | dirs exts
+@@ -159,7 +159,7 @@ all: makedep | dirs exts
  
- # foreground testing, compilation happens in do_regtest
- test: dirs
--	cd $(TSTDIR); $(TOOLSRC)/regtesting/do_regtest -quick -arch $(ARCH) -version $(ONEVERSION) -cp2kdir ../../../  $(TESTOPTS)
-+	cd $(TSTDIR); $(TOOLSRC)/regtesting/do_regtest -quick -arch $(XARCH) -version $(ONEVERSION) -cp2kdir ../../../  $(TESTOPTS)
+ # compilation for testing happens here
+ test: dirs makedep all
+-	@$(TOOLSRC)/regtesting/print_environment.sh $(ARCH) $(ONEVERSION)
++	@$(TOOLSRC)/regtesting/print_environment.sh $(XARCH) $(ONEVERSION)
+ 	@+$(MAKE) --no-print-directory -C $(TSTDIR) -f $(MAKEFILE) test INCLUDE_DEPS=true
  
- # background testing, compilation happens here
  testbg: dirs makedep all
-@@ -222,7 +222,7 @@ $(EXEDIR)/cp2k_shell.$(ONEVERSION): $(EXEDIR)/cp2k.$(O
+@@ -263,11 +263,11 @@ $(EXEDIR)/cp2k_shell.$(ONEVERSION): $(EXEDIR)/cp2k.$(O
+ 	cd $(EXEDIR); ln -sf cp2k.$(ONEVERSION) cp2k_shell.$(ONEVERSION)
+ 
+ test:
+-	@$(TOOLSRC)/regtesting/do_regtest.py $(ARCH) $(ONEVERSION) $(TESTOPTS)
++	@$(TOOLSRC)/regtesting/do_regtest.py $(XARCH) $(ONEVERSION) $(TESTOPTS)
  
  testbg:
  	@echo "testing: $(ONEVERSION) : full log in $(TSTDIR)/regtest.log "
--	@$(TOOLSRC)/regtesting/do_regtest -nobuild $(ARCH) -version $(ONEVERSION) -cp2kdir ../../../  $(TESTOPTS) >& $(TSTDIR)/regtest.log
-+	@$(TOOLSRC)/regtesting/do_regtest -nobuild $(XARCH) -version $(ONEVERSION) -cp2kdir ../../../  $(TESTOPTS) >& $(TSTDIR)/regtest.log
- 	@cat `grep 'regtesting location error_summary file:' $(TSTDIR)/regtest.log | awk '{print $$NF}'`
- 	@cat `grep 'regtesting location summary file:' $(TSTDIR)/regtest.log | awk '{print $$NF}'`
- 	@grep "Number of FAILED  tests 0" $(TSTDIR)/regtest.log >& /dev/null
-@@ -278,31 +278,31 @@ define get_extensions
+-	@$(TOOLSRC)/regtesting/do_regtest.py $(ARCH) $(ONEVERSION) $(TESTOPTS) > $(TSTDIR)/regtest.log 2>&1
++	@$(TOOLSRC)/regtesting/do_regtest.py $(XARCH) $(ONEVERSION) $(TESTOPTS) > $(TSTDIR)/regtest.log 2>&1
+ 	@grep -e "Summary:" -e "Status:" $(TSTDIR)/regtest.log
+ 
+ endif
+@@ -320,9 +320,9 @@ define get_extensions
  	$(shell test -d $(1) && find $(1) -type f -name "*.*" ! -name "*.gcda" | sed 's|.*\.||' | sort -u)
  endef
  clean:
 -	@echo rm -rf $(foreach v, $(VERSION), $(MAINOBJDIR)/$(ARCH)/$(v))
 -	@$(foreach v, $(VERSION), $(foreach ext, $(call get_extensions, $(MAINOBJDIR)/$(ARCH)/$(v)/), $(shell rm -rf $(MAINOBJDIR)/$(ARCH)/$(v)/*.$(ext))))
 -	rm -rf $(foreach v, $(VERSION), $(MAINLIBDIR)/$(ARCH)/$(v))
--OTHER_HELP += "clean : Remove intermediate object and mod files, but not the libraries and executables, for given ARCH and VERSION"
 +	@echo rm -rf $(foreach v, $(VERSION), $(MAINOBJDIR)/$(XARCH)/$(v))
 +	@$(foreach v, $(VERSION), $(foreach ext, $(call get_extensions, $(MAINOBJDIR)/$(XARCH)/$(v)/), $(shell rm -rf $(MAINOBJDIR)/$(XARCH)/$(v)/*.$(ext))))
 +	rm -rf $(foreach v, $(VERSION), $(MAINLIBDIR)/$(XARCH)/$(v))
-+OTHER_HELP += "clean : Remove intermediate object and mod files, but not the libraries and executables, for given XARCH and VERSION"
- 
- execlean:
- 	rm -rf $(foreach v, $(VERSION), $(EXEDIR)/*.$(v))
--OTHER_HELP += "execlean : Remove the executables, for given ARCH and VERSION"
-+OTHER_HELP += "execlean : Remove the executables, for given XARCH and VERSION"
+ OTHER_HELP += "clean : Remove intermediate object and mod files, but not the libraries and executables, for given ARCH and VERSION"
  
- #
- # delete the intermediate files, the programs and libraries and anything that might be in the objdir or libdir directory
+ # The Intel compiler creates a corresponding .dbg file for each executable when static linking of the Intel MPI library is requested (flag -static_mpi)
+@@ -336,16 +336,16 @@ OTHER_HELP += "execlean : Remove the executables, for 
  # Use this if you want to fully rebuild an executable (for a given compiler and or VERSION)
  #
  realclean: extclean clean execlean
 -	rm -rf $(foreach v, $(VERSION), $(MAINOBJDIR)/$(ARCH)/$(v))
 -	rm -rf $(foreach v, $(VERSION), $(MAINLIBDIR)/$(ARCH)/$(v))
--OTHER_HELP += "realclean : Remove all files for given ARCH and VERSION"
 +	rm -rf $(foreach v, $(VERSION), $(MAINOBJDIR)/$(XARCH)/$(v))
 +	rm -rf $(foreach v, $(VERSION), $(MAINLIBDIR)/$(XARCH)/$(v))
-+OTHER_HELP += "realclean : Remove all files for given XARCH and VERSION"
+ OTHER_HELP += "realclean : Remove all files for given ARCH and VERSION"
  
  testclean:
 -	rm -rf $(foreach v, $(VERSION), $(MAINTSTDIR)/$(ARCH)/$(v)/TEST-*)
--OTHER_HELP += "testclean : Remove all TEST-* files for given ARCH and VERSION"
 +	rm -rf $(foreach v, $(VERSION), $(MAINTSTDIR)/$(XARCH)/$(v)/TEST-*)
-+OTHER_HELP += "testclean : Remove all TEST-* files for given XARCH and VERSION"
+ OTHER_HELP += "testclean : Remove all TEST-* files for given ARCH and VERSION"
  
  testrealclean: testclean
 -	rm -rf $(foreach v, $(VERSION), $(MAINTSTDIR)/$(ARCH)/$(v)/LAST-*)
--OTHER_HELP += "testrealclean : Remove all LAST-* and TEST-* files for given ARCH and VERSION"
 +	rm -rf $(foreach v, $(VERSION), $(MAINTSTDIR)/$(XARCH)/$(v)/LAST-*)
-+OTHER_HELP += "testrealclean : Remove all LAST-* and TEST-* files for given XARCH and VERSION"
+ OTHER_HELP += "testrealclean : Remove all LAST-* and TEST-* files for given ARCH and VERSION"
  
  #
- # Remove all files from previous builds
-@@ -457,7 +457,7 @@ FORCE: ;
+@@ -515,7 +515,7 @@ FORCE: ;
  cp2k_info.o: $(GIT_REF)
  
  # Add some practical metadata about the build.
 -FCFLAGS += -D__COMPILE_ARCH="\"$(ARCH)\""\
 +FCFLAGS += -D__COMPILE_ARCH="\"$(XARCH)\""\
-            -D__COMPILE_DATE="\"$(shell date)\""\
-            -D__COMPILE_HOST="\"$(shell hostname)\""\
-            -D__COMPILE_REVISION="\"$(strip $(REVISION))\""\
+ 					 -D__COMPILE_DATE="\"$(shell date)\""\
+ 					 -D__COMPILE_HOST="\"$(shell hostname 2>/dev/null || hostnamectl --transient)\""\
+ 					 -D__COMPILE_REVISION="\"$(strip $(REVISION))\""\
diff --git a/science/cp2k/files/patch-exts_Makefile.inc b/science/cp2k/files/patch-exts_Makefile.inc
index 3ac4bd5f8d2c..2242ccc0ed8d 100644
--- a/science/cp2k/files/patch-exts_Makefile.inc
+++ b/science/cp2k/files/patch-exts_Makefile.inc
@@ -1,11 +1,29 @@
---- exts/Makefile.inc.orig	2020-05-20 01:23:28 UTC
+--- exts/Makefile.inc.orig	2021-12-31 09:29:59 UTC
 +++ exts/Makefile.inc
-@@ -14,7 +14,7 @@ extclean: dbcsrclean
+@@ -36,7 +36,7 @@ extclean: dbcsrclean
  
  dbcsr:
- 	+$(MAKE) -C $(EXTSHOME)/$@ -f .cp2k/Makefile \
--	   INCLUDEMAKE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
-+	   INCLUDEMAKE=$(ARCHDIR)/$(XARCH).$(ONEVERSION) \
+ 	+$(MAKE) -C $(EXTSHOME)/$@ -f $(EXTSHOME)/build_$@/Makefile \
+-	   ARCHFILE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
++	   ARCHFILE=$(ARCHDIR)/$(XARCH).$(ONEVERSION) \
  	   LIBDIR=$(LIBEXTSDIR)/$@ \
  	   OBJDIR=$(OBJEXTSDIR)/$@ \
- 	   ACC="$(NVCC)" \
+ 	   USE_ACCEL="$(DBCSR_USE_ACCEL)" \
+@@ -45,7 +45,7 @@ dbcsr:
+ 
+ dbcsrversion:
+ 	@$(MAKE) -C $(EXTSHOME)/dbcsr -f $(EXTSHOME)/build_dbcsr/Makefile \
+-	   ARCHFILE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
++	   ARCHFILE=$(ARCHDIR)/$(XARCH).$(ONEVERSION) \
+ 	   USE_ACCEL="$(DBCSR_USE_ACCEL)" \
+ 	   ACC="$(DBCSR_ACC)" \
+ 	   ACCFLAGS="$(DBCSR_ACCFLAGS)" \
+@@ -54,7 +54,7 @@ dbcsrversion:
+ dbcsrclean:
+ 	@echo "Clean DBCSR"
+ 	@$(MAKE) -C $(EXTSHOME)/dbcsr -f $(EXTSHOME)/build_dbcsr/Makefile \
+-	   ARCHFILE=$(ARCHDIR)/$(ARCH).$(ONEVERSION) \
++	   ARCHFILE=$(ARCHDIR)/$(XARCH).$(ONEVERSION) \
+ 	   LIBDIR=$(LIBEXTSDIR)/$@ \
+ 	   OBJDIR=$(OBJEXTSDIR)/$@ \
+ 	   USE_ACCEL="$(DBCSR_USE_ACCEL)" \
diff --git a/science/cp2k/files/patch-exts_build__dbcsr_Makefile b/science/cp2k/files/patch-exts_build__dbcsr_Makefile
new file mode 100644
index 000000000000..f1d511f8737f
--- /dev/null
+++ b/science/cp2k/files/patch-exts_build__dbcsr_Makefile
@@ -0,0 +1,11 @@
+--- exts/build_dbcsr/Makefile.orig	2021-12-31 09:29:59 UTC
++++ exts/build_dbcsr/Makefile
+@@ -47,7 +47,7 @@ MAKEFILE     := $(DBCSRCP2K)/Makefile
+ LIBDIR       := $(DBCSRHOME)/lib
+ OBJDIR       := $(DBCSRHOME)/obj
+ TOOLSDIR     := $(DBCSRHOME)/tools
+-FYPPEXE      := $(TOOLSDIR)/build_utils/fypp/bin/fypp
++FYPPEXE      := $(PREFIX)/bin/fypp
+ SRCDIR       := $(DBCSRHOME)/src
+ TESTSDIR     := $(DBCSRHOME)/tests
+ ARCHFILE     :=