# Description: A compressed GIF library compatible with libungif
# URL: https://giflib.sourceforge.net
# Maintainer: zorz, zorz at gmx dot com

name=giflib
version=5.2.2
release=2
source=(https://sourceforge.net/projects/giflib/files/$name-$version.tar.gz
  giflib-5.2.2-security_fixes-1.patch
  giflib-5.2.2-upstream_fixes-1.patch)

build() {
  cd $name-$version

  sed -e "/\$(MAKE) -C doc$/d" -i Makefile

  patch -Np1 -i $SRC/giflib-5.2.2-security_fixes-1.patch
  patch -Np1 -i $SRC/giflib-5.2.2-upstream_fixes-1.patch

  make
  make PREFIX=$PKG/usr install

  install -vDm 644 doc/*.1 -t $PKG/usr/share/man/man1/
  install -vDm 644 doc/*.7 -t $PKG/usr/share/man/man7/
}
