Added WPS package, cleaned up WRF package (#18711)

Co-authored-by: michael laufer <michael.laufer@toganetworks.com>
This commit is contained in:
MichaelLaufer 2020-10-04 05:26:33 +03:00 committed by GitHub
parent 2b56707b7e
commit b9b0d1c2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 567 additions and 17 deletions

View File

@ -0,0 +1,102 @@
# 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 Wps(Package):
"""The Weather Research and Forecasting Pre-Processing System (WPS)
"""
homepage = "https://www.mmm.ucar.edu/weather-research-and-forecasting-model"
url = "https://github.com/wrf-model/WPS/archive/v4.2.tar.gz"
maintainers = ['MichaelLaufer']
version('4.2', sha256='3e175d033355d3e7638be75bc7c0bc0de6da299ebd175a9bbc1b7a121acd0168')
# Serial variant recommended in WRF/WPS docs
variant('build_type', default='serial',
values=('serial', 'serial_NO_GRIB2', 'dmpar', 'dmpar_NO_GRIB2'))
# These patches deal with netcdf & netcdf-fortran being two diff things
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/configure.patch', when='@4.2')
patch('patches/4.2/preamble.patch', when='@4.2')
# 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('wrf')
depends_on('netcdf-c')
depends_on('netcdf-fortran')
# build script use csh
depends_on('tcsh', type=('build'))
# this fixes that for csh install scripts
depends_on('time', type=('build'))
depends_on('m4', type='build')
depends_on('libtool', type='build')
depends_on('jasper')
phases = ['configure', 'build', 'install']
def setup_build_environment(self, env):
env.set('WRF_DIR', self.spec['wrf'].prefix)
env.set('NETCDF', self.spec['netcdf-c'].prefix)
# This gets used via the applied patch files
env.set('NETCDFF', self.spec['netcdf-fortran'].prefix)
env.set('JASPERINC', self.spec['jasper'].prefix.include)
env.set('JASPERLIB', self.spec['jasper'].prefix.lib)
if self.spec.satisfies('%gcc@10:'):
args = '-w -O2 -fallow-argument-mismatch -fallow-invalid-boz'
env.set('FCFLAGS', args)
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": '1',
"serial_NO_GRIB2": '2',
"dmpar": '3',
"dmpar_NO_GRIB2": '4'},
"intel": {"serial": '17',
"serial_NO_GRIB2": '18',
"dmpar": '19',
"dmpar_NO_GRIB2": '20'},
"pgi": {"serial": '5',
"serial_NO_GRIB2": '6',
"dmpar": '7',
"dmpar_NO_GRIB2": '8'},
}
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]
with tempfile.TemporaryFile(mode='w') as fp:
fp.write(build_type + '\n')
fp.seek(0)
Executable('./configure')(input=fp)
def build(self, spec, prefix):
csh = which('csh')
csh('./compile')
def install(self, spec, prefix):
# Copy all of WPS staging dir to install dir
install_tree('.', prefix)

View File

