apt-get install -y build-essential libaec-dev zlib1g-dev libcurl4-openssl-dev libboost-dev curl wget zip unzip bzip2 gfortran gcc g++ m4 automake
export CC=gcc
export FC=gfortran
#USE_NETCDF3=0
#USE_NETCDF4=1
#USE_JASPER=1
#USE_OPENJPEG=0
AARCH_specific_flag=--build=aarch64-unknown-linux-gnu
Then to the line 971 (starting with cd ${jasperdir}
add {$AARCH_specific_flag}
right after the ./configure
Do the same for netcdf and libproj and you're good to go
run make
it will complain and ask to wget
things, such as:
wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.0/netcdf-c-4.9.0.tar.gz
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.2/src/hdf5-1.12.2.tar.gz
hdf5
will take ages to test while compiling, that's just how it is.
the wgrib2 binary will sit in ./wgrib2/wgrib2