---
# System prepended metadata

title: WRF singularity def
tags: [WRF]

---

# WRF singularity def
###### tags: `WRF`
```=
Bootstrap: docker
From: centos:7

%post
        rm -f /var/run/yum.pid 
        yum -y update 
        yum -y groupinstall "Development Tools" 
        yum -y install make 
        yum -y install gcc gcc-c++ csh wget time cmake unzip git libstdc++-devel libXScrnSaver m4 
        yum -y install net-snmp-devel mysql-devel openssl-devel libtool dos2unix help2man 
        mkdir -p /Build_WRF/src 
        mkdir -p /Build_WRF/LIBRARIES 
        cd /Build_WRF/src 
        wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz 
        wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-c-4.7.3.tar.gz 
        wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-4.5.2.tar.gz 
        wget http://www.zlib.net/fossils/zlib-1.2.11.tar.gz 
        wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.37.tar.gz 
        wget http://www.ece.uvic.ca/~mdadams/jasper/software/jasper-1.900.1.zip 
        wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.17/src/hdf5-1.8.17.tar.gz 
        tar -xvf openmpi-3.1.4.tar.gz 
        tar -xvzf netcdf-c-4.7.3.tar.gz 
        tar -xzvf netcdf-fortran-4.5.2.tar.gz 
        tar -xzvf zlib-1.2.11.tar.gz 
        tar -xzvf libpng-1.6.37.tar.gz 
        unzip jasper-1.900.1.zip 
        tar -xzvf hdf5-1.8.17.tar.gz 
        # opempi
        cd /Build_WRF/src/openmpi-3.1.4 
        ./configure --prefix=/openmpi 
        make 
        make install
        # Setting up the environemnt for compiler
%environment
        export PATH=$PATH:/Build_WRF/src/openmpi/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Build_WRF/src/openmpi/lib
%post
        # zlib    
        RUN cd /Build_WRF/src/zlib-1.2.11 
        ./configure --prefix=/Build_WRF/LIBRARIES/zlib 
        make  
        make install 
        # HDF5
        cd /Build_WRF/src/hdf5-1.8.17 
        ./configure --prefix=/Build_WRF/LIBRARIES/ --with-zlib=/Build_WRF/LIBRARIES/ --enable-fortran 
        make 
        make install
%environment
        # netcdf    
        export LD_LIBRARY_PATH=/Build_WRF/LIBRARIES/netcdf/lib
        export LDFLAGS=-L/Build_WRF/LIBRARIES/netcdf/lib
        export CPPFLAGS=-I/Build_WRF/LIBRARIES/netcdf/include
        cd /Build_WRF/src/netcdf-c-4.7.3 
        yum -y install curl 
        ./configure --prefix=/Build_WRF/LIBRARIES/ --disable-dap 
        make 
        make install 
        cd /Build_WRF/src/netcdf-fortran-4.5.2 
        ./configure --prefix=/Build_WRF/LIBRARIES/ 
        make 
        make install
        # libpng
        cd /Build_WRF/src/libpng-1.6.37/  
        CPPFLAGS='-I/Build_WRF/LIBRARIES/zlib/include' LDFLAGS='-L/Build_WRF/LIBRARIES/zlib/lib' /Build_WRF/src/libpng-1.6.37/configure --prefix=/Build_WRF/LIBRARIES/libpng 
        make -j2 
        make install
%environment
        export LD_LIBRARY_PATH=/Build_WRF/LIBRARIES/libpng/lib:$LD_LIBRARY_PATH
%post
        # jasper
        cd /Build_WRF/src/jasper-1.900.1 
        ./configure --prefix=/Build_WRF/LIBRARIES/ 
        make 
        make install 
        # WRF_ISC21
        cd /Build_WRF/ 
        git clone https://github.com/wrf-model/WRF /Build_WRF/WRF_ISC21 
        cd /Build_WRF/WRF_ISC21 
        git checkout tags/ISC21 -b ISC21-branch
%environment
        export NETCDF=/Build_WRF/LIBRARIES/
        export HDF5=/Build_WRF/LIBRARIES/
        export WRFIO_NCD_LARGE_FILE_SUPPORT=1
        export NETCDF_classic=1
%post
        cd /Build_WRF/WRF_ISC21/ 
        ./configure <<< $'34\r1\r'
```
