From 123354e920582607af689db83037c1055e4ff778 Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Thu, 15 Sep 2022 03:03:05 -0500 Subject: FPLO: add new package (#32580) --- .../repos/builtin/packages/fplo/MMakefile.patch | 61 ++++++++ .../repos/builtin/packages/fplo/fedit_py.patch | 12 ++ .../repos/builtin/packages/fplo/lapackconfig.patch | 11 ++ .../repos/builtin/packages/fplo/ncurses.patch | 96 +++++++++++++ var/spack/repos/builtin/packages/fplo/package.py | 159 +++++++++++++++++++++ .../repos/builtin/packages/fplo/qt-make.patch | 34 +++++ 6 files changed, 373 insertions(+) create mode 100644 var/spack/repos/builtin/packages/fplo/MMakefile.patch create mode 100644 var/spack/repos/builtin/packages/fplo/fedit_py.patch create mode 100644 var/spack/repos/builtin/packages/fplo/lapackconfig.patch create mode 100644 var/spack/repos/builtin/packages/fplo/ncurses.patch create mode 100644 var/spack/repos/builtin/packages/fplo/package.py create mode 100644 var/spack/repos/builtin/packages/fplo/qt-make.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/fplo/MMakefile.patch b/var/spack/repos/builtin/packages/fplo/MMakefile.patch new file mode 100644 index 0000000000..beb6fb2bb3 --- /dev/null +++ b/var/spack/repos/builtin/packages/fplo/MMakefile.patch @@ -0,0 +1,61 @@ +--- a/FPLO22.00-62/install/MMakefile 2022-07-06 01:06:19.000000000 -0500 ++++ b/FPLO22.00-62/install/MMakefile 2022-08-28 16:23:30.921835477 -0500 +@@ -106,7 +106,7 @@ + + # directories with source code to compile + parentpath=../.. +-srcdir="COMMON ISO SLABIFY FEDIT CALC CIF OPTICS" ++srcdir="COMMON SLABIFY ISO FEDIT CALC CIF OPTICS" + doxinstall=0 + xsrcdir="XFPLO" + moddir="MODULES" +@@ -245,17 +245,15 @@ + + ########################### + # mkl +-echo "Please enter if you want to use the MKL eigenvalue solver (y/n) [default n]:" ; read YN +-if [ "x$YN" = "xy" -o "x$YN" = "xY" ];then mkl=1; fi ++#echo "Please enter if you want to use the MKL eigenvalue solver (y/n) [default n]:" ; read YN ++#if [ "x$YN" = "xy" -o "x$YN" = "xY" ];then mkl=1; fi + if [ $mkl = 1 ] ; then + nmkl=$(echo "$MKLROOT" | sed -e "s/[\t\n ]*//g" | wc -c) + if [ $nmkl -gt 1 ] ; then + echo "I found an mkl path" + else + echo "I did not find the mkl path you will have to setup the \n\ +-linkage yourself (README) or restart and answer no." +- echo "Press enter to continue:" ;read YN +- mkl=1 ++linkage yourself (README)." + fi + else + use_own_lapack=1 +@@ -346,27 +344,7 @@ + echo "" + ################################################################################ + echo " C-Compiler C++-Compiler F90-Compiler system specification" +-echo "probing $CC $CXX $F90 $hostname" +-if [ -f "$configdir/$CC-$F90-$hostname" ] +-then +- conffile="$configdir/$CC-$F90-$hostname" +-else +- echo "probing $CC $CXX $F90 $hostname" +- if [ -f "$configdir/$CC-$F90-$sname-$os_rel" ] +- then +- conffile="$configdir/$CC-$F90-$sname-$os_rel" +- else +- echo "probing $CC $CXX $F90 $hostname" +- if [ -f "$configdir/$CC-$F90-$sname" ] +- then +- conffile="$configdir/$CC-$F90-$sname" +- else +- echo "No configuration file for your settings are available!" +- exit +- fi +- fi +-fi +- ++conffile=$configdir/ + + + # make installdir diff --git a/var/spack/repos/builtin/packages/fplo/fedit_py.patch b/var/spack/repos/builtin/packages/fplo/fedit_py.patch new file mode 100644 index 0000000000..a667b82a42 --- /dev/null +++ b/var/spack/repos/builtin/packages/fplo/fedit_py.patch @@ -0,0 +1,12 @@ +--- a/FPLO22.00-62/PYTHON/fedit.py 2022-09-03 13:05:21.631163009 -0500 ++++ b/FPLO22.00-62/PYTHON/fedit.py 2022-09-03 13:06:37.636210691 -0500 +@@ -20,8 +20,8 @@ + Checkout the examples delivered with **fplo**. + ''' + import sys,os +-import pyfplo.fploio as fploio + import pyfplo.common ++import pyfplo.fploio as fploio + version=pyfplo.common.Version() + Version=pyfplo.common.Version + diff --git a/var/spack/repos/builtin/packages/fplo/lapackconfig.patch b/var/spack/repos/builtin/packages/fplo/lapackconfig.patch new file mode 100644 index 0000000000..2108d5a562 --- /dev/null +++ b/var/spack/repos/builtin/packages/fplo/lapackconfig.patch @@ -0,0 +1,11 @@ +--- a/FPLO22.00-62/PYTHON/setuphelper.py 2022-08-28 19:19:42.693913426 -0500 ++++ b/FPLO22.00-62/PYTHON/setuphelper.py 2022-08-28 19:20:54.902954741 -0500 +@@ -233,7 +233,7 @@ + self.ccompiler\ + =CompilerConfig.find(ccompilerconfigs,'gcc') + +- self.lapackconfig=LapackConfig.find(lapackconfigs,'our own copy') ++ self.lapackconfig=LapackConfig.find(lapackconfigs,'mkl 64bit integer 32bit') + + if "--lapackgeneric" in sys.argv: + sys.argv.remove("--lapackgeneric") diff --git a/var/spack/repos/builtin/packages/fplo/ncurses.patch b/var/spack/repos/builtin/packages/fplo/ncurses.patch new file mode 100644 index 0000000000..7887ebc7db --- /dev/null +++ b/var/spack/repos/builtin/packages/fplo/ncurses.patch @@ -0,0 +1,96 @@ +diff -ur a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 +--- a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 2022-07-03 08:48:02.000000000 -0500 ++++ b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-i386 2022-08-28 14:02:03.303297840 -0500 +@@ -41,7 +41,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 +--- a/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 2022-07-03 08:48:24.000000000 -0500 ++++ b/FPLO22.00-62/install/conf/gcc-gfortran-Linux-x86_64 2022-08-28 14:02:14.381306024 -0500 +@@ -42,7 +42,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 b/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 +--- a/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 2021-01-19 04:09:45.000000000 -0600 ++++ b/FPLO22.00-62/install/conf/gcc-ifort-Darwin-i386 2022-08-28 14:02:25.597314302 -0500 +@@ -47,7 +47,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 b/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 +--- a/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 2021-01-19 04:09:50.000000000 -0600 ++++ b/FPLO22.00-62/install/conf/gcc-ifort-Linux-i386 2022-08-28 14:02:37.508323085 -0500 +@@ -47,7 +47,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 b/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 +--- a/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 2021-01-19 04:09:55.000000000 -0600 ++++ b/FPLO22.00-62/install/conf/gcc-ifort-Linux-ia64 2022-08-28 14:02:53.211334647 -0500 +@@ -32,7 +32,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 b/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 +--- a/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 2022-05-15 01:53:01.000000000 -0500 ++++ b/FPLO22.00-62/install/conf/gcc-ifort-Linux-x86_64 2022-08-28 14:03:11.580348155 -0500 +@@ -49,7 +49,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 b/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 +--- a/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 2021-01-19 04:10:07.000000000 -0600 ++++ b/FPLO22.00-62/install/conf/icc-ifort-Darwin-i386 2022-08-28 14:03:21.741355617 -0500 +@@ -47,7 +47,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + +diff -ur a/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 b/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 +--- a/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 2021-01-19 04:10:11.000000000 -0600 ++++ b/FPLO22.00-62/install/conf/icc-ifort-Darwin-x86_64 2022-08-28 14:03:31.829363021 -0500 +@@ -49,7 +49,7 @@ + #TODO: set here the curses system library + # on Linux systems it must be -lncurses + # +-LIBS_CURSES=" -lncurses" ++LIBS_CURSES=" -lncurses -ltinfo" + + + diff --git a/var/spack/repos/builtin/packages/fplo/package.py b/var/spack/repos/builtin/packages/fplo/package.py new file mode 100644 index 0000000000..60db293e67 --- /dev/null +++ b/var/spack/repos/builtin/packages/fplo/package.py @@ -0,0 +1,159 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import glob +import os +import platform + +from spack.package import * + + +class Fplo(MakefilePackage): + """The FPLO(R) package is a full-potential local-orbital code to solve the + Kohn-Sham equations on a regular lattice or with free boundary conditions + (finite systems). Relativistic effects are treated either in a + scalar-relativistic or a full 4-component formalism. Available + functionals are LSDA, GGA (PBE 96) and LSDA/GGA+U. Orbital polarization + correction can be applied.""" + + homepage = "https://www.fplo.de/" + url = "file://{0}/FPLO22.00-62.tar.gz".format(os.getcwd()) + manual_download = True + + maintainers = ["glennpj"] + + version("22.00-62", sha256="0d1d4e9c1e8e41900901e26c3cd08ee39dcfdeb3f2c4c8862055eaf704b6d69e") + + # TODO: Try to get LAPACK to work with something other than MKL. The build + # fails even with the fallback/builtin lapack. + + # This patch replaces the default builtin lapack with MKL, as MKL is the + # only functioning LAPACK implementation. + patch("lapackconfig.patch") + + # This patch does 3 things: (1) Change the order of the src directories so + # the object dependencies are correct; (2) removes interactivity; and (3) + # explicitly sets the configuration. + patch("MMakefile.patch") + + # Add '-ltinfo' for linking. + patch("ncurses.patch") + + # Set the names for QT and PYTHON. + patch("qt-make.patch") + + # Sets the correct python module import order. + patch("fedit_py.patch") + + depends_on("mkl") + depends_on("ncurses") + depends_on("perl", type="run") + depends_on("qt@5+opengl") + + extends("python") + depends_on("py-numpy") + + conflicts("%gcc@12:") + + @property + def build_directory(self): + return join_path(self.stage.source_path, "FPLO{0}".format(self.version)) + + def edit(self, spec, prefix): + # Need to set this to 'gcc' even if using the intel compiler as all of + # the configuration files are named with 'gcc'. + if platform.system() == "Linux": + fplo_cc = "gcc" + else: + fplo_cc = os.path.basename(self.compiler.cc) + + fplo_fc = os.path.basename(self.compiler.fc) + + conffile = "{0}-{1}-{2}-{3}".format( + fplo_cc, fplo_fc, platform.system(), platform.machine() + ) + mmakefile = FileFilter(join_path(self.build_directory, "install", "MMakefile")) + mmakefile.filter(r"(^conffile=\$configdir/)$", r"\1{0}".format(conffile)) + mmakefile.filter(r"(^mkl=).*", r"\11") + + # use spack compiler + files = glob.glob(join_path(self.build_directory, "install", "conf", "*")) + filter_file(r"^\s*CC\s*=.*", "CC=" + spack_cc, *files) + filter_file(r"^\s*CXX\s*=.*", "CXX=" + spack_cxx, *files) + filter_file(r"^\s*F90\s*=.*", "F90=" + spack_fc, *files) + + # patch for 64 bit integers + if "^mkl+ilp64" in spec: + setuphelper = FileFilter(join_path(self.build_directory, "PYTHON", "setuphelper.py")) + setuphelper.filter("mkl 64bit integer 32bit", "mkl 64bit integer 64bit") + + # setup python build + python_makefile = FileFilter(join_path(self.build_directory, "PYTHON", "Makefile")) + python_makefile.filter(r"(build_ext\s* --inplace)\s*--interactive(\s*.*)", r"\1\2") + + def build(self, spec, prefix): + mmakefile = Executable(join_path(self.build_directory, "install", "MMakefile")) + mmakefile_args = [ + "-f90", + spack_fc, + "-cc", + spack_cc, + "-c+", + spack_cxx, + ] + + with working_dir(self.build_directory): + # copy contents of bin + copy_tree("bin", join_path(self.stage.source_path, "bin")) + + # configure the build + with working_dir("install"): + mmakefile(*mmakefile_args) + + # build main + make() + make("install") + + # build XFBP + with working_dir(join_path("XFBP_rel", "XFBP")): + make() + make("install") + + # build XFPLO + with working_dir(join_path("XFPLO_rel", "XFPLO")): + make() + make("install") + + # build python + with working_dir("PYTHON"): + if "^python@:2" in self.spec: + make() + else: + make("python3") + + def install(self, spec, prefix): + with working_dir(self.stage.source_path): + install_tree("bin", prefix.bin) + + with working_dir(self.build_directory): + install_tree("DOC", join_path(prefix.share, "DOC")) + with working_dir("PYTHON"): + install_tree("pyfplo", join_path(python_platlib, "pyfplo")) + + @run_after("install") + def perl_interpreter(self): + with working_dir(self.prefix.bin): + pattern = "^#!.*/usr/bin/perl" + repl = "#!{0}".format(self.spec["perl"].command.path) + files = [ + "fconv2", + "fconvdens2", + "fdowngrad.pl", + "fout2in", + "grBhfat", + "grpop", + ] + for file in files: + filter_file(pattern, repl, *files, backup=False) diff --git a/var/spack/repos/builtin/packages/fplo/qt-make.patch b/var/spack/repos/builtin/packages/fplo/qt-make.patch new file mode 100644 index 0000000000..3099353a91 --- /dev/null +++ b/var/spack/repos/builtin/packages/fplo/qt-make.patch @@ -0,0 +1,34 @@ +diff -ru a/FPLO22.00-62/XFBP_rel/XFBP/makefile b/FPLO22.00-62/XFBP_rel/XFBP/makefile +--- a/FPLO22.00-62/XFBP_rel/XFBP/makefile 2022-08-29 18:10:09.672721299 -0500 ++++ b/FPLO22.00-62/XFBP_rel/XFBP/makefile 2022-08-29 18:10:39.779667413 -0500 +@@ -1,7 +1,7 @@ + MAKE=make + QMAKE4=qmake + QMAKE4=qmake-qt4 +-QMAKE5=qmake -qt=5 ++QMAKE5=qmake + QTVERSION=5 + #QMAKE=/usr/local/qt4.5/bin/qmake + #QMAKE=/opt/trolltech/QT-4.6.2/bin/qmake +@@ -15,8 +15,8 @@ + # The config program could be named python-config + # or python2.7-config or python3-config or similar. + # You might need to install python-dev or python3-dev or somthing like this. +-PYTHON=python3 +-PYCONFIG=python3-config ++PYTHON=python ++PYCONFIG=python-config + + PROJECT1=XFBP + PROJECT1PYTHON=XFBPWITHPYTHON +diff -ru a/FPLO22.00-62/XFPLO_rel/XFPLO/makefile b/FPLO22.00-62/XFPLO_rel/XFPLO/makefile +--- a/FPLO22.00-62/XFPLO_rel/XFPLO/makefile 2022-08-29 18:10:09.654721332 -0500 ++++ b/FPLO22.00-62/XFPLO_rel/XFPLO/makefile 2022-08-29 18:10:58.263635879 -0500 +@@ -1,6 +1,6 @@ + MAKE=make + QMAKE4=qmake-qt4 +-QMAKE5=qmake -qt=5 ++QMAKE5=qmake + #QMAKE4=/usr/local/qt4.5/bin/qmake + #QMAKE4=/opt/trolltech/QT-4.6.2/bin/qmake + PROJECT1=XFPLO -- cgit v1.2.3-70-g09d2