summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/wrf/package.py150
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/Makefile.patch21
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/arch.Config.pl.patch37
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/arch.conf_tokens.patch16
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/arch.configure.defaults.patch10
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/arch.postamble.patch27
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/configure.patch44
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.0/external.io_netcdf.makefile.patch42
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/Makefile.patch20
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/arch.Config.pl.patch62
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/arch.conf_tokens.patch18
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/arch.configure.defaults.patch68
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/arch.postamble.patch36
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/configure.patch43
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/external.io_netcdf.makefile.patch43
-rw-r--r--var/spack/repos/builtin/packages/wrf/patches/4.2/var.gen_be.Makefile.patch40
16 files changed, 677 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/wrf/package.py b/var/spack/repos/builtin/packages/wrf/package.py
new file mode 100644
index 0000000000..c9d11a8ee0
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/package.py
@@ -0,0 +1,150 @@
+# Copyright 2013-2018 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)
+
+from spack import *
+
+import glob
+import tempfile
+
+
+class Wrf(Package):
+ """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.
+ """
+
+ homepage = "https://www.mmm.ucar.edu/weather-research-and-forecasting-model"
+ url = "https://github.com/wrf-model/WRF/archive/v4.2.tar.gz"
+
+ version('4.2', sha256='c39a1464fd5c439134bbd39be632f7ce1afd9a82ad726737e37228c6a3d74706')
+ version('4.0', sha256='a5b072492746f96a926badda7e6b44cb0af26695afdd6c029a94de5e1e5eec73')
+
+ variant('build_type', default='dmpar',
+ values=('serial', 'smpar', 'dmpar', 'dmsm'))
+
+ variant('nesting', default='basic',
+ values=('basic', 'preset', 'vortex'))
+
+ variant('compile_type', default='em_real',
+ values=('em_real', 'em_quarter_ss', 'em_b_wave', 'em_les',
+ 'em_heldsuarez', 'em_tropical_cyclone', 'em_hill2d_x',
+ 'em_squall2d_x', 'em_squall2d_y', 'em_grav2d_x',
+ 'em_seabreeze2d_x', 'em_scm_xy'))
+
+ variant('pnetcdf', default=True,
+ description='Parallel IO support through Pnetcdf libray')
+
+ # These patches deal with netcdf & netcdf-fortran being two diff things
+ # Patches are based on:
+ # https://github.com/easybuilders/easybuild-easyconfigs/blob/master/easybuild/easyconfigs/w/WRF/WRF-3.5_netCDF-Fortran_separate_path.patch
+ patch('patches/4.0/arch.Config.pl.patch', when='@4.0')
+ patch('patches/4.0/arch.configure.defaults.patch', when='@4.0')
+ patch('patches/4.0/arch.conf_tokens.patch', when='@4.0')
+ patch('patches/4.0/arch.postamble.patch', when='@4.0')
+ patch('patches/4.0/configure.patch', when='@4.0')
+ patch('patches/4.0/external.io_netcdf.makefile.patch', when='@4.0')
+ patch('patches/4.0/Makefile.patch', when='@4.0')
+
+ patch('patches/4.2/arch.Config.pl.patch', when='@4.2')
+ patch('patches/4.2/arch.configure.defaults.patch', when='@4.2')
+ patch('patches/4.2/arch.conf_tokens.patch', when='@4.2')
+ patch('patches/4.2/arch.postamble.patch', when='@4.2')
+ patch('patches/4.2/configure.patch', when='@4.2')
+ patch('patches/4.2/external.io_netcdf.makefile.patch', when='@4.2')
+ patch('patches/4.2/var.gen_be.Makefile.patch', when='@4.2')
+ patch('patches/4.2/Makefile.patch', when='@4.2')
+
+ depends_on('mpi')
+ # According to:
+ # http://www2.mmm.ucar.edu/wrf/users/docs/user_guide_v4/v4.0/users_guide_chap2.html#_Required_Compilers_and_1
+ # Section: "Required/Optional Libraries to Download"
+ depends_on('parallel-netcdf', when='+pnetcdf')
+ depends_on('netcdf-c+parallel-netcdf')
+ depends_on('netcdf-fortran')
+ depends_on('jasper')
+ depends_on('libpng')
+ depends_on('zlib')
+ depends_on('perl')
+ # not sure if +fortran is required, but seems like a good idea
+ depends_on('hdf5+fortran+hl+mpi')
+ # build script use csh
+ depends_on('tcsh', type=('build'))
+ # time is not installed on all systems b/c bash provides it
+ # this fixes that for csh install scripts
+ depends_on('time', type=('build'))
+
+ depends_on('autoconf', type='build')
+ depends_on('automake', type='build')
+ depends_on('m4', type='build')
+ depends_on('libtool', type='build')
+ phases = ['configure', 'build', 'install']
+
+ def setup_build_environment(self, spack_env):
+ spack_env.set('NETCDF', self.spec['netcdf-c'].prefix)
+ if '+pnetcdf' in self.spec:
+ spack_env.set('PNETCDF', self.spec['parallel-netcdf'].prefix)
+ # This gets used via the applied patch files
+ spack_env.set('NETCDFF', self.spec['netcdf-fortran'].prefix)
+ spack_env.set('PHDF5', self.spec['hdf5'].prefix)
+ spack_env.set('JASPERINC', self.spec['jasper'].prefix.include)
+ spack_env.set('JASPERLIB', self.spec['jasper'].prefix.lib)
+
+ if self.spec.satisfies('%gcc@10:'):
+ args = '-w -O2 -fallow-argument-mismatch -fallow-invalid-boz'
+ spack_env.set('FCFLAGS', args)
+ spack_env.set('FFLAGS', args)
+
+ def patch(self):
+ # Let's not assume csh is intalled in bin
+ files = glob.glob('*.csh')
+
+ filter_file('^#!/bin/csh -f', '#!/usr/bin/env csh', *files)
+ filter_file('^#!/bin/csh', '#!/usr/bin/env csh', *files)
+
+ def configure(self, spec, prefix):
+ build_opts = {"gcc": {"serial": '32',
+ "smpar": '33',
+ "dmpar": '34',
+ "dmsm": '35'},
+ "intel": {"serial": '13',
+ "smpar": '14',
+ "dmpar": '15',
+ "dmsm": '16'},
+ "pgi": {"serial": '52',
+ "smpar": '53',
+ "dmpar": '54',
+ "dmsm": '55'},
+ }
+
+ nesting_opts = {"basic": "1",
+ "preset": "2",
+ "vortex": "3"}
+
+ try:
+ compiler_opts = build_opts[self.spec.compiler.name]
+ except KeyError:
+ raise InstallError("Compiler not recognized nor supported.")
+
+ # Spack already makes sure that the variant value is part of the set.
+ build_type = compiler_opts[spec.variants['build_type'].value]
+
+ nesting_value = nesting_opts[spec.variants['nesting'].value]
+
+ with tempfile.TemporaryFile(mode='w') as fp:
+ fp.write(build_type + '\n' + nesting_value + '\n')
+ fp.seek(0)
+ Executable('./configure')(input=fp)
+
+ def build(self, spec, prefix):
+ csh = which('csh')
+ # num of compile jobs capped at 20 in wrf
+ csh('./compile', '-j', str(min(int(make_jobs), 20)),
+ spec.variants['compile_type'].value)
+
+ def install(self, spec, prefix):
+ mkdir(prefix.bin)
+ install('./main/wrf.exe', prefix.bin)
+ install('./main/ndown.exe', prefix.bin)
+ install('./main/real.exe', prefix.bin)
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/Makefile.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/Makefile.patch
new file mode 100644
index 0000000000..5fb99e78ae
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/Makefile.patch
@@ -0,0 +1,21 @@
+--- a/Makefile 2018-06-08 19:39:31.000000000 -0500
++++ b/Makefile 2018-11-02 13:33:12.273662388 -0500
+@@ -906,14 +906,14 @@
+ @ echo '--------------------------------------'
+ ( cd frame ; $(MAKE) $(J) LLIST="$(LINKLIST)" framework ; \
+ cd ../external/io_netcdf ; \
+- $(MAKE) NETCDFPATH="$(NETCDFPATH)" \
+- FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \
++ $(MAKE) NETCDFPATH="$(NETCDFPATH)" FNETCDFFPATH="$(NETCDFFPATH)" \
++ C="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \
+ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \
+ LIB_LOCAL="$(LIB_LOCAL)" \
+ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \
+ cd ../io_netcdf ; \
+- $(MAKE) NETCDFPATH="$(NETCDFPATH)" \
+- FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \
++ $(MAKE) NETCDFPATH="$(NETCDFPATH)" FNETCDFFPATH="$(NETCDFFPATH)" \
++ C="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \
+ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \
+ LIB_LOCAL="$(LIB_LOCAL)" \
+ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR"; \
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.Config.pl.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.Config.pl.patch
new file mode 100644
index 0000000000..b9269ab5e2
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.Config.pl.patch
@@ -0,0 +1,37 @@
+--- a/arch/Config.pl 2018-06-08 19:39:31.000000000 -0500
++++ b/arch/Config.pl 2018-11-02 13:33:12.165660199 -0500
+@@ -8,6 +8,7 @@
+ select((select(STDOUT), $|=1)[0]);
+ $sw_perl_path = perl ;
+ $sw_netcdf_path = "" ;
++$sw_netcdff_path = "" ;
+ $sw_pnetcdf_path = "" ;
+ $sw_hdf5_path="";
+ $sw_phdf5_path="";
+@@ -63,6 +64,10 @@
+ {
+ $sw_netcdf_path = substr( $ARGV[0], 8 ) ;
+ }
++ if (substr( $ARGV[0], 1, 8) eq "netcdff=" )
++ {
++ $sw_netcdff_path = substr( $ARGV[0], 9) ;
++ }
+ if ( substr( $ARGV[0], 1, 13 ) eq "dep_lib_path=" )
+ {
+ $sw_dep_lib_path = substr( $ARGV[0], 14 ) ;
+@@ -117,6 +122,7 @@
+ if ( substr( $ARGV[0], 1, 11 ) eq "USENETCDFF=" )
+ {
+ $sw_usenetcdff = substr( $ARGV[0], 12 ) ;
++ $sw_usenetcdff =~ s/!/ /g ;
+ }
+ if ( substr( $ARGV[0], 1, 10 ) eq "USENETCDF=" )
+ {
+@@ -439,6 +445,7 @@
+ {
+ $_ =~ s/CONFIGURE_PERL_PATH/$sw_perl_path/g ;
+ $_ =~ s/CONFIGURE_NETCDF_PATH/$sw_netcdf_path/g ;
++ $_ =~ s/CONFIGURE_NETCDFF_PATH/$sw_netcdff_path/g ;
+ $_ =~ s/CONFIGURE_PNETCDF_PATH/$sw_pnetcdf_path/g ;
+ $_ =~ s/CONFIGURE_HDF5_PATH/$sw_hdf5_path/g ;
+ $_ =~ s/CONFIGURE_PHDF5_PATH/$sw_phdf5_path/g ;
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.conf_tokens.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.conf_tokens.patch
new file mode 100644
index 0000000000..1be2361c53
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.conf_tokens.patch
@@ -0,0 +1,16 @@
+--- a/arch/conf_tokens 2018-06-08 19:39:31.000000000 -0500
++++ b/arch/conf_tokens 2018-11-02 13:33:12.347663887 -0500
+@@ -5,6 +5,7 @@
+ CONFIGURE_DMPARALLEL
+ CONFIGURE_RWORDSIZE
+ CONFIGURE_NETCDF_FLAG
++CONFIGURE_NETCDFF_FLAG
+ CONFIGURE_GRIB2_FLAG
+ CONFIGURE_NETCDF_LIB_PATH
+ CONFIGURE_GRIB2_LIB
+@@ -13,4 +14,5 @@
+ CONFIGURE_WRFIO_NF
+ CONFIGURE_WRFIO_GRIB2
+ CONFIGURE_NETCDF_PATH
++CONFIGURE_NETCDFF_PATH
+ CONFIGURE_GRIB2_INC
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.configure.defaults.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.configure.defaults.patch
new file mode 100644
index 0000000000..7de1273d18
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.configure.defaults.patch
@@ -0,0 +1,10 @@
+--- a/arch/configure.defaults 2018-11-11 10:02:30.575095478 -0600
++++ b/arch/configure.defaults 2018-11-02 13:33:12.352663988 -0500
+@@ -1598,6 +1598,7 @@
+
+ LIB_EXTERNAL = \
+ ../external/io_netcdf/libwrfio_nf.a CONFIGURE_NETCDF_PATH/lib/libnetcdf.lib \
++ CONFIGURE_NETCDFF_PATH/lib/libnetcdff.lib
+ ../external/wavelet/libWavelet.a ../external/wavelet/lib_wavelet.a
+ ESMF_IO_LIB = ../external/esmf_time_f90/libesmf_time.a
+ LIB_BUNDLED = \
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.postamble.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.postamble.patch
new file mode 100644
index 0000000000..59677edd9b
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/arch.postamble.patch
@@ -0,0 +1,27 @@
+--- a/arch/postamble 2018-06-08 19:39:31.000000000 -0500
++++ b/arch/postamble 2018-11-02 13:33:12.162660138 -0500
+@@ -48,6 +48,7 @@
+ -I$(WRF_SRC_ROOT_DIR)/wrftladj \
+ -I$(WRF_SRC_ROOT_DIR)/chem -I$(WRF_SRC_ROOT_DIR)/inc \
+ -I$(NETCDFPATH)/include \
++ -I$(NETCDFFPATH)/include \
+ CONFIGURE_RTTOV_INC
+ REGISTRY = Registry
+ CC_TOOLS_CFLAGS = CONFIGURE_NMM_CORE
+@@ -70,6 +71,7 @@
+ ENVCOMPDEFS = CONFIGURE_COMPILEFLAGS
+ CPPFLAGS = $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG) CONFIGURE_COMMS_INCLUDE
+ NETCDFPATH = CONFIGURE_NETCDF_PATH
++NETCDFFPATH = CONFIGURE_NETCDFF_PATH
+ HDF5PATH = CONFIGURE_HDF5_PATH
+ WRFPLUSPATH = CONFIGURE_WRFPLUS_PATH
+ RTTOVPATH = CONFIGURE_RTTOV_PATH
+@@ -101,7 +103,7 @@
+
+ wrfio_nf :
+ ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdf ; \
+- make $(J) NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
++ make $(J) NETCDFPATH="$(NETCDFPATH)" NETCDFFPATH="$(NETCDFFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
+ CC="$(SCC)" CFLAGS="$(CFLAGS)" \
+ FC="$(SFC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )
+
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/configure.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/configure.patch
new file mode 100644
index 0000000000..4a56e867b3
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/configure.patch
@@ -0,0 +1,44 @@
+--- a/configure 2018-06-08 19:39:31.000000000 -0500
++++ b/configure 2018-11-02 13:33:12.344663826 -0500
+@@ -190,6 +190,13 @@
+ else
+ USENETCDF=" "
+ fi
++ # for netCDF 4.2 and greater, the Fortran library is a separate install
++ if [ -z "$NETCDFF" ]; then
++ NETCDFF="$NETCDF"
++ fi
++ if [ -f "$NETCDFF/lib/libnetcdff.a" ] ; then
++ USENETCDFF="-L$NETCDFF/lib!-lnetcdff" # ! will be replaced with space
++ fi
+ export USENETCDF=$USENETCDF
+ export USENETCDFF=$USENETCDFF
+ else
+@@ -549,7 +556,7 @@
+ srch=`grep -i "^#ARCH.*$os" arch/configure.defaults | grep -i "$mach"`
+ if [ -n "$srch" ] ; then
+ $PERL arch/Config.pl -dmparallel=$COMMLIB -ompparallel=$OMP -perl=$PERL \
+- -netcdf=$NETCDF -pnetcdf=$PNETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
++ -netcdf=$NETCDF -netcdff=$NETCDFF -pnetcdf=$PNETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
+ -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -USENETCDF=$USENETCDF \
+ -time=$FORTRAN_COMPILER_TIMER -tfl="$TFL" -cfl="$CFL" -config_line="$config_line" \
+ -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -dep_lib_path="$DEP_LIB_PATH"
+@@ -629,14 +636,14 @@
+ echo "If you wish to change the default options, edit the file:"
+ echo " arch/configure.defaults"
+
+-if test -n "$NETCDF" ; then
+- if [ ! -f $NETCDF/include/netcdf.inc ] ; then
++if test -n "$NETCDFF" ; then
++ if [ ! -f $NETCDFF/include/netcdf.inc ] ; then
+ echo
+- echo "Error : Not found $NETCDF/include/netcdf.inc"
++ echo "Error : Not found $NETCDFF/include/netcdf.inc"
+ echo " Please check this installation of NetCDF and re-run this configure script"
+ exit -1
+ fi
+- grep nf_format_64bit $NETCDF/include/netcdf.inc > /dev/null
++ grep nf_format_64bit $NETCDFF/include/netcdf.inc > /dev/null
+ configure_aaaa=$? ; export configure_aaaa
+ if [ $configure_aaaa -a -z "$WRFIO_NCD_NO_LARGE_FILE_SUPPORT" ] ; then
+ echo "NetCDF users note:"
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.0/external.io_netcdf.makefile.patch b/var/spack/repos/builtin/packages/wrf/patches/4.0/external.io_netcdf.makefile.patch
new file mode 100644
index 0000000000..5572f63860
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.0/external.io_netcdf.makefile.patch
@@ -0,0 +1,42 @@
+--- a/external/io_netcdf/makefile 2018-06-08 19:39:31.000000000 -0500
++++ b/external/io_netcdf/makefile 2018-11-02 13:33:12.280662529 -0500
+@@ -3,9 +3,9 @@
+ OBJSL = wrf_io.o field_routines.o module_wrfsi_static.o
+ OBJS = $(OBJSL)
+ CODE = ext_ncd_get_dom_ti.code ext_ncd_get_var_td.code ext_ncd_get_var_ti.code ext_ncd_put_dom_ti.code ext_ncd_put_var_td.code ext_ncd_put_var_ti.code transpose.code
+-FFLAGS = $(FCFLAGS) -I$(NETCDFPATH)/include -I../ioapi_share
+-LIBS = $(LIB_LOCAL) -L$(NETCDFPATH)/lib -lnetcdf
+-LIBFFS = $(LIB_LOCAL) -L$(NETCDFPATH)/lib -lnetcdff -lnetcdf $(NETCDF4_DEP_LIB)
++FFLAGS = $(FCFLAGS) -I$(NETCDFFPATH)/include -I../ioapi_share
++LIBS = $(LIB_LOCAL) -L$(NETCDFFPATH)/lib -lnetcdf
++LIBFFS = $(LIB_LOCAL) -L$(NETCDFFPATH)/lib -lnetcdff -lnetcdf $(NETCDF4_DEP_LIB)
+ CPP1 = $(CPP) -P $(TRADFLAG)
+ M4 = m4 -Uinclude -Uindex -Ulen
+ AR = ar
+@@ -24,7 +24,7 @@
+ $(RANLIB) $@
+
+ wrf_io.o: wrf_io.F90 $(CODE)
+- grep nf_format_64bit $(NETCDFPATH)/include/netcdf.inc ;\
++ grep nf_format_64bit $(NETCDFFPATH)/include/netcdf.inc ;\
+ a=$$? ; export a ; \
+ if [ $$a -a "$$WRFIO_NCD_LARGE_FILE_SUPPORT" = "1" ] ; then \
+ $(CPP1) -DWRFIO_NCD_LARGE_FILE_SUPPORT -I../ioapi_share wrf_io.F90 | $(M4) - > wrf_io.f ; \
+@@ -43,14 +43,14 @@
+ x=`echo "$(FC)" | awk '{print $$1}'` ; export x ; \
+ if [ $$x = "gfortran" ] ; then \
+ echo removing external declaration of iargc for gfortran ; \
+- $(CPP1) -I$(NETCDFPATH)/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
++ $(CPP1) -I$(NETCDFFPATH)/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
+ else \
+- $(CPP1) -I$(NETCDFPATH)/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
++ $(CPP1) -I$(NETCDFFPATH)/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
+ fi
+ $(FC) -c $(FFLAGS) diffwrf.f
+ @if [ \( -f ../../frame/wrf_debug.o \) -a \( -f ../../frame/module_wrf_error.o \) -a \( -f $(ESMF_MOD_DEPENDENCE) \) -a \( -f ../../frame/clog.o \) ] ; then \
+ echo "diffwrf io_netcdf is being built now. " ; \
+- if [ \( -f $(NETCDFPATH)/lib/libnetcdff.a -o -f $(NETCDFPATH)/lib/libnetcdff.so \) ] ; then \
++ if [ \( -f $(NETCDFFPATH)/lib/libnetcdff.a -o -f $(NETCDFPATH)/lib/libnetcdff.so \) ] ; then \
+ $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o ../../frame/clog.o $(ESMF_IO_LIB_EXT) $(LIBFFS) ;\
+ else \
+ $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o ../../frame/clog.o $(ESMF_IO_LIB_EXT) $(LIBS) ;\
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/Makefile.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/Makefile.patch
new file mode 100644
index 0000000000..fe01efb756
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/Makefile.patch
@@ -0,0 +1,20 @@
+diff --git a/Makefile b/Makefile
+index 9b6600a..8805cd1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -976,13 +976,13 @@ framework :
+ @ echo '--------------------------------------'
+ ( cd frame ; $(MAKE) $(J) LLIST="$(LINKLIST)" framework ; \
+ cd ../external/io_netcdf ; \
+- $(MAKE) NETCDFPATH="$(NETCDFPATH)" \
++ $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDFFPATH="$(NETCDFFPATH)" \
+ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \
+ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \
+ LIB_LOCAL="$(LIB_LOCAL)" \
+ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \
+ cd ../io_netcdf ; \
+- $(MAKE) NETCDFPATH="$(NETCDFPATH)" \
++ $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDFFPATH="$(NETCDFFPATH)" \
+ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \
+ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \
+ LIB_LOCAL="$(LIB_LOCAL)" \
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.Config.pl.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.Config.pl.patch
new file mode 100644
index 0000000000..ca3840ac55
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.Config.pl.patch
@@ -0,0 +1,62 @@
+diff --git a/arch/Config.pl b/arch/Config.pl
+index b6f45db..75fad32 100644
+--- a/arch/Config.pl
++++ b/arch/Config.pl
+@@ -8,6 +8,7 @@
+ select((select(STDOUT), $|=1)[0]);
+ $sw_perl_path = perl ;
+ $sw_netcdf_path = "" ;
++$sw_netcdff_path = "" ;
+ $sw_pnetcdf_path = "" ;
+ $sw_hdf5_path="";
+ $sw_phdf5_path="";
+@@ -63,6 +64,10 @@ while ( substr( $ARGV[0], 0, 1 ) eq "-" )
+ {
+ $sw_netcdf_path = substr( $ARGV[0], 8 ) ;
+ }
++ if ( substr( $ARGV[0], 1, 8 ) eq "netcdff=" )
++ {
++ $sw_netcdff_path = substr( $ARGV[0], 9 ) ;
++ }
+ if ( substr( $ARGV[0], 1, 13 ) eq "dep_lib_path=" )
+ {
+ $sw_dep_lib_path = substr( $ARGV[0], 14 ) ;
+@@ -117,6 +122,7 @@ while ( substr( $ARGV[0], 0, 1 ) eq "-" )
+ if ( substr( $ARGV[0], 1, 11 ) eq "USENETCDFF=" )
+ {
+ $sw_usenetcdff = substr( $ARGV[0], 12 ) ;
++ $sw_usenetcdff =~ s/!/ /g ;
+ }
+ if ( substr( $ARGV[0], 1, 10 ) eq "USENETCDF=" )
+ {
+@@ -443,6 +449,7 @@ while ( <CONFIGURE_DEFAULTS> )
+ {
+ $_ =~ s/CONFIGURE_PERL_PATH/$sw_perl_path/g ;
+ $_ =~ s/CONFIGURE_NETCDF_PATH/$sw_netcdf_path/g ;
++ $_ =~ s/CONFIGURE_NETCDFF_PATH/$sw_netcdff_path/g ;
+ $_ =~ s/CONFIGURE_PNETCDF_PATH/$sw_pnetcdf_path/g ;
+ $_ =~ s/CONFIGURE_HDF5_PATH/$sw_hdf5_path/g ;
+ $_ =~ s/CONFIGURE_PHDF5_PATH/$sw_phdf5_path/g ;
+@@ -484,17 +491,19 @@ while ( <CONFIGURE_DEFAULTS> )
+ if ( $sw_netcdf_path )
+ { $_ =~ s/CONFIGURE_WRFIO_NF/wrfio_nf/g ;
+ $_ =~ s:CONFIGURE_NETCDF_FLAG:-DNETCDF: ;
++ $_ =~ s:CONFIGURE_NETCDFF_FLAG:-DNETCDFF: ;
+ if ( $ENV{NETCDF_LDFLAGS} ) {
+- $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf/libwrfio_nf.a $ENV{NETCDF_LDFLAGS} : ;
++ $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf/libwrfio_nf.a $ENV{NETCDF_LDFLAGS} $ENV{NETCDFF_LDFLAGS}: ;
+ } elsif ( $sw_os eq "Interix" ) {
+- $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf/libwrfio_nf.a -L$sw_netcdf_path/lib $sw_usenetcdff $sw_usenetcdf : ;
++ $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf/libwrfio_nf.a -L$sw_netcdf_path/lib -L$sw_netcdff_path/lib $sw_usenetcdff $sw_usenetcdf : ;
+ } else {
+- $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:-L\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf -lwrfio_nf -L$sw_netcdf_path/lib $sw_usenetcdff $sw_usenetcdf : ;
++ $_ =~ s:CONFIGURE_NETCDF_LIB_PATH:-L\$\(WRF_SRC_ROOT_DIR\)/external/io_netcdf -lwrfio_nf -L$sw_netcdf_path/lib -L$sw_netcdff_path/lib $sw_usenetcdff $sw_usenetcdf : ;
+ }
+ }
+ else
+ { $_ =~ s/CONFIGURE_WRFIO_NF//g ;
+ $_ =~ s:CONFIGURE_NETCDF_FLAG::g ;
++ $_ =~ s:CONFIGURE_NETCDFF_FLAG::g ;
+ $_ =~ s:CONFIGURE_NETCDF_LIB_PATH::g ;
+ }
+
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.conf_tokens.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.conf_tokens.patch
new file mode 100644
index 0000000000..49de156934
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.conf_tokens.patch
@@ -0,0 +1,18 @@
+diff --git a/arch/conf_tokens b/arch/conf_tokens
+index 2695b30..7b1f7df 100644
+--- a/arch/conf_tokens
++++ b/arch/conf_tokens
+@@ -5,6 +5,7 @@
+ CONFIGURE_DMPARALLEL
+ CONFIGURE_RWORDSIZE
+ CONFIGURE_NETCDF_FLAG
++CONFIGURE_NETCDFF_FLAG
+ CONFIGURE_GRIB2_FLAG
+ CONFIGURE_NETCDF_LIB_PATH
+ CONFIGURE_GRIB2_LIB
+@@ -13,4 +14,5 @@ CONFIGURE_COMPILEFLAGS
+ CONFIGURE_WRFIO_NF
+ CONFIGURE_WRFIO_GRIB2
+ CONFIGURE_NETCDF_PATH
++CONFIGURE_NETCDFF_PATH
+ CONFIGURE_GRIB2_INC
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.configure.defaults.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.configure.defaults.patch
new file mode 100644
index 0000000000..58e6ffccf4
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.configure.defaults.patch
@@ -0,0 +1,68 @@
+diff --git a/arch/configure.defaults b/arch/configure.defaults
+index 9098375..7767a81 100644
+--- a/arch/configure.defaults
++++ b/arch/configure.defaults
+@@ -74,7 +74,7 @@ FORMAT_FIXED = -ffixed-form
+ FORMAT_FREE = -ffree-form -ffree-line-length-none
+ FCSUFFIX =
+ BYTESWAPIO = -fconvert=big-endian -frecord-marker=4
+-FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
++FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) $(FFLAGS)
+ FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+ MODULE_SRCH_FLAG =
+ TRADFLAG = CONFIGURE_TRADFLAG
+@@ -786,7 +786,7 @@ FORMAT_FIXED = -ffixed-form
+ FORMAT_FREE = -ffree-form -ffree-line-length-none
+ FCSUFFIX =
+ BYTESWAPIO = -fconvert=big-endian -frecord-marker=4
+-FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
++FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) $(FFLAGS)
+ FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+ MODULE_SRCH_FLAG =
+ TRADFLAG = CONFIGURE_TRADFLAG
+@@ -1007,7 +1007,7 @@ FORMAT_FIXED = -ffixed-form
+ FORMAT_FREE = -ffree-form -ffree-line-length-none
+ FCSUFFIX =
+ BYTESWAPIO = -fconvert=big-endian -frecord-marker=4
+-FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
++FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) $(FFLAGS)
+ FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+ MODULE_SRCH_FLAG =
+ TRADFLAG = CONFIGURE_TRADFLAG
+@@ -1050,7 +1050,7 @@ FORMAT_FIXED = -ffixed-form
+ FORMAT_FREE = -ffree-form -ffree-line-length-none
+ FCSUFFIX =
+ BYTESWAPIO = -fconvert=big-endian -frecord-marker=4
+-FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
++FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) $(FFLAGS)
+ FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+ MODULE_SRCH_FLAG =
+ TRADFLAG = CONFIGURE_TRADFLAG
+@@ -1598,7 +1598,8 @@ CC_TOOLS = $(SCC)
+
+ LIB_EXTERNAL = \
+ ../external/io_netcdf/libwrfio_nf.a CONFIGURE_NETCDF_PATH/lib/libnetcdf.lib \
+- ../external/wavelet/libWavelet.a ../external/wavelet/lib_wavelet.a
++ ../external/wavelet/libWavelet.a ../external/wavelet/lib_wavelet.a \
++ CONFIGURE_NETCDFF_PATH/lib/libnetcdff.lib
+ ESMF_IO_LIB = ../external/esmf_time_f90/libesmf_time.a
+ LIB_BUNDLED = \
+ ../external/fftpack/fftpack5/libfftpack.a \
+@@ -1773,7 +1774,7 @@ FORMAT_FIXED = -ffixed-form
+ FORMAT_FREE = -ffree-form -ffree-line-length-none
+ FCSUFFIX =
+ BYTESWAPIO = -fconvert=big-endian -frecord-marker=4
+-FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
++FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) $(FFLAGS)
+ FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+ MODULE_SRCH_FLAG =
+ TRADFLAG = CONFIGURE_TRADFLAG
+@@ -1947,7 +1948,7 @@ FORMAT_FIXED = -ffixed-form
+ FORMAT_FREE = -ffree-form -ffree-line-length-none
+ FCSUFFIX =
+ BYTESWAPIO = -fconvert=big-endian -frecord-marker=4
+-FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO)
++FCBASEOPTS_NO_G = -w $(FORMAT_FREE) $(BYTESWAPIO) $(FFLAGS)
+ FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG)
+ MODULE_SRCH_FLAG =
+ TRADFLAG = -traditional
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.postamble.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.postamble.patch
new file mode 100644
index 0000000000..9d163c8785
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/arch.postamble.patch
@@ -0,0 +1,36 @@
+diff --git a/arch/postamble b/arch/postamble
+index c855259..93e4ae3 100644
+--- a/arch/postamble
++++ b/arch/postamble
+@@ -53,6 +53,7 @@ INCLUDE_MODULES = $(MODULE_SRCH_FLAG) \
+ -I$(WRF_SRC_ROOT_DIR)/wrftladj \
+ -I$(WRF_SRC_ROOT_DIR)/chem -I$(WRF_SRC_ROOT_DIR)/inc \
+ -I$(NETCDFPATH)/include \
++ -I$(NETCDFFPATH)/include \
+ CONFIGURE_RTTOV_INC
+ REGISTRY = Registry
+ CC_TOOLS_CFLAGS = CONFIGURE_NMM_CORE
+@@ -62,6 +63,7 @@ LDFLAGS = $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL) CONFIGURE_LDFLAGS
+ ENVCOMPDEFS = CONFIGURE_COMPILEFLAGS
+ CPPFLAGS = $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG) CONFIGURE_COMMS_INCLUDE
+ NETCDFPATH = CONFIGURE_NETCDF_PATH
++NETCDFFPATH = CONFIGURE_NETCDFF_PATH
+ HDF5PATH = CONFIGURE_HDF5_PATH
+ WRFPLUSPATH = CONFIGURE_WRFPLUS_PATH
+ RTTOVPATH = CONFIGURE_RTTOV_PATH
+@@ -93,13 +95,13 @@ module_dm_rsllite :
+
+ wrfio_nf :
+ ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdf ; \
+- make $(J) NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
++ make $(J) NETCDFPATH="$(NETCDFPATH)" NETCDFFPATH="$(NETCDFFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
+ CC="$(SCC)" CFLAGS="$(CFLAGS)" \
+ FC="$(SFC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )
+
+ wrfio_pnf :
+ ( cd $(WRF_SRC_ROOT_DIR)/external/io_pnetcdf ; \
+- make $(J) NETCDFPATH="$(PNETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP) $(ARCHFLAGS)" \
++ make $(J) NETCDFPATH="$(PNETCDFPATH)" NETCDFFPATH="$(NETCDFFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP) $(ARCHFLAGS)" \
+ FC="$(FC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )
+
+ wrfio_grib_share :
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/configure.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/configure.patch
new file mode 100644
index 0000000000..26bdcd9714
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/configure.patch
@@ -0,0 +1,43 @@
+diff --git a/configure b/configure
+index c4fc28b..16a9ef5 100755
+--- a/configure
++++ b/configure
+@@ -179,8 +179,9 @@ USENETCDFF=""
+ USENETCDF=""
+ if [ -n "$NETCDF" ] ; then
+ echo "Will use NETCDF in dir: $NETCDF"
++ echo "Will use NETCDFF in dir: $NETCDFF"
+ # Oh UNIDATA, why make it so hard ...
+- if [ -f "$NETCDF/lib/libnetcdff.a" -o -f "$NETCDF/lib/libnetcdff.so" -o -f "$NETCDF/lib/libnetcdff.dll.a" ] ; then
++ if [ -f "$NETCDFF/lib/libnetcdff.a" -o -f "$NETCDFF/lib/libnetcdff.so" -o -f "$NETCDFF/lib/libnetcdff.dll.a" ] ; then
+ USENETCDFF="-lnetcdff"
+ else
+ USENETCDFF=" "
+@@ -552,7 +553,7 @@ if test -n "$PERL" ; then
+ srch=`grep -i "^#ARCH.*$os" arch/configure.defaults | grep -i "$mach"`
+ if [ -n "$srch" ] ; then
+ $PERL arch/Config.pl -dmparallel=$COMMLIB -ompparallel=$OMP -perl=$PERL \
+- -netcdf=$NETCDF -pnetcdf=$PNETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
++ -netcdf=$NETCDF -netcdff=$NETCDFF -pnetcdf=$PNETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
+ -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -USENETCDF=$USENETCDF \
+ -time=$FORTRAN_COMPILER_TIMER -tfl="$TFL" -cfl="$CFL" -config_line="$config_line" \
+ -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -dep_lib_path="$DEP_LIB_PATH"
+@@ -634,14 +635,14 @@ echo "If you wish to change settings, please edit that file."
+ echo "If you wish to change the default options, edit the file:"
+ echo " arch/configure.defaults"
+
+-if test -n "$NETCDF" ; then
+- if [ ! -f $NETCDF/include/netcdf.inc ] ; then
++if test -n "$NETCDFF" ; then
++ if [ ! -f $NETCDFF/include/netcdf.inc ] ; then
+ echo
+- echo "Error : Not found $NETCDF/include/netcdf.inc"
++ echo "Error : Not found $NETCDFF/include/netcdf.inc"
+ echo " Please check this installation of NetCDF and re-run this configure script"
+ exit -1
+ fi
+- grep nf_format_64bit $NETCDF/include/netcdf.inc > /dev/null
++ grep nf_format_64bit $NETCDFF/include/netcdf.inc > /dev/null
+ configure_aaaa=$? ; export configure_aaaa
+ if [ $configure_aaaa -a -z "$WRFIO_NCD_NO_LARGE_FILE_SUPPORT" ] ; then
+ echo "NetCDF users note:"
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/external.io_netcdf.makefile.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/external.io_netcdf.makefile.patch
new file mode 100644
index 0000000000..00a6d3595c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/external.io_netcdf.makefile.patch
@@ -0,0 +1,43 @@
+diff --git a/external/io_netcdf/makefile b/external/io_netcdf/makefile
+index fa638d4..9778990 100644
+--- a/external/io_netcdf/makefile
++++ b/external/io_netcdf/makefile
+@@ -3,9 +3,9 @@
+ OBJSL = wrf_io.o field_routines.o module_wrfsi_static.o
+ OBJS = $(OBJSL)
+ CODE = ext_ncd_get_dom_ti.code ext_ncd_get_var_td.code ext_ncd_get_var_ti.code ext_ncd_put_dom_ti.code ext_ncd_put_var_td.code ext_ncd_put_var_ti.code transpose.code
+-FFLAGS = $(FCFLAGS) -I$(NETCDFPATH)/include -I../ioapi_share
++FFLAGS = $(FCFLAGS) -I$(NETCDFFPATH)/include -I../ioapi_share
+ LIBS = $(LIB_LOCAL) -L$(NETCDFPATH)/lib -lnetcdf
+-LIBFFS = $(LIB_LOCAL) -L$(NETCDFPATH)/lib -lnetcdff -lnetcdf $(NETCDF4_DEP_LIB)
++LIBFFS = $(LIB_LOCAL) -L$(NETCDFPATH)/lib -L$(NETCDFFPATH)/lib -lnetcdff -lnetcdf $(NETCDF4_DEP_LIB)
+ CPP1 = $(CPP) -P $(TRADFLAG)
+ M4 = m4 -Uinclude -Uindex -Ulen
+ AR = ar
+@@ -24,7 +24,7 @@ libwrfio_nf.a: $(OBJS) $(CODE)
+ $(RANLIB) $@
+
+ wrf_io.o: wrf_io.F90 $(CODE)
+- grep nf_format_64bit $(NETCDFPATH)/include/netcdf.inc ;\
++ grep nf_format_64bit $(NETCDFFPATH)/include/netcdf.inc ;\
+ a=$$? ; export a ; \
+ if [ $$a -a "$$WRFIO_NCD_LARGE_FILE_SUPPORT" = "1" ] ; then \
+ $(CPP1) -DWRFIO_NCD_LARGE_FILE_SUPPORT -I../ioapi_share wrf_io.F90 | $(M4) - > wrf_io.f ; \
+@@ -43,14 +43,14 @@ diffwrf: diffwrf.F90
+ x=`echo "$(FC)" | awk '{print $$1}'` ; export x ; \
+ if [ $$x = "gfortran" ] ; then \
+ echo removing external declaration of iargc for gfortran ; \
+- $(CPP1) -I$(NETCDFPATH)/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
++ $(CPP1) -I$(NETCDFFPATH)/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
+ else \
+- $(CPP1) -I$(NETCDFPATH)/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
++ $(CPP1) -I$(NETCDFFPATH)/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
+ fi
+ $(FC) -c $(FFLAGS) diffwrf.f
+ @if [ \( -f ../../frame/wrf_debug.o \) -a \( -f ../../frame/module_wrf_error.o \) -a \( -f $(ESMF_MOD_DEPENDENCE) \) -a \( -f ../../frame/clog.o \) ] ; then \
+ echo "diffwrf io_netcdf is being built now. " ; \
+- if [ \( -f $(NETCDFPATH)/lib/libnetcdff.a -o -f $(NETCDFPATH)/lib/libnetcdff.so -o -f $(NETCDFPATH)/lib/libnetcdff.dll.a \) ] ; then \
++ if [ \( -f $(NETCDFFPATH)/lib/libnetcdff.a -o -f $(NETCDFFPATH)/lib/libnetcdff.so -o -f $(NETCDFFPATH)/lib/libnetcdff.dll.a \) ] ; then \
+ $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o ../../frame/clog.o $(ESMF_IO_LIB_EXT) $(LIBFFS) ;\
+ else \
+ $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o ../../frame/clog.o $(ESMF_IO_LIB_EXT) $(LIBS) ;\
diff --git a/var/spack/repos/builtin/packages/wrf/patches/4.2/var.gen_be.Makefile.patch b/var/spack/repos/builtin/packages/wrf/patches/4.2/var.gen_be.Makefile.patch
new file mode 100644
index 0000000000..b9f65526f7
--- /dev/null
+++ b/var/spack/repos/builtin/packages/wrf/patches/4.2/var.gen_be.Makefile.patch
@@ -0,0 +1,40 @@
+diff --git a/var/gen_be/Makefile b/var/gen_be/Makefile
+index 208c34d..20ae8d7 100644
+--- a/var/gen_be/Makefile
++++ b/var/gen_be/Makefile
+@@ -14,7 +14,7 @@ gen_be : gen_be_ensrf.exe \
+ gen_be_ep1.exe \
+ gen_be_ep2.exe \
+ gen_be_vertloc.exe \
+- gen_be_addmean.exe
++ gen_be_addmean.exe \
+ gen_be_stage1.exe \
+ gen_be_stage1_1dvar.exe \
+ gen_be_stage2.exe \
+@@ -70,7 +70,7 @@ gen_be_vertloc.exe : gen_be_vertloc.f90 $(GEN_BE_OBJS) $(GEN_BE_LIBS)
+ $(SFC) -o gen_be_vertloc.exe $(LDFLAGS) $(GEN_BE_OBJS) gen_be_vertloc.o $(GEN_BE_LIB)
+
+ gen_be_addmean.exe : gen_be_addmean.f90 $(GEN_BE_OBJS) $(GEN_BE_LIBS)
+- $(CPP) $(CPPFLAGS) -I$(WRF_SRC_ROOT_DIR)/inc -I$(NETCDFPATH)/include gen_be_addmean.f90 > gen_be_addmean.f
++ $(CPP) $(CPPFLAGS) -I$(WRF_SRC_ROOT_DIR)/inc -I$(NETCDFFPATH)/include gen_be_addmean.f90 > gen_be_addmean.f
+ $(SFC) -c $(FCFLAGS) -I../da $(MODULE_DIRS) $(WRFVAR_INC) $(PROMOTION) gen_be_addmean.f
+ $(SFC) -o gen_be_addmean.exe $(LDFLAGS) $(GEN_BE_OBJS) gen_be_addmean.o $(GEN_BE_LIB)
+
+@@ -140,7 +140,7 @@ gen_be_diags_read.exe : gen_be_diags_read.f90 $(GEN_BE_OBJS) $(GEN_BE_LIBS)
+ $(SFC) -o gen_be_diags_read.exe $(LDFLAGS) $(GEN_BE_OBJS) gen_be_diags_read.o $(GEN_BE_LIB)
+
+ gen_be_etkf.exe : gen_be_etkf.f90 $(GEN_BE_OBJS) $(GEN_BE_LIBS)
+- $(CPP) $(CPPFLAGS) -I$(WRF_SRC_ROOT_DIR)/inc -I$(NETCDFPATH)/include gen_be_etkf.f90 > gen_be_etkf.f
++ $(CPP) $(CPPFLAGS) -I$(WRF_SRC_ROOT_DIR)/inc -I$(NETCDFFPATH)/include gen_be_etkf.f90 > gen_be_etkf.f
+ $(SFC) -c $(FCFLAGS) -I../da $(MODULE_DIRS) $(WRFVAR_INC) $(PROMOTION) gen_be_etkf.f
+ $(SFC) -o gen_be_etkf.exe $(LDFLAGS) $(GEN_BE_OBJS) gen_be_etkf.o $(GEN_BE_LIB)
+
+@@ -150,7 +150,7 @@ gen_be_ensrf.exe : gen_be_ensrf.f90 $(GEN_BE_OBJS) $(GEN_BE_LIBS)
+ $(SFC) -o gen_be_ensrf.exe $(LDFLAGS) $(GEN_BE_OBJS) gen_be_ensrf.o $(GEN_BE_LIB)
+
+ gen_be_ensmean.exe : gen_be_ensmean.f90 $(GEN_BE_OBJS) $(GEN_BE_LIBS)
+- $(CPP) $(CPPFLAGS) -I$(WRF_SRC_ROOT_DIR)/inc -I$(NETCDFPATH)/include gen_be_ensmean.f90 > gen_be_ensmean.f
++ $(CPP) $(CPPFLAGS) -I$(WRF_SRC_ROOT_DIR)/inc -I$(NETCDFFPATH)/include gen_be_ensmean.f90 > gen_be_ensmean.f
+ $(SFC) -c $(FCFLAGS) -I../da $(MODULE_DIRS) $(WRFVAR_INC) $(PROMOTION) gen_be_ensmean.f
+ $(SFC) -o gen_be_ensmean.exe $(LDFLAGS) $(GEN_BE_OBJS) gen_be_ensmean.o $(GEN_BE_LIB)
+