|
| 1 | +Name: wannier90 |
| 2 | +Summary: Maximally-Localised Generalised Wannier Functions Code |
| 3 | +Version: 0.0.0 |
| 4 | +Release: %autorelease |
| 5 | +License: GPLv2 |
| 6 | +URL: https://www.wannier.org/ |
| 7 | + |
| 8 | +Source: https://github.com/wannier-developers/wannier90/archive/refs/tags/v%{version}.tar.gz |
| 9 | + |
| 10 | +BuildRequires: ninja-build |
| 11 | +BuildRequires: cmake |
| 12 | +BuildRequires: gcc-fortran |
| 13 | +BuildRequires: flexiblas-devel |
| 14 | +# Required for testing |
| 15 | +BuildRequires: gcc-c++ |
| 16 | +BuildRequires: python3 |
| 17 | + |
| 18 | +%global _description %{expand: |
| 19 | +Maximally-Localised Generalised Wannier Functions Code.} |
| 20 | + |
| 21 | +%description |
| 22 | +%{_description} |
| 23 | + |
| 24 | +%package devel |
| 25 | +Summary: Development files for wannier90 |
| 26 | +Requires: wannier90%{?_isa} = %{version}-%{release} |
| 27 | + |
| 28 | +%description devel |
| 29 | +This package contains the development files for the wannier90 library. |
| 30 | + |
| 31 | +%package openmpi |
| 32 | +Summary: Maximally-Localised Generalised Wannier Functions Code - OpenMPI version |
| 33 | +BuildRequires: openmpi-devel |
| 34 | + |
| 35 | +%description openmpi |
| 36 | +%{_description} |
| 37 | + |
| 38 | +This package contains the OpenMPI parallel version. |
| 39 | + |
| 40 | +%package openmpi-devel |
| 41 | +Summary: Development files for wannier90 - OpenMPI version |
| 42 | +Requires: wannier90-openmpi%{?_isa} = %{version}-%{release} |
| 43 | + |
| 44 | +%description openmpi-devel |
| 45 | +This package contains the development files for the wannier90 (OpenMPI) library. |
| 46 | + |
| 47 | +%package mpich |
| 48 | +Summary: Maximally-Localised Generalised Wannier Functions Code - MPICH version |
| 49 | +BuildRequires: mpich-devel |
| 50 | + |
| 51 | +%description mpich |
| 52 | +%{_description} |
| 53 | + |
| 54 | +This package contains the MPICH parallel version. |
| 55 | + |
| 56 | +%package mpich-devel |
| 57 | +Summary: Development files for wannier90 - MPICH version |
| 58 | +Requires: wannier90-mpich%{?_isa} = %{version}-%{release} |
| 59 | + |
| 60 | +%description mpich-devel |
| 61 | +This package contains the development files for the wannier90 (MPICH) library. |
| 62 | + |
| 63 | + |
| 64 | +%prep |
| 65 | +%autosetup -n wannier90-%{version} |
| 66 | + |
| 67 | +# $MPI_SUFFIX will be evaluated in the loops below, set by mpi modules |
| 68 | +%global _vpath_builddir %{_vendor}-%{_target_os}-build${MPI_SUFFIX:-_serial} |
| 69 | +# We are running the module load/unload manually until there is a macro-like way to expand this |
| 70 | +. /etc/profile.d/modules.sh |
| 71 | + |
| 72 | + |
| 73 | +%build |
| 74 | +cmake_common_args=( |
| 75 | + "-G Ninja" |
| 76 | + "-DWANNIER90_SHARED_LIBS=ON" |
| 77 | + "-DWANNIER90_TEST=ON" |
| 78 | +) |
| 79 | +for mpi in '' mpich openmpi ; do |
| 80 | + if [ -n "$mpi" ]; then |
| 81 | + module load mpi/${mpi}-%{_arch} |
| 82 | + cmake_mpi_args=( |
| 83 | + "-DCMAKE_INSTALL_PREFIX=${MPI_HOME}" |
| 84 | + "-DWANNIER90_MPI=ON" |
| 85 | + "-DCMAKE_INSTALL_MODULEDIR=${MPI_FORTRAN_MOD_DIR}" |
| 86 | + "-DCMAKE_INSTALL_LIBDIR=lib" |
| 87 | + ) |
| 88 | + else |
| 89 | + cmake_mpi_args=( |
| 90 | + "-DWANNIER90_MPI=OFF" |
| 91 | + "-DCMAKE_INSTALL_MODULEDIR=%{_fmoddir}" |
| 92 | + ) |
| 93 | + fi |
| 94 | + |
| 95 | + %cmake \ |
| 96 | + ${cmake_common_args[@]} \ |
| 97 | + ${cmake_mpi_args[@]} |
| 98 | + %cmake_build |
| 99 | + |
| 100 | + [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch} |
| 101 | +done |
| 102 | + |
| 103 | + |
| 104 | +%install |
| 105 | +for mpi in '' mpich openmpi ; do |
| 106 | + [ -n "$mpi" ] && module load mpi/${mpi}-%{_arch} |
| 107 | + %cmake_install |
| 108 | + [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch} |
| 109 | +done |
| 110 | + |
| 111 | + |
| 112 | +%check |
| 113 | +for mpi in '' mpich %{?with_openmpi:openmpi} ; do |
| 114 | + [ -n "$mpi" ] && module load mpi/${mpi}-%{_arch} |
| 115 | + %ctest |
| 116 | + [ -n "$mpi" ] && module unload mpi/${mpi}-%{_arch} |
| 117 | +done |
| 118 | + |
| 119 | + |
| 120 | +%files |
| 121 | +%doc README.rst |
| 122 | +%license LICENSE |
| 123 | +%{_libdir}/libwannier90.so.* |
| 124 | +%{_bindir}/wannier90.x |
| 125 | +%{_bindir}/postw90.x |
| 126 | + |
| 127 | +%files devel |
| 128 | +%{_includedir}/wannier90.hh |
| 129 | +%{_libdir}/libwannier90.so |
| 130 | +%{_fmoddir}/Wannier90/ |
| 131 | +%{_libdir}/cmake/Wannier90 |
| 132 | +%{_libdir}/pkgconfig/wannier90.pc |
| 133 | + |
| 134 | +%files openmpi |
| 135 | +%{_libdir}/openmpi/bin/wannier90.x |
| 136 | +%{_libdir}/openmpi/bin/postw90.x |
| 137 | +%{_libdir}/openmpi/lib/libwannier90.so.* |
| 138 | + |
| 139 | +%files openmpi-devel |
| 140 | +%{_libdir}/openmpi/include/wannier90.hh |
| 141 | +%{_libdir}/openmpi/lib/libwannier90.so |
| 142 | +%{_fmoddir}/openmpi/Wannier90/ |
| 143 | +%{_libdir}/openmpi/lib/cmake/Wannier90 |
| 144 | +%{_libdir}/openmpi/lib/pkgconfig/wannier90.pc |
| 145 | + |
| 146 | +%files mpich |
| 147 | +%{_libdir}/mpich/bin/wannier90.x |
| 148 | +%{_libdir}/mpich/bin/postw90.x |
| 149 | +%{_libdir}/mpich/lib/libwannier90.so.* |
| 150 | + |
| 151 | +%files mpich-devel |
| 152 | +%{_libdir}/mpich/include/wannier90.hh |
| 153 | +%{_libdir}/mpich/lib/libwannier90.so |
| 154 | +%{_fmoddir}/mpich/Wannier90/ |
| 155 | +%{_libdir}/mpich/lib/cmake/Wannier90 |
| 156 | +%{_libdir}/mpich/lib/pkgconfig/wannier90.pc |
| 157 | + |
| 158 | +%changelog |
| 159 | +%autochangelog |
0 commit comments