%bcond mpich 1 %bcond openmpi 1 Name: nceplibs-wrf_io Version: 1.3.0 Release: 2%{?dist} Summary: Lightweight WRF-IO API library. License: LGPL-3.0-only URL: https://github.com/NOAA-EMC/NCEPLIBS-wrf_io Source0: https://github.com/NOAA-EMC/NCEPLIBS-wrf_io/archive/refs/tags/v%{version}.tar.gz Source1: wrf_io.pc.in Patch1: 001-fortran-module-location-option.patch Patch2: 002-build-shared-libraries.patch Patch3: 003-private-includes.patch # Always build serial %global build_list serial %if %{with mpich} %global build_list %{?build_list} mpich %endif %if %{with openmpi} %global build_list %{?build_list} openmpi %endif # Override default build dir for multiple builds %global _vpath_builddir %{_vpath_builddir}-$MPI_COMPILER BuildRequires: cmake BuildRequires: gcc-gfortran BuildRequires: pkgconfig BuildRequires: pkgconfig(netcdf-fortran) %description This is a lightweight WRF-IO API library for Unified Post Processor (UPP). It reads wrf forecasts (WRF state plus diagnostics). %package devel Summary: NCEPLIBS-wrf_io libraries. Requires: %{name}%{?_isa} = %{version}-%{release} Requires: gcc-gfortran%{_isa} Requires: cmake Requires: pkgconfig Requires: pkgconfig(netcdf-fortran) %description devel NCEPLIBS-wrf_io development files. %if %{with mpich} %package mpich Summary: NCEPLIBS-wrf_io mpich libraries. BuildRequires: mpich-devel BuildRequires: netcdf-fortran-mpich-devel Requires: mpich Requires: netcdf-fortran-mpich %description mpich NCEPLIBS-wrf_io parallel mpich libraries. %package mpich-devel Summary: NCEPLIBS-wrf_io mpich development files. Requires: %{name}-mpich%{?_isa} = %{version}-%{release} Requires: gcc-gfortran%{_isa} Requires: cmake Requires: mpich-devel Requires: netcdf-fortran-mpich-devel Requires: pkgconfig %description mpich-devel NCEPLIBS-wrf_io parallel mpich development files. %endif %if %{with openmpi} %package openmpi Summary: NCEPLIBS-wrf_io openmpi libraries. BuildRequires: openmpi-devel BuildRequires: netcdf-fortran-openmpi-devel Requires: openmpi Requires: netcdf-fortran-openmpi %description openmpi NCEPLIBS-wrf_io parallel openmpi libraries. %package openmpi-devel Summary: NCEPLIBS-wrf_io openmpi development files. Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} Requires: gcc-gfortran%{_isa} Requires: cmake Requires: openmpi-devel Requires: netcdf-fortran-openmpi-devel Requires: pkgconfig %description openmpi-devel NCEPLIBS-wrf_io parallel openmpi development files. %endif %prep %autosetup -n NCEPLIBS-wrf_io-%{version} -p0 %build # Build function build() { %cmake \ -DCMAKE_INSTALL_PREFIX:PATH=${MPI_HOME:-%{_prefix}} \ -DCMAKE_INSTALL_FULL_SBINDIR:PATH=${MPI_BIN:-%{_sbindir}} \ -DCMAKE_INSTALL_SBINDIR:PATH=%(s=${MPI_BIN:-%{_sbindir}}; echo ${s##*/}) \ -DINCLUDE_INSTALL_DIR:PATH=${MPI_INCLUDE:-%{_includedir}} \ -DCMAKE_INSTALL_LIBDIR=${MPI_LIB:-%{_libdir}} \ -DLIB_INSTALL_DIR:PATH=${MPI_LIB:-%{_libdir}} \ -DSYSCONF_INSTALL_DIR:PATH=${MPI_SYSCONFIG:-%{_sysconfdir}} \ -DFMODDIR=${MPI_FORTRAN_MOD_DIR:-%{_fmoddir}} \ -DBUILD_SHARED_LIBS=ON \ -DENABLE_MPI=$MPI \ -DBUILD_TESTING=OFF %cmake_build sed \ -e "s|FMODDIR|${MPI_FORTRAN_MOD_DIR:-%{_fmoddir}}|g" \ -e "s|LIBDIR|${MPI_LIB:-%{_libdir}}|g" \ -e "s|VERSION|%{version}|g" \ %{SOURCE1} > wrf_io${MPI_SUFFIX}.pc } for build in %{build_list}; do case "$build" in serial) MPI_COMPILER=serial MPI=OFF build ;; %if %{with mpich} mpich) %{_mpich_load} CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif77 MPI=ON build %{_mpich_unload} ;; %endif %if %{with openmpi} openmpi) %{_openmpi_load} CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif77 MPI=ON build %{_openmpi_unload} ;; %endif esac done %install for build in %{build_list}; do case "$build" in serial) MPI_COMPILER=serial %cmake_install install -Dpm 0644 wrf_io.pc %{buildroot}%{_libdir}/pkgconfig/wrf_io.pc ;; %if %{with mpich} mpich) %{_mpich_load} %cmake_install install -Dpm 0644 wrf_io${MPI_SUFFIX}.pc %{buildroot}${MPI_LIB}/pkgconfig/wrf_io.pc %{_mpich_unload} ;; %endif %if %{with openmpi} openmpi) %{_openmpi_load} %cmake_install install -Dpm 0644 wrf_io${MPI_SUFFIX}.pc %{buildroot}${MPI_LIB}/pkgconfig/wrf_io.pc %{_openmpi_unload} ;; %endif esac done %files %license LICENSE.md %doc README.md %{_libdir}/libwrf_io.so.* %files devel %{_fmoddir}/*.mod %dir %{_libdir}/cmake/wrf_io/ %{_libdir}/cmake/wrf_io/*.cmake %{_libdir}/libwrf_io.so %{_libdir}/pkgconfig/wrf_io.pc %if %{with mpich} %files mpich %license LICENSE.md %doc README.md %{_libdir}/mpich/lib/libwrf_io.so.* %files mpich-devel %{_fmoddir}/mpich/*.mod %dir %{_libdir}/mpich/lib/cmake/wrf_io/ %{_libdir}/mpich/lib/cmake/wrf_io/*.cmake %{_libdir}/mpich/lib/libwrf_io.so %{_libdir}/mpich/lib/pkgconfig/wrf_io.pc %endif %if %{with openmpi} %files openmpi %license LICENSE.md %doc README.md %{_libdir}/openmpi/lib/libwrf_io.so.* %files openmpi-devel %{_fmoddir}/openmpi/*.mod %dir %{_libdir}/openmpi/lib/cmake/wrf_io/ %{_libdir}/openmpi/lib/cmake/wrf_io/*.cmake %{_libdir}/openmpi/lib/libwrf_io.so %{_libdir}/openmpi/lib/pkgconfig/wrf_io.pc %endif %changelog * Sat Jan 17 2026 Benjamin Cook - 1.3.0-2 - Add patch to make source includes private * Thu Jan 15 2026 Benjamin Cook - 1.3.0-1 - Initial Package