rpm -q epel-release || dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

if ! subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms; then
  # add the codeready-builder repository
  dnf install -y dnf-plugins-core
  dnf config-manager --set-enabled "codeready-builder-for-rhel-8-*-rpms" || true
fi

dnf install -y perl make libpng-devel libsodium-devel tcl tk tk-devel java-1.8.0-openjdk-devel ImageMagick ImageMagick-c++ libxml2-devel cairo-devel git fontconfig-devel freetype-devel libgit2-devel libssh2 openssl-devel zlib-devel unixODBC-devel udunits2-devel libjpeg-turbo-devel libtiff-devel mariadb-devel libcurl-devel mesa-libGLU-devel mesa-libGL-devel gdal-devel gdal sqlite-devel proj-devel geos-devel libicu-devel fribidi-devel harfbuzz-devel glpk-devel gmp-devel