NAME="aalib"
DESC="Library to render any graphic into ASCII Ar"
VERSION="1.4rc5"

FILES=(
  "https://downloads.sourceforge.net/aa-project/aalib-${VERSION}.tar.gz"
  "rawmode_init_return.patch"
  "curses_getsize_fix.patch"
  "c99.patch"
)
HASHES=(
  "9801095c42bba12edebd1902bcf0a990"
  "b7ef5ababe8070c02ce6e66b7105c99b6d96d997ed6dcde877289bc2d58edd09"
  "c0c0bbb30c4a5f0872c31d139a119c31a9264fb7acfc8219ef22793b422a2b5b"
  "77302331599aebbae529ae2eaba3def77abf209998f0678c30e14f201033567a"
)

DEPENDS=("slang" "gpm" "mkfontscale" "fonts")

PACKAGE() {
  tar xf "${NAME}-${VERSION}.tar.gz"
  cd "${NAME}-1.4.0"

  sed -i -e '/AM_PATH_AALIB,/s/AM_PATH_AALIB/[&]/' aalib.m4
  sed -e 's/8x13bold/-*-luxi mono-bold-r-normal--13-120-*-*-m-*-*-*/' \
    -i src/aax.c

  patch -Np1 -i ../rawmode_init_return.patch
  patch -Np1 -i ../curses_getsize_fix.patch
  patch -Np1 -i ../c99.patch

  autoreconf -fi

  ./configure --prefix=/usr             \
              --infodir=/usr/share/info \
              --mandir=/usr/share/man   \
              --with-ncurses=/usr       \
              --disable-static
  
  make
  make DESTDIR="${ROOTDIR}" install

  cd .. && rm -r "${NAME}-1.4.0"
}
