#!/bin/bash
module purge
module load PrgEnv-gnu
module load gcc/13.2.0  # required, see https://dci.dci-gitlab.cines.fr/webextranet/user_support/index.html#prgenv-and-compilers
module load cray-hdf5-parallel
module load netcdf-hdf5parallel/gnu/10.3
module load cmake

# netcdf-hdf5parallel has weird naming conventions => hotfix...
# Used in netcdf95 cmake compilation
rm -rf netcdf-hdfparallel-hotfix
mkdir -p netcdf-hdfparallel-hotfix
cp -r /opt/cray/pe/netcdf-hdf5parallel/4.9.0.5/gnu/10.3/lib/pkgconfig/netcdf*_parallel.pc netcdf-hdfparallel-hotfix
cd netcdf-hdfparallel-hotfix || exit 1
mv netcdf-fortran_parallel.pc netcdf-fortran.pc
PKG_CONFIG_PATH="$(readlink -f .):$PKG_CONFIG_PATH"
# Another similar hotfix to find mpich.pc
PKG_CONFIG_PATH="/opt/cray/pe/mpich/8.1.28/ofi/crayclang/16.0/lib/pkgconfig/:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
cd - || exit 1