@ -0,0 +1,33 @@
diff --git a/arch/Config.pl b/arch/Config.pl
index 89f86bf..e08bc75 100644
--- a/arch/Config.pl
+++ b/arch/Config.pl
@@ -9,6 +9,7 @@
$sw_perl_path = perl;
$sw_wrf_path = "<SET ME>";
$sw_netcdf_path = "";
+$sw_netcdff_path = "";
$sw_netcdff_lib = "";
$sw_phdf5_path = "";
$sw_jasperlib_path = "";
@@ -40,7 +41,11 @@ while(substr( $ARGV[0], 0, 1 ) eq "-")
}
if(substr( $ARGV[0], 1, 8 ) eq "netcdff=")
{
- $sw_netcdff_lib = substr( $ARGV[0], 9);
+ $sw_netcdff_path = substr( $ARGV[0], 9);
+ }
+ if(substr( $ARGV[0], 1, 11 ) eq "netcdfflib=")
+ {
+ $sw_netcdff_lib = substr( $ARGV[0], 12);
}
if(substr( $ARGV[0], 1, 6 ) eq "phdf5=")
{
@@ -167,6 +172,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_LDFLAGS/$sw_ldflags/g;
$_ =~ s/CONFIGURE_COMPILEFLAGS/$sw_compileflags/g;
$_ =~ s/CONFIGURE_COMP_L/$sw_compL/g;

View File

@ -0,0 +1,356 @@
diff --git a/arch/configure.defaults b/arch/configure.defaults
index 2c66a47..1d78146 100644
--- a/arch/configure.defaults
+++ b/arch/configure.defaults
@@ -11,8 +11,8 @@ SFC = xlf2003_r
CC = mpicc
SCC = xlc_r
LD = $(FC)
-FFLAGS = -qfree=f90 -qufmt=be
-F77FLAGS = -qfixed -qufmt=be
+FFLAGS = $(FCFLAGS) -qfree=f90 -qufmt=be
+F77FLAGS = $(FCFLAGS) -qfixed -qufmt=be
FNGFLAGS = $(FFLAGS)
LDFLAGS =
CFLAGS =
@@ -32,8 +32,8 @@ SFC = pgfortran
CC = mpicc
SCC = pgcc
LD = $(FC)
-FFLAGS = -Mfree -byteswapio
-F77FLAGS = -Mfixed -byteswapio
+FFLAGS = $(FCFLAGS) -Mfree -byteswapio
+F77FLAGS = $(FCFLAGS) -Mfixed -byteswapio
FNGFLAGS = $(FFLAGS)
LDFLAGS =
CFLAGS =
@@ -56,8 +56,8 @@ FC = blrts_xlf90
SFC = blrts_xlf90
CC = blrts_xlc
LD = $(FC)
-FFLAGS = -qfree=f90 $(MPI_INC)
-F77FLAGS = -qfixed $(MPI_INC)
+FFLAGS = $(FCFLAGS) -qfree=f90 $(MPI_INC)
+F77FLAGS = $(FCFLAGS) -qfixed $(MPI_INC)
FNGFLAGS = $(FFLAGS)
LDFLAGS =
SCC = cc
@@ -85,8 +85,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -Mfree -byteswapio -O
-F77FLAGS = -Mfixed -byteswapio -O
+FFLAGS = $(FCFLAGS) -Mfree -byteswapio -O
+F77FLAGS = $(FCFLAGS) -Mfixed -byteswapio -O
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -109,8 +109,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -133,8 +133,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -O -fendian=big
-F77FLAGS = -ffixed-form -O -fendian=big
+FFLAGS = $(FCFLAGS) -ffree-form -O -fendian=big
+F77FLAGS = $(FCFLAGS) -ffixed-form -O -fendian=big
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -157,8 +157,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4
-F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4
+FFLAGS = $(FCFLAGS) -ffree-form -O -fconvert=big-endian -frecord-marker=4
+F77FLAGS = $(FCFLAGS) -ffixed-form -O -fconvert=big-endian -frecord-marker=4
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -180,8 +180,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4
-F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4
+FFLAGS = $(FCFLAGS) -ffree-form -O -fconvert=big-endian -frecord-marker=4
+F77FLAGS = $(FCFLAGS) -ffixed-form -O -fconvert=big-endian -frecord-marker=4
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -205,8 +205,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -Mfree -byteswapio -O
-F77FLAGS = -Mfixed -byteswapio -O
+FFLAGS = $(FCFLAGS) -Mfree -byteswapio -O
+F77FLAGS = $(FCFLAGS) -Mfixed -byteswapio -O
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -231,8 +231,8 @@ DM_CC = $(SCC) -I$(MPI_ROOT)/include
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -Mfree -byteswapio -O
-F77FLAGS = -Mfixed -byteswapio -O
+FFLAGS = $(FCFLAGS) -Mfree -byteswapio -O
+F77FLAGS = $(FCFLAGS) -Mfixed -byteswapio -O
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -L$(MPI_ROOT)/lib -lmpi
@@ -255,8 +255,8 @@ DM_CC = mpicc -cc=pathcc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -freeform -fno-second-underscore -byteswapio -O
-F77FLAGS = -byteswapio -fno-second-underscore -O
+FFLAGS = $(FCFLAGS) -freeform -fno-second-underscore -byteswapio -O
+F77FLAGS = $(FCFLAGS) -byteswapio -fno-second-underscore -O
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -279,8 +279,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -303,8 +303,8 @@ DM_CC = $(SCC) -I$(MPI_ROOT)/include
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -L$(MPI_ROOT)/lib -lmpi
@@ -327,8 +327,8 @@ DM_CC = mpcc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -351,8 +351,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -Mfree -byteswapio -O2
-F77FLAGS = -Mfixed -byteswapio -O2
+FFLAGS = $(FCFLAGS) -Mfree -byteswapio -O2
+F77FLAGS = $(FCFLAGS) -Mfixed -byteswapio -O2
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -g
@@ -376,8 +376,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -Mfree -byteswapio -O2
-F77FLAGS = -Mfixed -byteswapio -O2
+FFLAGS = $(FCFLAGS) -Mfree -byteswapio -O2
+F77FLAGS = $(FCFLAGS) -Mfixed -byteswapio -O2
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -g
@@ -401,8 +401,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -425,8 +425,8 @@ DM_CC = mpicc -cc=gcc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -g -fendian=big
-F77FLAGS = -ffixed-form -g -fendian=big
+FFLAGS = $(FCFLAGS) -ffree-form -g -fendian=big
+F77FLAGS = $(FCFLAGS) -ffixed-form -g -fendian=big
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -g
@@ -450,8 +450,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4
-F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4
+FFLAGS = $(FCFLAGS) -ffree-form -O -fconvert=big-endian -frecord-marker=4
+F77FLAGS = $(FCFLAGS) -ffixed-form -O -fconvert=big-endian -frecord-marker=4
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -475,8 +475,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -O -fconvert=big-endian -frecord-marker=4
-F77FLAGS = -ffixed-form -O -fconvert=big-endian -frecord-marker=4
+FFLAGS = $(FCFLAGS) -ffree-form -O -fconvert=big-endian -frecord-marker=4
+F77FLAGS = $(FCFLAGS) -ffixed-form -O -fconvert=big-endian -frecord-marker=4
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
# For a WRF OpenMP build, add the gomp library for WPS
@@ -505,8 +505,8 @@ DM_CC = mpicc -cc=$(SCC)
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -qfree
-F77FLAGS = -qfixed
+FFLAGS = $(FCFLAGS) -qfree
+F77FLAGS = $(FCFLAGS) -qfixed
FCSUFFIX =
FNGFLAGS = $(FFLAGS) -qextname
LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc000000
@@ -531,8 +531,8 @@ SFC = xlf90_r
SCC = gcc-3.3
DM_FC = mpif90 -f90=$(SFC)
DM_CC = mpicc -cc=$(SCC)
-FFLAGS = -qfree
-F77FLAGS = -qfixed
+FFLAGS = $(FCFLAGS) -qfree
+F77FLAGS = $(FCFLAGS) -qfixed
FNGFLAGS = $(FFLAGS) -qextname
LDFLAGS = -Wl,-stack_size,10000000,-stack_addr,0xc0000000 -L/usr/lib -lSystemStubs
FC = CONFIGURE_FC
@@ -555,8 +555,8 @@ DM_CC = mpicc -cc=gcc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -g -fno-second-underscore
-F77FLAGS = -ffixed-form -g -fno-second-underscore
+FFLAGS = $(FCFLAGS) -ffree-form -g -fno-second-underscore
+F77FLAGS = $(FCFLAGS) -ffixed-form -g -fno-second-underscore
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -g
@@ -584,8 +584,8 @@ FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
AR = ar
-FFLAGS = -qfree=f90
-F77FLAGS = -qfixed
+FFLAGS = $(FCFLAGS) -qfree=f90
+F77FLAGS = $(FCFLAGS) -qfixed
FCSUFFIX = -qsuffix=f=f90
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -607,8 +607,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_FC
LD = $(FC)
-FFLAGS = -free -convert big_endian
-F77FLAGS = -convert big_endian
+FFLAGS = $(FCFLAGS) -free -convert big_endian
+F77FLAGS = $(FCFLAGS) -convert big_endian
FNGFLAGS = $(FFLAGS)
LDFLAGS =
CFLAGS =
@@ -629,8 +629,8 @@ DM_CC = mpicc -cc=$(SCC)
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -ffree-form -g -fno-second-underscore
-F77FLAGS = -ffixed-form -g -fno-second-underscore
+FFLAGS = $(FCFLAGS) -ffree-form -g -fno-second-underscore
+F77FLAGS = $(FCFLAGS) -ffixed-form -g -fno-second-underscore
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -g
@@ -659,8 +659,8 @@ DM_CC = pgcc -Mmpi=msmpi
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -Mfree -g
-F77FLAGS = -Mfixed -g
+FFLAGS = $(FCFLAGS) -Mfree -g
+F77FLAGS = $(FCFLAGS) -Mfixed -g
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -g
@@ -682,8 +682,8 @@ DM_CC = mpicc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -freeform -64
-F77FLAGS = -64
+FFLAGS = $(FCFLAGS) -freeform -64
+F77FLAGS = $(FCFLAGS) -64
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS = -64
@@ -712,8 +712,8 @@ DM_CC = icc -lmpi
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS =
LDFLAGS =
@@ -736,8 +736,8 @@ DM_CC =
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -free
-F77FLAGS =
+FFLAGS = $(FCFLAGS) -free
+F77FLAGS = $(FCFLAGS)
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -759,8 +759,8 @@ DM_CC = cc
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -N255 -f free -h byteswapio
-F77FLAGS = -N255 -f fixed -h byteswapio
+FFLAGS = $(FCFLAGS) -N255 -f free -h byteswapio
+F77FLAGS = $(FCFLAGS) -N255 -f fixed -h byteswapio
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =
@@ -783,8 +783,8 @@ DM_CC = $(SCC)
FC = CONFIGURE_FC
CC = CONFIGURE_CC
LD = $(FC)
-FFLAGS = -FR -convert big_endian
-F77FLAGS = -FI -convert big_endian
+FFLAGS = $(FCFLAGS) -FR -convert big_endian
+F77FLAGS = $(FCFLAGS) -FI -convert big_endian
FCSUFFIX =
FNGFLAGS = $(FFLAGS)
LDFLAGS =

View File

@ -0,0 +1,42 @@
diff --git a/configure b/configure
index d95c5b6..e299dc2 100755
--- a/configure
+++ b/configure
@@ -117,11 +117,13 @@ fi
if [ -n "$NETCDF" ] ; then
echo "Will use NETCDF in dir: $NETCDF"
+ echo "Will use NETCDFF in dir: $NETCDFF"
# for 3.6.2 and greater there might be a second library, libnetcdff.a . Check for this and use
# if available
- NETCDFF=" "
- if [ -f "$NETCDF/lib/libnetcdff.a" ] ; then
- NETCDFF="-lnetcdff"
+ NETCDFF="$NETCDFF"
+ export NETCDFF
+ if [ -f "$NETCDFF/lib/libnetcdff.a" ] ; then
+ NETCDFF_LIB="-lnetcdff"
fi
else
echo "Will configure for use without NetCDF"
@@ -190,7 +192,7 @@ if [ $wrf_dir = "none" ]; then
fi
# Found perl, so proceed with configuration
-perl arch/Config.pl -perl=$PERL -netcdf=$NETCDF -netcdff=$NETCDFF -os=$os -mach=$mach -wrfdir=$wrf_dir
+perl arch/Config.pl -perl=$PERL -netcdf=$NETCDF -netcdff=$NETCDFF -netcdfflib=$NETCDFF_LIB -os=$os -mach=$mach -wrfdir=$wrf_dir
#Checking cross-compiling capability for some particular environment
@@ -356,9 +358,9 @@ cat > fort_netcdf.f <<EOF
end program
EOF
FFLAGS=`grep ^FFLAGS configure.wps | cut -d"=" -f2-`
- cp $NETCDF/include/netcdf.inc .
+ cp $NETCDFF/include/netcdf.inc .
FC=`grep ^SFC configure.wps | cut -d"=" -f2-`
- $FC ${FFLAGS} fort_netcdf.f -o fort_netcdf -L${NETCDF}/lib $NETCDFF -lnetcdf > /dev/null 2>&1
+ $FC ${FFLAGS} fort_netcdf.f -o fort_netcdf -L${NETCDF}/lib -L${NETCDFF}/lib ${NETCDFF_LIB} -lnetcdf > /dev/null 2>&1
if [ -f "fort_netcdf" ] ; then
./fort_netcdf > /dev/null 2>&1
if [ $? = 0 ]; then

View File

@ -0,0 +1,21 @@
diff --git a/arch/preamble b/arch/preamble
index f5d316f..cb0d4a0 100644
--- a/arch/preamble
+++ b/arch/preamble
@@ -39,13 +39,14 @@ WRF_INCLUDE = -I$(WRF_DIR)/external/io_netcdf \
-I$(WRF_DIR)/external/io_grib1 \
-I$(WRF_DIR)/external/io_int \
-I$(WRF_DIR)/inc \
- -I$(NETCDF)/include
+ -I$(NETCDF)/include \
+ -I$(NETCDFF)/include
WRF_LIB = -L$(WRF_DIR)/external/io_grib1 -lio_grib1 \
-L$(WRF_DIR)/external/io_grib_share -lio_grib_share \
-L$(WRF_DIR)/external/io_int -lwrfio_int \
-L$(WRF_DIR)/external/io_netcdf -lwrfio_nf \
- -L$(NETCDF)/lib CONFIGURE_NETCDFF_LIB -lnetcdf
+ -L$(NETCDFF)/lib -L$(NETCDF)/lib CONFIGURE_NETCDFF_LIB -lnetcdf
#### Architecture specific settings ####

View File

@ -17,6 +17,7 @@ class Wrf(Package):
homepage = "https://www.mmm.ucar.edu/weather-research-and-forecasting-model"
url = "https://github.com/wrf-model/WRF/archive/v4.2.tar.gz"
maintainers = ['MichaelLaufer']
version('4.2', sha256='c39a1464fd5c439134bbd39be632f7ce1afd9a82ad726737e37228c6a3d74706')
version('4.0', sha256='a5b072492746f96a926badda7e6b44cb0af26695afdd6c029a94de5e1e5eec73')
@ -61,7 +62,7 @@ class Wrf(Package):
# 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-c')
depends_on('netcdf-fortran')
depends_on('jasper')
depends_on('libpng')
@ -74,27 +75,24 @@ class Wrf(Package):
# 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)
def setup_build_environment(self, env):
env.set('NETCDF', self.spec['netcdf-c'].prefix)
if '+pnetcdf' in self.spec:
spack_env.set('PNETCDF', self.spec['parallel-netcdf'].prefix)
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)
env.set('NETCDFF', self.spec['netcdf-fortran'].prefix)
env.set('PHDF5', self.spec['hdf5'].prefix)
env.set('JASPERINC', self.spec['jasper'].prefix.include)
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)
env.set('FCFLAGS', args)
env.set('FFLAGS', args)
def patch(self):
# Let's not assume csh is intalled in bin
@ -144,7 +142,5 @@ def build(self, spec, prefix):
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)
# Save all install files as many are needed for WPS and WRF runs
install_tree('.', prefix)