name: hdfeos

on: [push, pull_request]

jobs:
  build:
    name: Build hdfeos
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4.1.1

      - name: Install Autotools Dependencies (Linux)
        run: |
          sudo apt update
          sudo apt install automake autoconf libtool libtool-bin libjpeg-dev
          sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin
      - name: Install HDF4
        run: |
          ./autogen.sh
          ./configure --prefix=/usr/local --enable-shared --disable-fortran --disable-netcdf
          make
          sudo make install
      - name: Install HDF-EOS2
        run: |
          wget -O hdfeos.tar.gz "https://git.earthdata.nasa.gov/projects/DAS/repos/hdfeos/raw/hdf-eos2-3.0-src.tar.gz?at=3128a738021501c821549955f6c78348e5f33850"
          tar zxvf hdfeos.tar.gz
          cd hdf-eos2-3.0
          ./configure LDFLAGS="-L/usr/local/lib -lmfhdf" --prefix=/usr/local/ --enable-shared --enable-install-include
          make
          make check
          sudo make install
