# Copyright (c) 2019 Dave Love, University of Manchester # MIT licence, per Fedora policy %global mainver 3.8 Name: wrf3 Version: 3.8.1 Release: 2%{?dist} Summary: The Weather Research and Forecasting Model License: Public Domain URL: http://www2.mmm.ucar.edu/wrf/ Source0: https://github.com/wrf-model/WRF/archive/V%version/wrf-%version.tar.gz # Concocted by painful iterations of configure. (Had to be done # against the static netcdf package, but the dynamic one works for # building.) Source1: configure.wrf3 # Allow building with gfortran 4.8 by conditionalizing the # ieee_arithmetic bits properly (unnecessary with wrf 4.1.) Patch1: wrf-f2003.patch BuildRequires: perl csh netcdf-fortran-devel m4 %global desc \ The Weather Research and Forecasting (WRF) Model is a next-generation\ mesoscale numerical weather prediction system designed for both\ atmospheric research and operational forecasting applications. It\ features two dynamical cores, a data assimilation system, and a\ software architecture supporting parallel computation and system\ extensibility. The model serves a wide range of meteorological\ applications across scales from tens of meters to thousands of kilometers.\ \ This build of version 3 is for use with old data. %description %desc %package openmpi%{?el7:3} Summary: The Weather Research and Forecasting Model - openmpi%{?el7:3} BuildRequires: openmpi%{?el7:3}-devel Requires: openmpi%{?el7:3}%{?_isa} Requires: %name-common = %version-%release %description openmpi%{?el7:3} %desc This is the openmpi%{?el7:3} version. %package common Summary: Data for %name BuildArch: noarch %description common Data (the "run" directory) for %name. %prep %setup -q -n WRF-%version #%patch1 -p1 cp %SOURCE1 configure.wrf %if 0%{?fedora} || 0%{?rhel} > 7 # With gcc8, -O3 does unroll-and-jam, but the alternative is probably # better with 4.8 sed -i -e 's/ -DNO_IEEE_MODULE//g' -e 's/-O3/-O2 -ftree-vectorize -funroll-loops/g' configure.wrf %endif # Try to make failures more obvious find -name Makefile | xargs sed -i 's/make -i/make/' # Fixme: This actually breaks the build, believe it or not, failing to # find a .mod, but might help diagnose failed builds. # sed -i 's/make -i/make/' configure.wrf # Account for even the make files assuming netcdf libs are in a "lib" # subdir, and headers have to be in a sibling include. mkdir ncdf4 ln -s %_bindir %_includedir ncdf4 ln -s %_libdir ncdf4/lib %build module load mpi/openmpi%{?el7:3}-%{_arch} srcdir=$(pwd) ./compile em_real %install mkdir -p %buildroot%_libdir/openmpi%{?el7:3}/bin %buildroot%_datadir/wrf-%mainver cd main for f in *.exe do cp -p $f %buildroot%_libdir/openmpi%{?el7:3}/bin/$(basename $f .exe)-%mainver.exe done cd .. rm run/*.exe run/namelist.input cp -a run %buildroot%_datadir/wrf-%mainver %files openmpi%{?el7:3} %doc README %_libdir/openmpi%{?el7:3}/bin/*.exe %files common %doc README %_datadir/wrf-%mainver %changelog * Mon Jul 22 2019 Dave love - 3.8.1-2 - Version installed files as intended * Mon Jul 22 2019 Dave love - 3.8.1-1 - Old version for old data